2021-04-09 08:06:57 +00:00
|
|
|
#ifndef COSMOPOLITAN_LIBC_RUNTIME_FENV_H_
|
|
|
|
#define COSMOPOLITAN_LIBC_RUNTIME_FENV_H_
|
|
|
|
|
2023-05-02 02:43:59 +00:00
|
|
|
#ifdef __x86_64__
|
2021-04-09 08:06:57 +00:00
|
|
|
#define FE_INVALID 1
|
2022-10-11 00:52:41 +00:00
|
|
|
#define __FE_DENORM 2
|
2021-04-09 08:06:57 +00:00
|
|
|
#define FE_DIVBYZERO 4
|
|
|
|
#define FE_OVERFLOW 8
|
|
|
|
#define FE_UNDERFLOW 16
|
|
|
|
#define FE_INEXACT 32
|
2022-10-11 00:52:41 +00:00
|
|
|
#define FE_ALL_EXCEPT 63
|
2023-05-02 02:43:59 +00:00
|
|
|
#define FE_TONEAREST 0x0000
|
|
|
|
#define FE_DOWNWARD 0x0400
|
|
|
|
#define FE_UPWARD 0x0800
|
|
|
|
#define FE_TOWARDZERO 0x0c00
|
|
|
|
#elif defined(__aarch64__)
|
|
|
|
#define FE_INVALID 1
|
|
|
|
#define FE_DIVBYZERO 2
|
|
|
|
#define FE_OVERFLOW 4
|
|
|
|
#define FE_UNDERFLOW 8
|
|
|
|
#define FE_INEXACT 16
|
|
|
|
#define FE_ALL_EXCEPT 31
|
|
|
|
#define FE_TONEAREST 0
|
|
|
|
#define FE_DOWNWARD 0x800000
|
|
|
|
#define FE_UPWARD 0x400000
|
|
|
|
#define FE_TOWARDZERO 0xc00000
|
|
|
|
#endif
|
2022-10-11 00:52:41 +00:00
|
|
|
|
|
|
|
#ifdef __FLT_EVAL_METHOD__
|
|
|
|
#define FLT_EVAL_METHOD __FLT_EVAL_METHOD__
|
|
|
|
#else
|
|
|
|
#define FLT_EVAL_METHOD 0
|
|
|
|
#endif
|
2021-04-09 08:06:57 +00:00
|
|
|
|
|
|
|
#if !(__ASSEMBLER__ + __LINKER__ + 0)
|
|
|
|
COSMOPOLITAN_C_START_
|
|
|
|
|
|
|
|
#define FLT_ROUNDS (__flt_rounds())
|
2022-10-11 00:52:41 +00:00
|
|
|
#define FE_DFL_ENV ((const fenv_t *)-1)
|
2021-04-09 08:06:57 +00:00
|
|
|
|
|
|
|
typedef void *fenv_t;
|
|
|
|
typedef uint16_t fexcept_t;
|
|
|
|
|
|
|
|
int feclearexcept(int);
|
|
|
|
int fegetenv(fenv_t *);
|
|
|
|
int fegetexceptflag(fexcept_t *, int);
|
|
|
|
int fegetround(void);
|
|
|
|
int feholdexcept(fenv_t *);
|
|
|
|
int feraiseexcept(int);
|
|
|
|
int fesetenv(const fenv_t *);
|
|
|
|
int fesetexceptflag(const fexcept_t *, int);
|
|
|
|
int fesetround(int);
|
|
|
|
int fetestexcept(int);
|
|
|
|
int feupdateenv(const fenv_t *);
|
|
|
|
int __flt_rounds(void);
|
|
|
|
|
|
|
|
COSMOPOLITAN_C_END_
|
|
|
|
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
|
|
|
|
#endif /* COSMOPOLITAN_LIBC_RUNTIME_FENV_H_ */
|