fenv.h 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. /* Floating point environment, RISC-V version.
  2. Copyright (C) 1998-2026 Free Software Foundation, Inc.
  3. 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.
  8. The GNU C Library is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  11. Lesser General Public License for more details.
  12. You should have received a copy of the GNU Lesser General Public
  13. License along with the GNU C Library. If not, see
  14. <https://www.gnu.org/licenses/>. */
  15. #ifndef _FENV_H
  16. # error "Never use <bits/fenv.h> directly; include <fenv.h> instead."
  17. #endif
  18. enum
  19. {
  20. FE_INEXACT =
  21. #define FE_INEXACT (0x01)
  22. FE_INEXACT,
  23. FE_UNDERFLOW =
  24. #define FE_UNDERFLOW (0x02)
  25. FE_UNDERFLOW,
  26. FE_OVERFLOW =
  27. #define FE_OVERFLOW (0x04)
  28. FE_OVERFLOW,
  29. FE_DIVBYZERO =
  30. #define FE_DIVBYZERO (0x08)
  31. FE_DIVBYZERO,
  32. FE_INVALID =
  33. #define FE_INVALID (0x10)
  34. FE_INVALID
  35. };
  36. #define FE_ALL_EXCEPT \
  37. (FE_INEXACT | FE_DIVBYZERO | FE_UNDERFLOW | FE_OVERFLOW | FE_INVALID)
  38. enum
  39. {
  40. FE_TONEAREST =
  41. #define FE_TONEAREST (0x0)
  42. FE_TONEAREST,
  43. FE_TOWARDZERO =
  44. #define FE_TOWARDZERO (0x1)
  45. FE_TOWARDZERO,
  46. FE_DOWNWARD =
  47. #define FE_DOWNWARD (0x2)
  48. FE_DOWNWARD,
  49. FE_UPWARD =
  50. #define FE_UPWARD (0x3)
  51. FE_UPWARD
  52. };
  53. typedef unsigned int fexcept_t;
  54. typedef unsigned int fenv_t;
  55. /* If the default argument is used we use this value. */
  56. #define FE_DFL_ENV ((__const fenv_t *) -1)
  57. #if __GLIBC_USE (IEC_60559_BFP_EXT_C23)
  58. /* Type representing floating-point control modes. */
  59. typedef unsigned int femode_t;
  60. /* Default floating-point control modes. */
  61. # define FE_DFL_MODE ((const femode_t *) -1L)
  62. #endif