1 1.3.58.2 skrll /* $NetBSD: ieeefp.h,v 1.3.58.2 2017/08/28 17:51:49 skrll Exp $ */ 2 1.1 thorpej 3 1.1 thorpej /* 4 1.1 thorpej * Written by J.T. Conklin, Apr 6, 1995 5 1.1 thorpej * Public domain. 6 1.1 thorpej */ 7 1.1 thorpej 8 1.1 thorpej #ifndef _POWERPC_IEEEFP_H_ 9 1.1 thorpej #define _POWERPC_IEEEFP_H_ 10 1.1 thorpej 11 1.3 matt #include <sys/featuretest.h> 12 1.3 matt 13 1.3 matt #if defined(_NETBSD_SOURCE) || defined(_ISOC99_SOURCE) 14 1.3 matt 15 1.3.58.1 skrll #include <powerpc/fenv.h> 16 1.3 matt 17 1.3 matt #if !defined(_ISOC99_SOURCE) 18 1.3 matt 19 1.1 thorpej typedef int fp_except; 20 1.3.58.2 skrll 21 1.3.58.2 skrll /* adjust for FP_* and FE_* value differences */ 22 1.3.58.2 skrll #define __FPE(x) ((x) >> 25) 23 1.3.58.2 skrll #define __FEE(x) ((x) << 25) 24 1.3.58.2 skrll #define __FPR(x) ((x)) 25 1.3.58.2 skrll #define __FER(x) ((x)) 26 1.3.58.2 skrll 27 1.3.58.2 skrll #define FP_X_IMP __FPE(FE_INEXACT) /* imprecise (loss of precision) */ 28 1.3.58.2 skrll #define FP_X_DZ __FPE(FE_DIVBYZERO) /* divide-by-zero exception */ 29 1.3.58.2 skrll #define FP_X_UFL __FPE(FE_UNDERFLOW) /* underflow exception */ 30 1.3.58.2 skrll #define FP_X_OFL __FPE(FE_OVERFLOW) /* overflow exception */ 31 1.3.58.2 skrll #define FP_X_INV __FPE(FE_INVALID) /* invalid operation exception */ 32 1.1 thorpej 33 1.1 thorpej typedef enum { 34 1.3.58.2 skrll FP_RN=__FPR(FE_TONEAREST), /* round to nearest representable number */ 35 1.3.58.2 skrll FP_RZ=__FPR(FE_TOWARDZERO), /* round to zero (truncate) */ 36 1.3.58.2 skrll FP_RP=__FPR(FE_UPWARD), /* round toward positive infinity */ 37 1.3.58.2 skrll FP_RM=__FPR(FE_DOWNWARD) /* round toward negative infinity */ 38 1.1 thorpej } fp_rnd; 39 1.1 thorpej 40 1.3 matt #endif /* !_ISOC99_SOURCE */ 41 1.3 matt 42 1.3 matt #endif /* _NETBSD_SOURCE || _ISOC99_SOURCE */ 43 1.3 matt 44 1.1 thorpej #endif /* _POWERPC_IEEEFP_H_ */ 45