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