Update copyright notices with scripts/update-copyrights
[glibc.git] / sysdeps / s390 / fpu / bits / fenv.h
blob8dc3d5f81f46f79f1413271c238b8e3bc1b71792
1 /* Copyright (C) 2000-2014 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/>. */
19 #ifndef _FENV_H
20 # error "Never use <bits/fenv.h> directly; include <fenv.h> instead."
21 #endif
23 /* Define bits representing the exception. We use the bit positions
24 of the appropriate bits in the FPU control word. */
25 enum
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
43 /* We dont use the y bit of the DXC in the floating point control register
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. */
51 #define FE_ALL_EXCEPT \
52 (FE_INEXACT | FE_DIVBYZERO | FE_UNDERFLOW | FE_OVERFLOW | FE_INVALID)
54 enum
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
71 /* Type representing exception flags. */
72 typedef unsigned int fexcept_t; /* size of fpc */
75 /* Type representing floating-point environment. This function corresponds
76 to the layout of the block written by the `fstenv'. */
77 typedef struct
79 fexcept_t __fpc;
80 void *__ieee_instruction_pointer;
81 /* failing instruction for ieee exceptions */
82 } fenv_t;
84 /* If the default argument is used we use this value. */
85 #define FE_DFL_ENV ((const fenv_t *) -1)
87 #ifdef __USE_GNU
88 /* Floating-point environment where none of the exceptions are masked. */
89 # define FE_NOMASK_ENV ((const fenv_t *) -2)
90 #endif