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