16fc729afSOlivier Houchard /* $NetBSD: ieeefp.h,v 1.1 2001/01/10 19:02:06 bjh21 Exp $ */ 2d8315c79SWarner Losh /*- 36fc729afSOlivier Houchard * Based on ieeefp.h written by J.T. Conklin, Apr 28, 1995 46fc729afSOlivier Houchard * Public domain. 56fc729afSOlivier Houchard */ 66fc729afSOlivier Houchard 76fc729afSOlivier Houchard #ifndef _MACHINE_IEEEFP_H_ 86fc729afSOlivier Houchard #define _MACHINE_IEEEFP_H_ 96fc729afSOlivier Houchard 10*a50079b7SDavid Schultz /* Deprecated historical FPU control interface */ 11*a50079b7SDavid Schultz 126fc729afSOlivier Houchard /* FP exception codes */ 136fc729afSOlivier Houchard #define FP_EXCEPT_INV 0 146fc729afSOlivier Houchard #define FP_EXCEPT_DZ 1 156fc729afSOlivier Houchard #define FP_EXCEPT_OFL 2 166fc729afSOlivier Houchard #define FP_EXCEPT_UFL 3 176fc729afSOlivier Houchard #define FP_EXCEPT_IMP 4 186fc729afSOlivier Houchard 196fc729afSOlivier Houchard /* Exception type (used by fpsetmask() et al.) */ 206fc729afSOlivier Houchard 216fc729afSOlivier Houchard typedef int fp_except; 226fc729afSOlivier Houchard 236fc729afSOlivier Houchard /* Bit defines for fp_except */ 246fc729afSOlivier Houchard 256fc729afSOlivier Houchard #define FP_X_INV (1 << FP_EXCEPT_INV) /* invalid operation exception */ 266fc729afSOlivier Houchard #define FP_X_DZ (1 << FP_EXCEPT_DZ) /* divide-by-zero exception */ 276fc729afSOlivier Houchard #define FP_X_OFL (1 << FP_EXCEPT_OFL) /* overflow exception */ 286fc729afSOlivier Houchard #define FP_X_UFL (1 << FP_EXCEPT_UFL) /* underflow exception */ 296fc729afSOlivier Houchard #define FP_X_IMP (1 << FP_EXCEPT_IMP) /* imprecise (loss of precision; "inexact") */ 306fc729afSOlivier Houchard 316fc729afSOlivier Houchard /* Rounding modes */ 326fc729afSOlivier Houchard 336fc729afSOlivier Houchard typedef enum { 346fc729afSOlivier Houchard FP_RN=0, /* round to nearest representable number */ 356fc729afSOlivier Houchard FP_RP=1, /* round toward positive infinity */ 366fc729afSOlivier Houchard FP_RM=2, /* round toward negative infinity */ 376fc729afSOlivier Houchard FP_RZ=3 /* round to zero (truncate) */ 386fc729afSOlivier Houchard } fp_rnd_t; 396fc729afSOlivier Houchard 406fc729afSOlivier Houchard /* 416fc729afSOlivier Houchard * FP precision modes 426fc729afSOlivier Houchard */ 436fc729afSOlivier Houchard typedef enum { 446fc729afSOlivier Houchard FP_PS=0, /* 24 bit (single-precision) */ 456fc729afSOlivier Houchard FP_PRS, /* reserved */ 466fc729afSOlivier Houchard FP_PD, /* 53 bit (double-precision) */ 476fc729afSOlivier Houchard FP_PE /* 64 bit (extended-precision) */ 486fc729afSOlivier Houchard } fp_prec_t; 496fc729afSOlivier Houchard 506fc729afSOlivier Houchard #define fp_except_t int 516fc729afSOlivier Houchard 526fc729afSOlivier Houchard #endif /* _MACHINE_IEEEFP_H_ */ 53