Home | History | Annotate | Line # | Download | only in include
ieeefp.h revision 1.8
      1  1.8  christos /*	$NetBSD: ieeefp.h,v 1.8 2012/03/20 23:57:57 christos 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.5      matt #include <sys/featuretest.h>
     12  1.5      matt 
     13  1.5      matt #if defined(_NETBSD_SOURCE) || defined(_ISOC99_SOURCE)
     14  1.5      matt 
     15  1.5      matt #define	FE_INEXACT	0x01	/* imprecise (loss of precision) */
     16  1.5      matt #define	FE_DIVBYZERO	0x02	/* divide-by-zero exception */
     17  1.5      matt #define	FE_UNDERFLOW	0x04	/* overflow exception */
     18  1.5      matt #define	FE_OVERFLOW	0x08	/* underflow exception */
     19  1.5      matt #define	FE_INVALID	0x10	/* invalid operation exception */
     20  1.5      matt 
     21  1.5      matt #define	FE_ALL_EXCEPT	0x1f
     22  1.5      matt 
     23  1.5      matt #define	FE_TONEAREST	0	/* round to nearest representable number */
     24  1.5      matt #define	FE_TOWARDZERO	1	/* round to zero (truncate) */
     25  1.5      matt #define	FE_UPWARD	2	/* round toward positive infinity */
     26  1.5      matt #define	FE_DOWNWARD	3	/* round toward negative infinity */
     27  1.5      matt 
     28  1.5      matt #if !defined(_ISOC99_SOURCE)
     29  1.5      matt 
     30  1.8  christos typedef unsigned int fp_except;
     31  1.5      matt #define FP_X_IMP	FE_INEXACT	/* imprecise (loss of precision) */
     32  1.5      matt #define FP_X_DZ		FE_DIVBYZERO	/* divide-by-zero exception */
     33  1.5      matt #define FP_X_UFL	FE_UNDERFLOW	/* underflow exception */
     34  1.5      matt #define FP_X_OFL	FE_OVERFLOW	/* overflow exception */
     35  1.5      matt #define FP_X_INV	FE_INVALID	/* invalid operation exception */
     36  1.1       jtc 
     37  1.1       jtc typedef enum {
     38  1.5      matt     FP_RN=FE_TONEAREST,		/* round to nearest representable number */
     39  1.5      matt     FP_RZ=FE_TOWARDZERO,	/* round to zero (truncate) */
     40  1.5      matt     FP_RP=FE_UPWARD,		/* round toward positive infinity */
     41  1.5      matt     FP_RM=FE_DOWNWARD		/* round toward negative infinity */
     42  1.1       jtc } fp_rnd;
     43  1.1       jtc 
     44  1.5      matt #endif /* !_ISOC99_SOURCE */
     45  1.5      matt 
     46  1.5      matt #endif /* _NETBSD_SOURCE || _ISOC99_SOURCE */
     47  1.5      matt 
     48  1.1       jtc #endif /* _SPARC_IEEEFP_H_ */
     49