1 /* Copyright (C) 2000-2024 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.
4 The GNU C Library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Lesser General Public
6 License as published by the Free Software Foundation; either
7 version 2.1 of the License, or (at your option) any later version.
9 The GNU C Library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Lesser General Public License for more details.
14 You should have received a copy of the GNU Lesser General Public
15 License along with the GNU C Library; if not, see
16 <https://www.gnu.org/licenses/>. */
19 # error "Never use <bits/fenv.h> directly; include <fenv.h> instead."
22 /* Define bits representing the exception. We use the bit positions
23 of the appropriate bits in the FPU control word. */
27 #define FE_INVALID 0x80
30 #define FE_DIVBYZERO 0x40
33 #define FE_OVERFLOW 0x20
36 #define FE_UNDERFLOW 0x10
39 #define FE_INEXACT 0x08
42 /* We dont use the y bit of the DXC in the floating point control register
43 as glibc has no FE encoding for fe inexact incremented
44 or fe inexact truncated.
45 We currently use the flag bits in the fpc
46 as these are sticky for feholdenv & feupdatenv as it is defined
47 in the HP Manpages. */
50 #define FE_ALL_EXCEPT \
51 (FE_INEXACT | FE_DIVBYZERO | FE_UNDERFLOW | FE_OVERFLOW | FE_INVALID)
56 #define FE_TONEAREST 0
59 #define FE_DOWNWARD 0x3
65 #define FE_TOWARDZERO 0x1
70 /* Type representing exception flags. */
71 typedef unsigned int fexcept_t
; /* size of fpc */
74 /* Type representing floating-point environment. This function corresponds
75 to the layout of the block used by fegetenv and fesetenv. */
80 /* The field __unused (formerly __ieee_instruction_pointer) is a relict from
81 commit "Remove PTRACE_PEEKUSER" (87b9b50f0d4b92248905e95a06a13c513dc45e59)
82 and isn't used anymore. */
85 /* If the default argument is used we use this value. */
86 #define FE_DFL_ENV ((const fenv_t *) -1)
89 /* Floating-point environment where none of the exceptions are masked. */
90 # define FE_NOMASK_ENV ((const fenv_t *) -2)
93 #if __GLIBC_USE (IEC_60559_BFP_EXT_C23)
94 /* Type representing floating-point control modes. */
95 typedef unsigned int femode_t
;
97 /* Default floating-point control modes. */
98 # define FE_DFL_MODE ((const femode_t *) -1L)