1/* $NetBSD: fenv.h,v 1.5 2024/05/12 20:04:12 riastradh 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 ((int)__BIT(0)) /* Result inexact */
15#define FE_UNDERFLOW ((int)__BIT(1)) /* Result underflowed */
16#define FE_OVERFLOW ((int)__BIT(2)) /* Result overflowed */
17#define FE_DIVBYZERO ((int)__BIT(3)) /* divide-by-zero */
18#define FE_INVALID ((int)__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_ */