xref: /netbsd/sys/arch/m68k/include/ieeefp.h (revision 6550d01e)
1 /*	$NetBSD: ieeefp.h,v 1.7 2009/01/27 19:04:39 martin Exp $	*/
2 
3 /*
4  * Written by J.T. Conklin, Apr 6, 1995
5  * Modified by Jason R. Thorpe, June 22, 2003
6  * Public domain.
7  */
8 
9 #ifndef _M68K_IEEEFP_H_
10 #define _M68K_IEEEFP_H_
11 
12 #include <sys/featuretest.h>
13 
14 #if defined(_NETBSD_SOURCE) || defined(_ISOC99_SOURCE)
15 
16 typedef int fenv_t;
17 typedef int fexcept_t;
18 
19 #define	FE_INEXACT	0x01	/* imprecise (loss of precision) */
20 #define	FE_DIVBYZERO	0x02	/* divide-by-zero exception */
21 #define	FE_UNDERFLOW	0x04	/* overflow exception */
22 #define	FE_OVERFLOW	0x08	/* underflow exception */
23 #define	FE_INVALID	0x10	/* invalid operation exception */
24 
25 #define	FE_ALL_EXCEPT	0x1f
26 
27 #define	FE_TONEAREST	0	/* round to nearest representable number */
28 #define	FE_TOWARDZERO	1	/* round to zero (truncate) */
29 #define	FE_DOWNWARD	2	/* round toward negative infinity */
30 #define	FE_UPWARD	3	/* round toward positive infinity */
31 
32 #if !defined(_ISOC99_SOURCE)
33 
34 typedef int fp_except;
35 
36 #define FP_X_IMP	FE_INEXACT	/* imprecise (loss of precision) */
37 #define FP_X_DZ		FE_DIVBYZERO	/* divide-by-zero exception */
38 #define FP_X_UFL	FE_UNDERFLOW	/* underflow exception */
39 #define FP_X_OFL	FE_OVERFLOW	/* overflow exception */
40 #define FP_X_INV	FE_INVALID	/* invalid operation exception */
41 
42 typedef enum {
43     FP_RN=FE_TONEAREST,		/* round to nearest representable number */
44     FP_RZ=FE_TOWARDZERO,	/* round to zero (truncate) */
45     FP_RM=FE_DOWNWARD,		/* round toward negative infinity */
46     FP_RP=FE_UPWARD		/* round toward positive infinity */
47 } fp_rnd;
48 
49 typedef enum {
50     FP_PE=0,			/* extended-precision (64-bit) */
51     FP_PS=1,			/* single-precision (24-bit) */
52     FP_PD=2			/* double-precision (53-bit) */
53 } fp_prec;
54 
55 #endif /* defined(_NETBSD_SOURCE) */
56 
57 #define	__HAVE_FP_PREC
58 
59 
60 #endif	/* _NETBSD_SOURCE || _ISOC99_SOURCE */
61 
62 #endif /* _M68K_IEEEFP_H_ */
63