Home | History | Annotate | Line # | Download | only in include
ieeefp.h revision 1.9
      1 /*	$NetBSD: ieeefp.h,v 1.9 2017/02/27 06:47:58 chs Exp $	*/
      2 
      3 /*
      4  * Written by J.T. Conklin, Apr 6, 1995
      5  * Modified by Jason R. Thorpe, June 22, 2003
      6  * Public domain.
      7  */
      8 
      9 #ifndef _M68K_IEEEFP_H_
     10 #define _M68K_IEEEFP_H_
     11 
     12 #include <sys/featuretest.h>
     13 
     14 #if defined(_NETBSD_SOURCE) || defined(_ISOC99_SOURCE)
     15 
     16 #include <m68k/fenv.h>
     17 
     18 #if !defined(_ISOC99_SOURCE)
     19 
     20 typedef int fp_except;
     21 
     22 /* adjust for FP_* and FE_* value differences */
     23 #define	__FPE(x) ((x) >> 3)
     24 #define	__FPR(x) ((x) >> 4)
     25 
     26 #define FP_X_IMP	__FPE(FE_INEXACT)	/* imprecise (loss of precision) */
     27 #define FP_X_DZ		__FPE(FE_DIVBYZERO)	/* divide-by-zero exception */
     28 #define FP_X_UFL	__FPE(FE_UNDERFLOW)	/* underflow exception */
     29 #define FP_X_OFL	__FPE(FE_OVERFLOW)	/* overflow exception */
     30 #define FP_X_INV	__FPE(FE_INVALID)	/* invalid operation exception */
     31 
     32 typedef enum {
     33     FP_RN=__FPR(FE_TONEAREST),	/* round to nearest representable number */
     34     FP_RZ=__FPR(FE_TOWARDZERO),	/* round to zero (truncate) */
     35     FP_RM=__FPR(FE_DOWNWARD),	/* round toward negative infinity */
     36     FP_RP=__FPR(FE_UPWARD)	/* round toward positive infinity */
     37 } fp_rnd;
     38 
     39 typedef enum {
     40     FP_PE=0,			/* extended-precision (64-bit) */
     41     FP_PS=1,			/* single-precision (24-bit) */
     42     FP_PD=2			/* double-precision (53-bit) */
     43 } fp_prec;
     44 
     45 #endif /* !_ISOC99_SOURCE */
     46 
     47 #define	__HAVE_FP_PREC
     48 
     49 #endif	/* _NETBSD_SOURCE || _ISOC99_SOURCE */
     50 
     51 #endif /* _M68K_IEEEFP_H_ */
     52