xref: /netbsd-src/sys/arch/riscv/include/fenv.h (revision 82d56013d7b633d116a93943de88e08335357a7c)
1 /*	$NetBSD: fenv.h,v 1.3 2020/03/14 16:12:16 skrll Exp $	*/
2 
3 /*
4  * Based on ieeefp.h written by J.T. Conklin, Apr 28, 1995
5  * Public domain.
6  */
7 
8 #ifndef _RISCV_FENV_H_
9 #define _RISCV_FENV_H_
10 
11 typedef int fenv_t;		/* FPSCR */
12 typedef int fexcept_t;
13 
14 #define	FE_INEXACT	0x00	/* Result inexact */
15 #define	FE_UNDERFLOW	0x02	/* Result underflowed */
16 #define	FE_OVERFLOW	0x04	/* Result overflowed */
17 #define	FE_DIVBYZERO	0x08	/* divide-by-zero */
18 #define	FE_INVALID	0x10	/* Result invalid */
19 
20 #define	FE_ALL_EXCEPT	0x1f
21 
22 #define	FE_TONEAREST	0	/* round to nearest representable number */
23 #define	FE_TOWARDZERO	1	/* round to zero (truncate) */
24 #define	FE_DOWNWARD	2	/* round toward negative infinity */
25 #define	FE_UPWARD	3	/* round toward positive infinity */
26 
27 __BEGIN_DECLS
28 
29 /* Default floating-point environment */
30 extern const fenv_t	__fe_dfl_env;
31 #define FE_DFL_ENV	(&__fe_dfl_env)
32 
33 __END_DECLS
34 
35 #endif /* _RISCV_FENV_H_ */
36