xref: /netbsd-src/sys/arch/ia64/include/ieeefp.h (revision 6a493d6bc668897c91594964a732d38505b70cbb)
1 /* $NetBSD: ieeefp.h,v 1.1 2012/12/26 19:43:10 martin Exp $ */
2 
3 /*
4  * Written by J.T. Conklin, Apr 28, 1995
5  * Public domain.
6  */
7 
8 #ifndef _IA64_IEEEFP_H_
9 #define _IA64_IEEEFP_H_
10 
11 #include <sys/featuretest.h>
12 
13 #if defined(_NETBSD_SOURCE) || defined(_ISOC99_SOURCE)
14 
15 typedef int fenv_t;
16 typedef int fexcept_t;
17 
18 #define	FE_INVALID	0x01	/* invalid operation exception */
19 #define	FE_DIVBYZERO	0x02	/* divide-by-zero exception */
20 #define	FE_OVERFLOW	0x04	/* overflow exception */
21 #define	FE_UNDERFLOW	0x08	/* underflow exception */
22 #define	FE_INEXACT	0x10	/* imprecise (loss of precision; "inexact") */
23 #define	FE_IOVERFLOW	0x20    /* integer overflow */
24 
25 #define	FE_ALL_EXCEPT	0x3f
26 
27 /*
28  * These bits match the fpcr as well as bits 12:11
29  * in fp operate instructions
30  */
31 #define	FE_TOWARDZERO	0	/* round to zero (truncate) */
32 #define	FE_DOWNWARD	1	/* round toward negative infinity */
33 #define	FE_TONEAREST	2	/* round to nearest representable number */
34 #define	FE_UPWARD	3	/* round toward positive infinity */
35 
36 #if !defined(_ISOC99_SOURCE)
37 
38 typedef int fp_except;
39 
40 #define	FP_X_INV	FE_INVALID	/* invalid operation exception */
41 #define	FP_X_DZ		FE_DIVBYZERO	/* divide-by-zero exception */
42 #define	FP_X_OFL	FE_OVERFLOW	/* overflow exception */
43 #define	FP_X_UFL	FE_UNDERFLOW	/* underflow exception */
44 #define	FP_X_IMP	FE_INEXACT	/* imprecise (prec. loss; "inexact") */
45 #define	FP_X_IOV	FE_IOVERFLOW	/* integer overflow */
46 
47 /*
48  * fp_rnd bits match the fpcr, below, as well as bits 12:11
49  * in fp operate instructions
50  */
51 typedef enum {
52     FP_RZ = FE_TOWARDZERO,	/* round to zero (truncate) */
53     FP_RM = FE_DOWNWARD,	/* round toward negative infinity */
54     FP_RN = FE_TONEAREST,	/* round to nearest representable number */
55     FP_RP = FE_UPWARD,		/* round toward positive infinity */
56     _FP_DYNAMIC=FP_RP
57 } fp_rnd;
58 
59 #endif /* !_ISOC99_SOURCE */
60 
61 #endif	/* _NETBSD_SOURCE || _ISOC99_SOURCE */
62 
63 #endif /* _IA64_IEEEFP_H_ */
64 
65 
66 
67 
68 
69 
70 
71 
72 
73 
74