/* Floating point environment. wasm32-hwjs version.
Copyright (C) 2026 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
. */
#ifndef _FENV_H
# error "Never use directly; include instead."
#endif
/* WebAssembly has IEEE-754 f32/f64 arithmetic but exposes NO floating-point
environment at the ISA level: rounding is fixed to round-to-nearest-even
and there are no accessible exception flags or traps (the same model the
musl wasm32 port documents). We therefore define no exception macros
(FE_INVALID, ...): FE_ALL_EXCEPT is 0, which makes turn
feraiseexcept and friends into argument-ignoring no-ops, and we expose only
the default rounding mode. This matches the build flags (sysdeps/wasm32/
Makefile drops -frounding-math/-ftrapping-math): there is no rounding or
trap state for libm to depend on. */
/* No exceptions are supported. */
#define FE_ALL_EXCEPT 0
/* Only the default rounding mode (round to nearest, ties to even) exists.
glibc requires FE_TONEAREST to be defined even when rounding cannot be
changed; not defining FE_DOWNWARD/FE_UPWARD/FE_TOWARDZERO makes
set FE_HAVE_ROUNDING_MODES to 0. */
#define FE_TONEAREST 0
/* Type representing exception flags. */
typedef unsigned int fexcept_t;
/* Type representing floating-point environment. */
typedef struct
{
fexcept_t __excepts;
}
fenv_t;
/* If the default argument is used we use this value. */
#define FE_DFL_ENV ((const fenv_t *) -1l)
#if __GLIBC_USE (IEC_60559_BFP_EXT_C23)
/* Type representing floating-point control modes. */
typedef unsigned int femode_t;
/* Default floating-point control modes. */
# define FE_DFL_MODE ((const femode_t *) -1L)
#endif