1 /* $NetBSD: ieeefp.h,v 1.1 2001/01/10 19:02:06 bjh21 Exp $ */ 2 /*- 3 * Based on ieeefp.h written by J.T. Conklin, Apr 28, 1995 4 * Public domain. 5 */ 6 7 #ifndef _MACHINE_IEEEFP_H_ 8 #define _MACHINE_IEEEFP_H_ 9 10 #include <sys/cdefs.h> 11 12 /* Deprecated historical FPU control interface */ 13 14 /* FP exception codes */ 15 #define FP_EXCEPT_INV 0 16 #define FP_EXCEPT_DZ 1 17 #define FP_EXCEPT_OFL 2 18 #define FP_EXCEPT_UFL 3 19 #define FP_EXCEPT_IMP 4 20 21 /* Exception type (used by fpsetmask() et al.) */ 22 23 typedef int fp_except; 24 25 /* Bit defines for fp_except */ 26 27 #define FP_X_INV (1 << FP_EXCEPT_INV) /* invalid operation exception */ 28 #define FP_X_DZ (1 << FP_EXCEPT_DZ) /* divide-by-zero exception */ 29 #define FP_X_OFL (1 << FP_EXCEPT_OFL) /* overflow exception */ 30 #define FP_X_UFL (1 << FP_EXCEPT_UFL) /* underflow exception */ 31 #define FP_X_IMP (1 << FP_EXCEPT_IMP) /* imprecise (loss of precision; "inexact") */ 32 33 /* Rounding modes */ 34 35 typedef enum { 36 FP_RN=0, /* round to nearest representable number */ 37 FP_RP=1, /* round toward positive infinity */ 38 FP_RM=2, /* round toward negative infinity */ 39 FP_RZ=3 /* round to zero (truncate) */ 40 } fp_rnd_t; 41 42 /* 43 * FP precision modes 44 */ 45 typedef enum { 46 FP_PS=0, /* 24 bit (single-precision) */ 47 FP_PRS, /* reserved */ 48 FP_PD, /* 53 bit (double-precision) */ 49 FP_PE /* 64 bit (extended-precision) */ 50 } fp_prec_t; 51 52 #define fp_except_t int 53 54 /* Augment the userland declarations. */ 55 __BEGIN_DECLS 56 extern fp_rnd_t fpgetround(void); 57 extern fp_rnd_t fpsetround(fp_rnd_t); 58 extern fp_except_t fpgetmask(void); 59 extern fp_except_t fpsetmask(fp_except_t); 60 extern fp_except_t fpgetsticky(void); 61 extern fp_except_t fpsetsticky(fp_except_t); 62 __END_DECLS 63 64 #endif /* _MACHINE_IEEEFP_H_ */ 65