xref: /netbsd-src/sys/arch/arm/include/fenv.h (revision b7b7574d3bf8eeb51a1fa3977b59142ec6434a55)
1 /*	$NetBSD: fenv.h,v 1.2 2014/01/29 00:22:09 matt Exp $	*/
2 
3 /*
4  * Based on ieeefp.h written by J.T. Conklin, Apr 28, 1995
5  * Public domain.
6  */
7 
8 #ifndef _ARM_FENV_H_
9 #define _ARM_FENV_H_
10 
11 #ifdef __ARM_PCS_AAPCS64
12 /* AArch64 split FPSCR into two registers FPCR and FPSR */
13 typedef struct {
14 	unsigned int __fpcr;
15 	unsigned int __fpsr;
16 } fenv_t;
17 #else
18 typedef int fenv_t;		/* FPSCR */
19 #endif
20 typedef int fexcept_t;
21 
22 #define	FE_INVALID	0x01	/* invalid operation exception */
23 #define	FE_DIVBYZERO	0x02	/* divide-by-zero exception */
24 #define	FE_OVERFLOW	0x04	/* overflow exception */
25 #define	FE_UNDERFLOW	0x08	/* underflow exception */
26 #define	FE_INEXACT	0x10	/* imprecise (loss of precision; "inexact") */
27 
28 #define	FE_ALL_EXCEPT	0x1f
29 
30 #define	FE_TONEAREST	0	/* round to nearest representable number */
31 #define	FE_UPWARD	1	/* round toward positive infinity */
32 #define	FE_DOWNWARD	2	/* round toward negative infinity */
33 #define	FE_TOWARDZERO	3	/* round to zero (truncate) */
34 
35 __BEGIN_DECLS
36 
37 /* Default floating-point environment */
38 extern const fenv_t	__fe_dfl_env;
39 #define FE_DFL_ENV	(&__fe_dfl_env)
40 
41 __END_DECLS
42 
43 #endif /* _ARM_FENV_H_ */
44