ieeefp.h revision 1.9 1 1.9 chs /* $NetBSD: ieeefp.h,v 1.9 2017/02/27 06:47:58 chs 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.8 christos #include <m68k/fenv.h>
17 1.6 matt
18 1.6 matt #if !defined(_ISOC99_SOURCE)
19 1.6 matt
20 1.1 mycroft typedef int fp_except;
21 1.6 matt
22 1.9 chs /* adjust for FP_* and FE_* value differences */
23 1.9 chs #define __FPE(x) ((x) >> 3)
24 1.9 chs #define __FPR(x) ((x) >> 4)
25 1.9 chs
26 1.9 chs #define FP_X_IMP __FPE(FE_INEXACT) /* imprecise (loss of precision) */
27 1.9 chs #define FP_X_DZ __FPE(FE_DIVBYZERO) /* divide-by-zero exception */
28 1.9 chs #define FP_X_UFL __FPE(FE_UNDERFLOW) /* underflow exception */
29 1.9 chs #define FP_X_OFL __FPE(FE_OVERFLOW) /* overflow exception */
30 1.9 chs #define FP_X_INV __FPE(FE_INVALID) /* invalid operation exception */
31 1.1 mycroft
32 1.1 mycroft typedef enum {
33 1.9 chs FP_RN=__FPR(FE_TONEAREST), /* round to nearest representable number */
34 1.9 chs FP_RZ=__FPR(FE_TOWARDZERO), /* round to zero (truncate) */
35 1.9 chs FP_RM=__FPR(FE_DOWNWARD), /* round toward negative infinity */
36 1.9 chs FP_RP=__FPR(FE_UPWARD) /* round toward positive infinity */
37 1.1 mycroft } fp_rnd;
38 1.1 mycroft
39 1.4 thorpej typedef enum {
40 1.4 thorpej FP_PE=0, /* extended-precision (64-bit) */
41 1.4 thorpej FP_PS=1, /* single-precision (24-bit) */
42 1.4 thorpej FP_PD=2 /* double-precision (53-bit) */
43 1.4 thorpej } fp_prec;
44 1.4 thorpej
45 1.8 christos #endif /* !_ISOC99_SOURCE */
46 1.6 matt
47 1.4 thorpej #define __HAVE_FP_PREC
48 1.4 thorpej
49 1.6 matt #endif /* _NETBSD_SOURCE || _ISOC99_SOURCE */
50 1.6 matt
51 1.1 mycroft #endif /* _M68K_IEEEFP_H_ */
52