| 1 | /*	$NetBSD: ieeefp.h,v 1.5 2021/10/06 05:33:15 skrll Exp $	*/ |
| 2 | |
| 3 | /* |
| 4 | * Based on ieeefp.h written by J.T. Conklin, Apr 28, 1995 |
| 5 | * Public domain. |
| 6 | */ |
| 7 | |
| 8 | #ifndef _ARM_IEEEFP_H_ |
| 9 | #define _ARM_IEEEFP_H_ |
| 10 | |
| 11 | #include <sys/featuretest.h> |
| 12 | |
| 13 | #if defined(_NETBSD_SOURCE) || defined(_ISOC99_SOURCE) |
| 14 | |
| 15 | #include <arm/fenv.h> |
| 16 | |
| 17 | #if !defined(_ISOC99_SOURCE) |
| 18 | |
| 19 | /* Exception type (used by fpsetmask() et al.) */ |
| 20 | |
| 21 | typedef int fp_except; |
| 22 | |
| 23 | /* adjust for FP_* and FE_* value differences */ |
| 24 | #define	__FPE(x) (x) |
| 25 | #define	__FEE(x) (x) |
| 26 | #define	__FPR(x) (x) |
| 27 | #define	__FER(x) (x) |
| 28 | |
| 29 | /* Bit defines for fp_except */ |
| 30 | |
| 31 | #define	FP_X_INV	FE_INVALID	/* invalid operation exception */ |
| 32 | #define	FP_X_DZ		FE_DIVBYZERO	/* divide-by-zero exception */ |
| 33 | #define	FP_X_OFL	FE_OVERFLOW	/* overflow exception */ |
| 34 | #define	FP_X_UFL	FE_UNDERFLOW	/* underflow exception */ |
| 35 | #define	FP_X_IMP	FE_INEXACT	/* imprecise (prec. loss; "inexact") */ |
| 36 | |
| 37 | /* Rounding modes */ |
| 38 | |
| 39 | typedef enum { |
| 40 | FP_RN=FE_TONEAREST,		/* round to nearest representable number */ |
| 41 | FP_RP=FE_UPWARD,		/* round toward positive infinity */ |
| 42 | FP_RM=FE_DOWNWARD,		/* round toward negative infinity */ |
| 43 | FP_RZ=FE_TOWARDZERO		/* round to zero (truncate) */ |
| 44 | } fp_rnd; |
| 45 | |
| 46 | #endif /* !_ISOC99_SOURCE */ |
| 47 | |
| 48 | #endif /* _NETBSD_SOURCE || _ISOC99_SOURCE */ |
| 49 | |
| 50 | #endif /* _ARM_IEEEFP_H_ */ |