fenv.h revision 1.4
1/*	$NetBSD: fenv.h,v 1.4 2024/05/10 08:20:37 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
11typedef int fenv_t;		/* FPSCR */
12typedef int fexcept_t;
13
14#define	FE_INEXACT	__BIT(0)	/* Result inexact */
15#define	FE_UNDERFLOW	__BIT(1)	/* Result underflowed */
16#define	FE_OVERFLOW	__BIT(2)	/* Result overflowed */
17#define	FE_DIVBYZERO	__BIT(3)	/* divide-by-zero */
18#define	FE_INVALID	__BIT(4)	/* Result invalid */
19
20#define	FE_ALL_EXCEPT	\
21    (FE_INEXACT | FE_UNDERFLOW | FE_OVERFLOW | FE_DIVBYZERO | FE_INVALID)
22
23#define	FE_TONEAREST	0	/* round to nearest representable number */
24#define	FE_TOWARDZERO	1	/* round to zero (truncate) */
25#define	FE_DOWNWARD	2	/* round toward negative infinity */
26#define	FE_UPWARD	3	/* round toward positive infinity */
27
28__BEGIN_DECLS
29
30/* Default floating-point environment */
31extern const fenv_t	__fe_dfl_env;
32#define FE_DFL_ENV	(&__fe_dfl_env)
33
34__END_DECLS
35
36#endif /* _RISCV_FENV_H_ */
37