1 /* Floating point environment. ARC version. 2 Copyright (C) 2020-2025 Free Software Foundation, Inc. 3 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. 8 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. 13 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/>. */ 17 18 #ifndef _FENV_H 19 # error "Never use <bits/fenv.h> directly; include <fenv.h> instead." 20 #endif 21 22 enum 23 { 24 FE_INVALID = 25 # define FE_INVALID (0x01) 26 FE_INVALID, 27 FE_DIVBYZERO = 28 # define FE_DIVBYZERO (0x02) 29 FE_DIVBYZERO, 30 FE_OVERFLOW = 31 # define FE_OVERFLOW (0x04) 32 FE_OVERFLOW, 33 FE_UNDERFLOW = 34 # define FE_UNDERFLOW (0x08) 35 FE_UNDERFLOW, 36 FE_INEXACT = 37 # define FE_INEXACT (0x10) 38 FE_INEXACT 39 }; 40 41 # define FE_ALL_EXCEPT \ 42 (FE_INVALID | FE_DIVBYZERO | FE_OVERFLOW | FE_UNDERFLOW | FE_INEXACT) 43 44 enum 45 { 46 FE_TOWARDZERO = 47 # define FE_TOWARDZERO (0x0) 48 FE_TOWARDZERO, 49 FE_TONEAREST = 50 # define FE_TONEAREST (0x1) /* default */ 51 FE_TONEAREST, 52 FE_UPWARD = 53 # define FE_UPWARD (0x2) 54 FE_UPWARD, 55 FE_DOWNWARD = 56 # define FE_DOWNWARD (0x3) 57 FE_DOWNWARD 58 }; 59 60 typedef unsigned int fexcept_t; 61 62 typedef struct 63 { 64 unsigned int __fpcr; 65 unsigned int __fpsr; 66 } fenv_t; 67 68 /* If the default argument is used we use this value. */ 69 #define FE_DFL_ENV ((const fenv_t *) -1) 70 71 /* Type representing floating-point control modes. */ 72 typedef unsigned int femode_t; 73 74 /* Default floating-point control modes. */ 75 # define FE_DFL_MODE ((const femode_t *) -1L) 76