1 /* Copyright (C) 2000, 2012 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.
3 Contributed by Denis Joseph Barrow <djbarrow@de.ibm.com>.
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
10 The GNU C Library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
15 You should have received a copy of the GNU Lesser General Public
16 License along with the GNU C Library; if not, see
17 <http://www.gnu.org/licenses/>. */
20 # error "Never use <bits/fenv.h> directly; include <fenv.h> instead."
23 /* Define bits representing the exception. We use the bit positions
24 of the appropriate bits in the FPU control word. */
28 #define FE_INVALID FE_INVALID
30 #define FE_DIVBYZERO FE_DIVBYZERO
32 #define FE_OVERFLOW FE_OVERFLOW
34 #define FE_UNDERFLOW FE_UNDERFLOW
36 #define FE_INEXACT FE_INEXACT
38 /* We dont use the y bit of the DXC in the floating point control register
39 as glibc has no FE encoding for fe inexact incremented
40 or fe inexact truncated.
41 We currently use the flag bits in the fpc
42 as these are sticky for feholdenv & feupdatenv as it is defined
43 in the HP Manpages. */
46 #define FE_ALL_EXCEPT \
47 (FE_INEXACT | FE_DIVBYZERO | FE_UNDERFLOW | FE_OVERFLOW | FE_INVALID)
52 #define FE_TONEAREST FE_TONEAREST
54 #define FE_DOWNWARD FE_DOWNWARD
56 #define FE_UPWARD FE_UPWARD
58 #define FE_TOWARDZERO FE_TOWARDZERO
62 /* Type representing exception flags. */
63 typedef unsigned int fexcept_t
; /* size of fpc */
66 /* Type representing floating-point environment. This function corresponds
67 to the layout of the block written by the `fstenv'. */
71 void *ieee_instruction_pointer
;
72 /* failing instruction for ieee exceptions */
75 /* If the default argument is used we use this value. */
76 #define FE_DFL_ENV ((const fenv_t *) -1)
79 /* Floating-point environment where none of the exceptions are masked. */
80 # define FE_NOMASK_ENV ((const fenv_t *) -2)