xref: /netbsd-src/sys/arch/or1k/include/ieeefp.h (revision 27620987b8618edefe3919667fcfb2a0eb02578b)
1*27620987Smatt /*	$NetBSD: ieeefp.h,v 1.1 2014/09/03 19:34:26 matt Exp $	*/
2*27620987Smatt 
3*27620987Smatt /*
4*27620987Smatt  * Based on ieeefp.h written by J.T. Conklin, Apr 28, 1995
5*27620987Smatt  * Public domain.
6*27620987Smatt  */
7*27620987Smatt 
8*27620987Smatt #ifndef _OR1K_IEEEFP_H_
9*27620987Smatt #define _OR1K_IEEEFP_H_
10*27620987Smatt 
11*27620987Smatt #include <sys/featuretest.h>
12*27620987Smatt 
13*27620987Smatt #if defined(_NETBSD_SOURCE) || defined(_ISOC99_SOURCE)
14*27620987Smatt 
15*27620987Smatt #include <or1k/fenv.h>
16*27620987Smatt 
17*27620987Smatt #if !defined(_ISOC99_SOURCE)
18*27620987Smatt 
19*27620987Smatt /* Exception type (used by fpsetmask() et al.) */
20*27620987Smatt 
21*27620987Smatt typedef int fp_except;
22*27620987Smatt 
23*27620987Smatt /* Bit defines for fp_except */
24*27620987Smatt 
25*27620987Smatt #define	FP_X_INV	FE_INVALID	/* invalid operation exception */
26*27620987Smatt #define	FP_X_DZ		FE_DIVBYZERO	/* divide-by-zero exception */
27*27620987Smatt #define	FP_X_OFL	FE_OVERFLOW	/* overflow exception */
28*27620987Smatt #define	FP_X_UFL	FE_UNDERFLOW	/* underflow exception */
29*27620987Smatt #define	FP_X_IMP	FE_INEXACT	/* imprecise (prec. loss; "inexact") */
30*27620987Smatt 
31*27620987Smatt /* Rounding modes */
32*27620987Smatt 
33*27620987Smatt typedef enum {
34*27620987Smatt     FP_RN=FE_TONEAREST,		/* round to nearest representable number */
35*27620987Smatt     FP_RP=FE_UPWARD,		/* round toward positive infinity */
36*27620987Smatt     FP_RM=FE_DOWNWARD,		/* round toward negative infinity */
37*27620987Smatt     FP_RZ=FE_TOWARDZERO		/* round to zero (truncate) */
38*27620987Smatt } fp_rnd;
39*27620987Smatt 
40*27620987Smatt #endif /* !_ISOC99_SOURCE */
41*27620987Smatt 
42*27620987Smatt #endif /* _NETBSD_SOURCE || _ISOC99_SOURCE */
43*27620987Smatt 
44*27620987Smatt #endif /* _OR1K_IEEEFP_H_ */
45