1 1.4.122.1 mjf /* $NetBSD: ieeefp.h,v 1.4.122.1 2008/09/28 10:40:08 mjf Exp $ */ 2 1.3 perry 3 1.2 pk /* 4 1.1 jtc * Written by J.T. Conklin, Apr 6, 1995 5 1.1 jtc * Public domain. 6 1.1 jtc */ 7 1.1 jtc 8 1.1 jtc #ifndef _SPARC_IEEEFP_H_ 9 1.1 jtc #define _SPARC_IEEEFP_H_ 10 1.1 jtc 11 1.4.122.1 mjf #include <sys/featuretest.h> 12 1.4.122.1 mjf 13 1.4.122.1 mjf #if defined(_NETBSD_SOURCE) || defined(_ISOC99_SOURCE) 14 1.4.122.1 mjf 15 1.4.122.1 mjf typedef int fenv_t; 16 1.4.122.1 mjf typedef int fexcept_t; 17 1.4.122.1 mjf 18 1.4.122.1 mjf #define FE_INEXACT 0x01 /* imprecise (loss of precision) */ 19 1.4.122.1 mjf #define FE_DIVBYZERO 0x02 /* divide-by-zero exception */ 20 1.4.122.1 mjf #define FE_UNDERFLOW 0x04 /* overflow exception */ 21 1.4.122.1 mjf #define FE_OVERFLOW 0x08 /* underflow exception */ 22 1.4.122.1 mjf #define FE_INVALID 0x10 /* invalid operation exception */ 23 1.4.122.1 mjf 24 1.4.122.1 mjf #define FE_ALL_EXCEPT 0x1f 25 1.4.122.1 mjf 26 1.4.122.1 mjf #define FE_TONEAREST 0 /* round to nearest representable number */ 27 1.4.122.1 mjf #define FE_TOWARDZERO 1 /* round to zero (truncate) */ 28 1.4.122.1 mjf #define FE_UPWARD 2 /* round toward positive infinity */ 29 1.4.122.1 mjf #define FE_DOWNWARD 3 /* round toward negative infinity */ 30 1.4.122.1 mjf 31 1.4.122.1 mjf #if !defined(_ISOC99_SOURCE) 32 1.4.122.1 mjf 33 1.1 jtc typedef int fp_except; 34 1.4.122.1 mjf #define FP_X_IMP FE_INEXACT /* imprecise (loss of precision) */ 35 1.4.122.1 mjf #define FP_X_DZ FE_DIVBYZERO /* divide-by-zero exception */ 36 1.4.122.1 mjf #define FP_X_UFL FE_UNDERFLOW /* underflow exception */ 37 1.4.122.1 mjf #define FP_X_OFL FE_OVERFLOW /* overflow exception */ 38 1.4.122.1 mjf #define FP_X_INV FE_INVALID /* invalid operation exception */ 39 1.1 jtc 40 1.1 jtc typedef enum { 41 1.4.122.1 mjf FP_RN=FE_TONEAREST, /* round to nearest representable number */ 42 1.4.122.1 mjf FP_RZ=FE_TOWARDZERO, /* round to zero (truncate) */ 43 1.4.122.1 mjf FP_RP=FE_UPWARD, /* round toward positive infinity */ 44 1.4.122.1 mjf FP_RM=FE_DOWNWARD /* round toward negative infinity */ 45 1.1 jtc } fp_rnd; 46 1.1 jtc 47 1.4.122.1 mjf #endif /* !_ISOC99_SOURCE */ 48 1.4.122.1 mjf 49 1.4.122.1 mjf #endif /* _NETBSD_SOURCE || _ISOC99_SOURCE */ 50 1.4.122.1 mjf 51 1.1 jtc #endif /* _SPARC_IEEEFP_H_ */ 52