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