ieeefp.h revision 1.5.74.1 1 1.5.74.1 mjf /* $NetBSD: ieeefp.h,v 1.5.74.1 2008/09/28 10:40:02 mjf 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.5.74.1 mjf #include <sys/featuretest.h>
13 1.5.74.1 mjf
14 1.5.74.1 mjf #if defined(_NETBSD_SOURCE) || defined(_ISOC99_SOURCE)
15 1.5.74.1 mjf
16 1.5.74.1 mjf typedef int fenv_t;
17 1.5.74.1 mjf typedef int fexcept_t;
18 1.5.74.1 mjf
19 1.5.74.1 mjf #define FE_INEXACT 0x01 /* imprecise (loss of precision) */
20 1.5.74.1 mjf #define FE_DIVBYZERO 0x02 /* divide-by-zero exception */
21 1.5.74.1 mjf #define FE_UNDERFLOW 0x04 /* overflow exception */
22 1.5.74.1 mjf #define FE_OVERFLOW 0x08 /* underflow exception */
23 1.5.74.1 mjf #define FE_INVALID 0x10 /* invalid operation exception */
24 1.5.74.1 mjf
25 1.5.74.1 mjf #define FE_ALL_EXCEPT 0x1f
26 1.5.74.1 mjf
27 1.5.74.1 mjf #define FE_TONEAREST 0 /* round to nearest representable number */
28 1.5.74.1 mjf #define FE_TOWARDZERO 1 /* round to zero (truncate) */
29 1.5.74.1 mjf #define FE_UPWARD 2 /* round toward positive infinity */
30 1.5.74.1 mjf #define FE_DOWNWARD 3 /* round toward negative infinity */
31 1.5.74.1 mjf
32 1.5.74.1 mjf #if !defined(_ISOC99_SOURCE)
33 1.5.74.1 mjf
34 1.1 mycroft typedef int fp_except;
35 1.5.74.1 mjf
36 1.5.74.1 mjf #define FP_X_IMP FE_INEXACT /* imprecise (loss of precision) */
37 1.5.74.1 mjf #define FP_X_DZ FE_DIVBYZERO /* divide-by-zero exception */
38 1.5.74.1 mjf #define FP_X_UFL FE_UNDERFLOW /* underflow exception */
39 1.5.74.1 mjf #define FP_X_OFL FE_OVERFLOW /* overflow exception */
40 1.5.74.1 mjf #define FP_X_INV FE_INVALID /* invalid operation exception */
41 1.1 mycroft
42 1.1 mycroft typedef enum {
43 1.5.74.1 mjf FP_RN=FE_TONEAREST, /* round to nearest representable number */
44 1.5.74.1 mjf FP_RZ=FE_TOWARDZERO, /* round to zero (truncate) */
45 1.5.74.1 mjf FP_RM=FE_DOWNWARD, /* round toward negative infinity */
46 1.5.74.1 mjf 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.5.74.1 mjf #endif /* defined(_NETBSD_SOURCE) */
56 1.5.74.1 mjf
57 1.4 thorpej #define __HAVE_FP_PREC
58 1.4 thorpej
59 1.5.74.1 mjf
60 1.5.74.1 mjf #endif /* _NETBSD_SOURCE || _ISOC99_SOURCE */
61 1.5.74.1 mjf
62 1.1 mycroft #endif /* _M68K_IEEEFP_H_ */
63