59 lines
1.7 KiB
C
59 lines
1.7 KiB
C
|
/* $NetBSD: ieeefp.h,v 1.2 2008/08/05 16:47:41 matt Exp $ */
|
||
|
|
||
|
/*
|
||
|
* Based on ieeefp.h written by J.T. Conklin, Apr 28, 1995
|
||
|
* Public domain.
|
||
|
*/
|
||
|
|
||
|
#ifndef _ARM32_IEEEFP_H_
|
||
|
#define _ARM32_IEEEFP_H_
|
||
|
|
||
|
#include <sys/featuretest.h>
|
||
|
|
||
|
#if defined(_NETBSD_SOURCE) || defined(_ISOC99_SOURCE)
|
||
|
|
||
|
typedef int fenv_t;
|
||
|
typedef int fexcept_t;
|
||
|
|
||
|
#define FE_INVALID 0x01 /* invalid operation exception */
|
||
|
#define FE_DIVBYZERO 0x02 /* divide-by-zero exception */
|
||
|
#define FE_OVERFLOW 0x04 /* overflow exception */
|
||
|
#define FE_UNDERFLOW 0x08 /* underflow exception */
|
||
|
#define FE_INEXACT 0x10 /* imprecise (loss of precision; "inexact") */
|
||
|
|
||
|
#define FE_ALL_EXCEPT 0x1f
|
||
|
|
||
|
#define FE_TONEAREST 0 /* round to nearest representable number */
|
||
|
#define FE_UPWARD 1 /* round toward positive infinity */
|
||
|
#define FE_DOWNWARD 2 /* round toward negative infinity */
|
||
|
#define FE_TOWARDZERO 3 /* round to zero (truncate) */
|
||
|
|
||
|
#if !defined(_ISOC99_SOURCE)
|
||
|
|
||
|
/* Exception type (used by fpsetmask() et al.) */
|
||
|
|
||
|
typedef int fp_except;
|
||
|
|
||
|
/* Bit defines for fp_except */
|
||
|
|
||
|
#define FP_X_INV FE_INVALID /* invalid operation exception */
|
||
|
#define FP_X_DZ FE_DIVBYZERO /* divide-by-zero exception */
|
||
|
#define FP_X_OFL FE_OVERFLOW /* overflow exception */
|
||
|
#define FP_X_UFL FE_UNDERFLOW /* underflow exception */
|
||
|
#define FP_X_IMP FE_INEXACT /* imprecise (prec. loss; "inexact") */
|
||
|
|
||
|
/* Rounding modes */
|
||
|
|
||
|
typedef enum {
|
||
|
FP_RN=FE_TONEAREST, /* round to nearest representable number */
|
||
|
FP_RP=FE_UPWARD, /* round toward positive infinity */
|
||
|
FP_RM=FE_DOWNWARD, /* round toward negative infinity */
|
||
|
FP_RZ=FE_TOWARDZERO /* round to zero (truncate) */
|
||
|
} fp_rnd;
|
||
|
|
||
|
#endif /* !_ISOC99_SOURCE */
|
||
|
|
||
|
#endif /* _NETBSD_SOURCE || _ISOC99_SOURCE */
|
||
|
|
||
|
#endif /* _ARM32_IEEEFP_H_ */
|