1 /* Floating point environment, OpenRISC version.
2 Copyright (C) 2022-2023 Free Software Foundation, Inc.
4 This file is part of the GNU C Library.
6 The GNU C Library is free software; you can redistribute it and/or
7 modify it under the terms of the GNU Lesser General Public License as
8 published by the Free Software Foundation; either version 2.1 of the
9 License, or (at your option) any later version.
11 The GNU C Library is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 Lesser General Public License for more details.
16 You should have received a copy of the GNU Lesser General Public
17 License along with the GNU C Library; if not, see
18 <https://www.gnu.org/licenses/>. */
21 # error "Never use <bits/fenv.h> directly; include <fenv.h> instead."
24 /* Define bits representing exceptions in the FPCSR status word. */
28 #define FE_OVERFLOW (1 << 3)
31 #define FE_UNDERFLOW (1 << 4)
34 #define FE_INEXACT (1 << 8)
37 #define FE_INVALID (1 << 9)
40 #define FE_DIVBYZERO (1 << 11)
44 /* All supported exceptions. */
45 #define FE_ALL_EXCEPT \
46 (FE_INVALID | FE_DIVBYZERO | FE_OVERFLOW | FE_UNDERFLOW | FE_INEXACT)
48 /* Define bits representing rounding modes in the FPCSR Rmode field. */
49 #define FE_TONEAREST (0x0 << 1)
50 #define FE_TOWARDZERO (0x1 << 1)
51 #define FE_UPWARD (0x2 << 1)
52 #define FE_DOWNWARD (0x3 << 1)
54 /* Type representing exception flags. */
55 typedef unsigned int fexcept_t
;
57 /* Type representing floating-point environment. */
58 typedef unsigned int fenv_t
;
60 /* If the default argument is used we use this value. */
61 #define FE_DFL_ENV ((const fenv_t *) -1l)
63 #if __GLIBC_USE (IEC_60559_BFP_EXT)
64 /* Type representing floating-point control modes. */
65 typedef unsigned int femode_t
;
67 /* Default floating-point control modes. */
68 # define FE_DFL_MODE ((const femode_t *) -1L)