1 1.1 jtc /* 2 1.1 jtc * Written by J.T. Conklin, Apr 6, 1995 3 1.1 jtc * Public domain. 4 1.1 jtc */ 5 1.1 jtc 6 1.1 jtc #ifndef _IEEEFP_H_ 7 1.1 jtc #define _IEEEFP_H_ 8 1.1 jtc 9 1.1 jtc #include <sys/cdefs.h> 10 1.1 jtc 11 1.1 jtc typedef int fp_except; 12 1.1 jtc #ifdef __i386__ 13 1.1 jtc #define FP_X_INV 0x01 /* invalid operation exception */ 14 1.1 jtc #define FP_X_DNML 0x02 /* denormalization exception */ 15 1.1 jtc #define FP_X_DZ 0x04 /* divide-by-zero exception */ 16 1.1 jtc #define FP_X_OFL 0x08 /* overflow exception */ 17 1.1 jtc #define FP_X_UFL 0x10 /* underflow exception */ 18 1.1 jtc #define FP_X_IMP 0x20 /* imprecise (loss of precision) */ 19 1.1 jtc #endif 20 1.1 jtc 21 1.1 jtc #if defined(__i386__) 22 1.1 jtc typedef enum { 23 1.1 jtc FP_RN=0, /* round to nearest representable number */ 24 1.1 jtc FP_RP=1, /* round to positive infinity */ 25 1.1 jtc FP_RM=2, /* round to negative infinity */ 26 1.1 jtc FP_RZ=3 /* round to zero (truncate) */ 27 1.1 jtc } fp_rnd ; 28 1.1 jtc 29 1.1 jtc #elif defined(__m68k__) 30 1.1 jtc typedef enum { 31 1.1 jtc FP_RN=0, /* round to nearest representable number */ 32 1.1 jtc FP_RZ=1, /* round to zero (truncate) */ 33 1.1 jtc FP_RM=2, /* round to negative infinity */ 34 1.1 jtc FP_RP=3 /* round to positive infinity */ 35 1.1 jtc } fp_rnd ; 36 1.1 jtc 37 1.1 jtc #endif 38 1.1 jtc 39 1.1 jtc extern fp_rnd fpgetround __P((void)); 40 1.1 jtc extern fp_rnd fpsetround __P((fp_rnd)); 41 1.1 jtc extern fp_except fpgetmask __P((void)); 42 1.1 jtc extern fp_except fpsetmask __P((fp_except)); 43 1.1 jtc extern fp_except fpgetsticky __P((void)); 44 1.1 jtc extern fp_except fpsetsticky __P((fp_except)); 45 1.1 jtc 46 1.1 jtc #endif /* _IEEEFP_H_ */ 47