Home | History | Annotate | Line # | Download | only in include
ieeefp.h revision 1.2
      1  1.2   matt /*	$NetBSD: ieeefp.h,v 1.2 2008/08/05 16:47:41 matt Exp $	*/
      2  1.1  bjh21 
      3  1.1  bjh21 /*
      4  1.1  bjh21  * Based on ieeefp.h written by J.T. Conklin, Apr 28, 1995
      5  1.1  bjh21  * Public domain.
      6  1.1  bjh21  */
      7  1.1  bjh21 
      8  1.1  bjh21 #ifndef _ARM32_IEEEFP_H_
      9  1.1  bjh21 #define _ARM32_IEEEFP_H_
     10  1.1  bjh21 
     11  1.2   matt #include <sys/featuretest.h>
     12  1.1  bjh21 
     13  1.2   matt #if defined(_NETBSD_SOURCE) || defined(_ISOC99_SOURCE)
     14  1.2   matt 
     15  1.2   matt typedef int fenv_t;
     16  1.2   matt typedef int fexcept_t;
     17  1.2   matt 
     18  1.2   matt #define	FE_INVALID	0x01	/* invalid operation exception */
     19  1.2   matt #define	FE_DIVBYZERO	0x02	/* divide-by-zero exception */
     20  1.2   matt #define	FE_OVERFLOW	0x04	/* overflow exception */
     21  1.2   matt #define	FE_UNDERFLOW	0x08	/* underflow exception */
     22  1.2   matt #define	FE_INEXACT	0x10	/* imprecise (loss of precision; "inexact") */
     23  1.2   matt 
     24  1.2   matt #define	FE_ALL_EXCEPT	0x1f
     25  1.2   matt 
     26  1.2   matt #define	FE_TONEAREST	0	/* round to nearest representable number */
     27  1.2   matt #define	FE_UPWARD	1	/* round toward positive infinity */
     28  1.2   matt #define	FE_DOWNWARD	2	/* round toward negative infinity */
     29  1.2   matt #define	FE_TOWARDZERO	3	/* round to zero (truncate) */
     30  1.2   matt 
     31  1.2   matt #if !defined(_ISOC99_SOURCE)
     32  1.1  bjh21 
     33  1.1  bjh21 /* Exception type (used by fpsetmask() et al.) */
     34  1.1  bjh21 
     35  1.1  bjh21 typedef int fp_except;
     36  1.1  bjh21 
     37  1.1  bjh21 /* Bit defines for fp_except */
     38  1.1  bjh21 
     39  1.2   matt #define	FP_X_INV	FE_INVALID	/* invalid operation exception */
     40  1.2   matt #define	FP_X_DZ		FE_DIVBYZERO	/* divide-by-zero exception */
     41  1.2   matt #define	FP_X_OFL	FE_OVERFLOW	/* overflow exception */
     42  1.2   matt #define	FP_X_UFL	FE_UNDERFLOW	/* underflow exception */
     43  1.2   matt #define	FP_X_IMP	FE_INEXACT	/* imprecise (prec. loss; "inexact") */
     44  1.1  bjh21 
     45  1.1  bjh21 /* Rounding modes */
     46  1.1  bjh21 
     47  1.1  bjh21 typedef enum {
     48  1.2   matt     FP_RN=FE_TONEAREST,		/* round to nearest representable number */
     49  1.2   matt     FP_RP=FE_UPWARD,		/* round toward positive infinity */
     50  1.2   matt     FP_RM=FE_DOWNWARD,		/* round toward negative infinity */
     51  1.2   matt     FP_RZ=FE_TOWARDZERO		/* round to zero (truncate) */
     52  1.1  bjh21 } fp_rnd;
     53  1.1  bjh21 
     54  1.2   matt #endif /* !_ISOC99_SOURCE */
     55  1.2   matt 
     56  1.2   matt #endif /* _NETBSD_SOURCE || _ISOC99_SOURCE */
     57  1.2   matt 
     58  1.1  bjh21 #endif /* _ARM32_IEEEFP_H_ */
     59