Home | History | Annotate | Line # | Download | only in include
ieeefp.h revision 1.1
      1  1.1  martin /* $NetBSD: ieeefp.h,v 1.1 2012/12/26 19:43:10 martin Exp $ */
      2  1.1  martin 
      3  1.1  martin /*
      4  1.1  martin  * Written by J.T. Conklin, Apr 28, 1995
      5  1.1  martin  * Public domain.
      6  1.1  martin  */
      7  1.1  martin 
      8  1.1  martin #ifndef _IA64_IEEEFP_H_
      9  1.1  martin #define _IA64_IEEEFP_H_
     10  1.1  martin 
     11  1.1  martin #include <sys/featuretest.h>
     12  1.1  martin 
     13  1.1  martin #if defined(_NETBSD_SOURCE) || defined(_ISOC99_SOURCE)
     14  1.1  martin 
     15  1.1  martin typedef int fenv_t;
     16  1.1  martin typedef int fexcept_t;
     17  1.1  martin 
     18  1.1  martin #define	FE_INVALID	0x01	/* invalid operation exception */
     19  1.1  martin #define	FE_DIVBYZERO	0x02	/* divide-by-zero exception */
     20  1.1  martin #define	FE_OVERFLOW	0x04	/* overflow exception */
     21  1.1  martin #define	FE_UNDERFLOW	0x08	/* underflow exception */
     22  1.1  martin #define	FE_INEXACT	0x10	/* imprecise (loss of precision; "inexact") */
     23  1.1  martin #define	FE_IOVERFLOW	0x20    /* integer overflow */
     24  1.1  martin 
     25  1.1  martin #define	FE_ALL_EXCEPT	0x3f
     26  1.1  martin 
     27  1.1  martin /*
     28  1.1  martin  * These bits match the fpcr as well as bits 12:11
     29  1.1  martin  * in fp operate instructions
     30  1.1  martin  */
     31  1.1  martin #define	FE_TOWARDZERO	0	/* round to zero (truncate) */
     32  1.1  martin #define	FE_DOWNWARD	1	/* round toward negative infinity */
     33  1.1  martin #define	FE_TONEAREST	2	/* round to nearest representable number */
     34  1.1  martin #define	FE_UPWARD	3	/* round toward positive infinity */
     35  1.1  martin 
     36  1.1  martin #if !defined(_ISOC99_SOURCE)
     37  1.1  martin 
     38  1.1  martin typedef int fp_except;
     39  1.1  martin 
     40  1.1  martin #define	FP_X_INV	FE_INVALID	/* invalid operation exception */
     41  1.1  martin #define	FP_X_DZ		FE_DIVBYZERO	/* divide-by-zero exception */
     42  1.1  martin #define	FP_X_OFL	FE_OVERFLOW	/* overflow exception */
     43  1.1  martin #define	FP_X_UFL	FE_UNDERFLOW	/* underflow exception */
     44  1.1  martin #define	FP_X_IMP	FE_INEXACT	/* imprecise (prec. loss; "inexact") */
     45  1.1  martin #define	FP_X_IOV	FE_IOVERFLOW	/* integer overflow */
     46  1.1  martin 
     47  1.1  martin /*
     48  1.1  martin  * fp_rnd bits match the fpcr, below, as well as bits 12:11
     49  1.1  martin  * in fp operate instructions
     50  1.1  martin  */
     51  1.1  martin typedef enum {
     52  1.1  martin     FP_RZ = FE_TOWARDZERO,	/* round to zero (truncate) */
     53  1.1  martin     FP_RM = FE_DOWNWARD,	/* round toward negative infinity */
     54  1.1  martin     FP_RN = FE_TONEAREST,	/* round to nearest representable number */
     55  1.1  martin     FP_RP = FE_UPWARD,		/* round toward positive infinity */
     56  1.1  martin     _FP_DYNAMIC=FP_RP
     57  1.1  martin } fp_rnd;
     58  1.1  martin 
     59  1.1  martin #endif /* !_ISOC99_SOURCE */
     60  1.1  martin 
     61  1.1  martin #endif	/* _NETBSD_SOURCE || _ISOC99_SOURCE */
     62  1.1  martin 
     63  1.1  martin #endif /* _IA64_IEEEFP_H_ */
     64  1.1  martin 
     65  1.1  martin 
     66  1.1  martin 
     67  1.1  martin 
     68  1.1  martin 
     69  1.1  martin 
     70  1.1  martin 
     71  1.1  martin 
     72  1.1  martin 
     73  1.1  martin 
     74