]>
Commit | Line | Data |
---|---|---|
d4697bc9 | 1 | /* Copyright (C) 2000-2014 Free Software Foundation, Inc. |
847b055c | 2 | This file is part of the GNU C Library. |
a784e502 | 3 | Contributed by Denis Joseph Barrow <djbarrow@de.ibm.com>. |
847b055c AJ |
4 | |
5 | The GNU C Library is free software; you can redistribute it and/or | |
41bdb6e2 AJ |
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. | |
847b055c AJ |
9 | |
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 | |
41bdb6e2 | 13 | Lesser General Public License for more details. |
847b055c | 14 | |
41bdb6e2 | 15 | You should have received a copy of the GNU Lesser General Public |
59ba27a6 PE |
16 | License along with the GNU C Library; if not, see |
17 | <http://www.gnu.org/licenses/>. */ | |
847b055c AJ |
18 | |
19 | #ifndef _FENV_H | |
20 | # error "Never use <bits/fenv.h> directly; include <fenv.h> instead." | |
21 | #endif | |
22 | ||
23 | /* Define bits representing the exception. We use the bit positions | |
24 | of the appropriate bits in the FPU control word. */ | |
25 | enum | |
26 | { | |
fbeafede JM |
27 | FE_INVALID = |
28 | #define FE_INVALID 0x80 | |
29 | FE_INVALID, | |
30 | FE_DIVBYZERO = | |
31 | #define FE_DIVBYZERO 0x40 | |
32 | FE_DIVBYZERO, | |
33 | FE_OVERFLOW = | |
34 | #define FE_OVERFLOW 0x20 | |
35 | FE_OVERFLOW, | |
36 | FE_UNDERFLOW = | |
37 | #define FE_UNDERFLOW 0x10 | |
38 | FE_UNDERFLOW, | |
39 | FE_INEXACT = | |
40 | #define FE_INEXACT 0x08 | |
41 | FE_INEXACT | |
847b055c AJ |
42 | }; |
43 | /* We dont use the y bit of the DXC in the floating point control register | |
417bafec UD |
44 | as glibc has no FE encoding for fe inexact incremented |
45 | or fe inexact truncated. | |
46 | We currently use the flag bits in the fpc | |
47 | as these are sticky for feholdenv & feupdatenv as it is defined | |
48 | in the HP Manpages. */ | |
847b055c AJ |
49 | |
50 | ||
51 | #define FE_ALL_EXCEPT \ | |
52 | (FE_INEXACT | FE_DIVBYZERO | FE_UNDERFLOW | FE_OVERFLOW | FE_INVALID) | |
53 | ||
54 | enum | |
55 | { | |
fbeafede JM |
56 | FE_TONEAREST = |
57 | #define FE_TONEAREST 0 | |
58 | FE_TONEAREST, | |
59 | FE_DOWNWARD = | |
60 | #define FE_DOWNWARD 0x3 | |
61 | FE_DOWNWARD, | |
62 | FE_UPWARD = | |
63 | #define FE_UPWARD 0x2 | |
64 | FE_UPWARD, | |
65 | FE_TOWARDZERO = | |
66 | #define FE_TOWARDZERO 0x1 | |
67 | FE_TOWARDZERO | |
847b055c AJ |
68 | }; |
69 | ||
847b055c AJ |
70 | |
71 | /* Type representing exception flags. */ | |
72 | typedef unsigned int fexcept_t; /* size of fpc */ | |
73 | ||
74 | ||
75 | /* Type representing floating-point environment. This function corresponds | |
76 | to the layout of the block written by the `fstenv'. */ | |
77 | typedef struct | |
78 | { | |
99252c8c JM |
79 | fexcept_t __fpc; |
80 | void *__ieee_instruction_pointer; | |
417bafec | 81 | /* failing instruction for ieee exceptions */ |
847b055c AJ |
82 | } fenv_t; |
83 | ||
84 | /* If the default argument is used we use this value. */ | |
a784e502 | 85 | #define FE_DFL_ENV ((const fenv_t *) -1) |
847b055c AJ |
86 | |
87 | #ifdef __USE_GNU | |
88 | /* Floating-point environment where none of the exceptions are masked. */ | |
a784e502 | 89 | # define FE_NOMASK_ENV ((const fenv_t *) -2) |
847b055c | 90 | #endif |