fenv.h 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. /* Copyright (C) 1997, 1998, 1999 Free Software Foundation, Inc.
  2. This file is part of the GNU C Library.
  3. The GNU C Library is free software; you can redistribute it and/or
  4. modify it under the terms of the GNU Lesser General Public
  5. License as published by the Free Software Foundation; either
  6. version 2.1 of the License, or (at your option) any later version.
  7. The GNU C Library is distributed in the hope that it will be useful,
  8. but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  10. Lesser General Public License for more details.
  11. You should have received a copy of the GNU Lesser General Public
  12. License along with the GNU C Library; if not, write to the Free
  13. Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
  14. 02111-1307 USA. */
  15. #ifndef _FENV_H
  16. # error "Never use <bits/fenv.h> directly; include <fenv.h> instead."
  17. #endif
  18. /* Define bits representing exceptions in the FPU status word. */
  19. enum
  20. {
  21. FE_INVALID = 1,
  22. #define FE_INVALID FE_INVALID
  23. FE_DIVBYZERO = 2,
  24. #define FE_DIVBYZERO FE_DIVBYZERO
  25. FE_OVERFLOW = 4,
  26. #define FE_OVERFLOW FE_OVERFLOW
  27. FE_UNDERFLOW = 8,
  28. #define FE_UNDERFLOW FE_UNDERFLOW
  29. };
  30. /* Amount to shift by to convert an exception to a mask bit. */
  31. #define FE_EXCEPT_SHIFT 16
  32. /* All supported exceptions. */
  33. #define FE_ALL_EXCEPT \
  34. (FE_INVALID | FE_DIVBYZERO | FE_OVERFLOW | FE_UNDERFLOW)
  35. /* The ARM FPU basically only supports round-to-nearest. Other rounding
  36. modes exist, but you have to encode them in the actual instruction. */
  37. #define FE_TONEAREST 0
  38. /* Type representing exception flags. */
  39. typedef unsigned long int fexcept_t;
  40. /* Type representing floating-point environment. */
  41. typedef struct
  42. {
  43. unsigned long int __cw;
  44. }
  45. fenv_t;
  46. /* If the default argument is used we use this value. */
  47. #define FE_DFL_ENV ((fenv_t *) -1l)