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