Nonworking non-GNU OS port code moved to ports repository.
[glibc-ports.git] / sysdeps / hppa / fpu / bits / fenv.h
blobc5f8c43459ac13c7c315e65cf9ba2c8735c87946
1 /* Copyright (C) 2000 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.
3 Contributed by David Huggins-Daines <dhd@debian.org>
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, write to the Free
17 Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
18 02111-1307 USA. */
20 #ifndef _FENV_H
21 # error "Never use <bits/fenv.h> directly; include <fenv.h> instead."
22 #endif
24 /* Define bits representing the exception. We use the values of the
25 appropriate enable bits in the FPU status word (which,
26 coincidentally, are the same as the flag bits, but shifted right by
27 27 bits). */
28 enum
30 FE_INVALID = 1<<4, /* V */
31 #define FE_INVALID FE_INVALID
32 FE_DIVBYZERO = 1<<3, /* Z */
33 #define FE_DIVBYZERO FE_DIVBYZERO
34 FE_OVERFLOW = 1<<2, /* O */
35 #define FE_OVERFLOW FE_OVERFLOW
36 FE_UNDERFLOW = 1<<1, /* U */
37 #define FE_UNDERFLOW FE_UNDERFLOW
38 FE_INEXACT = 1<<0, /* I */
39 #define FE_INEXACT FE_INEXACT
42 #define FE_ALL_EXCEPT \
43 (FE_INEXACT | FE_DIVBYZERO | FE_UNDERFLOW | FE_OVERFLOW | FE_INVALID)
45 /* The PA-RISC FPU supports all of the four defined rounding modes.
46 We use the values of the RM field in the floating point status
47 register for the appropriate macros. */
48 enum
50 FE_TONEAREST = 0 << 9,
51 #define FE_TONEAREST FE_TONEAREST
52 FE_TOWARDZERO = 1 << 9,
53 #define FE_TOWARDZERO FE_TOWARDZERO
54 FE_UPWARD = 2 << 9,
55 #define FE_UPWARD FE_UPWARD
56 FE_DOWNWARD = 3 << 9,
57 #define FE_DOWNWARD FE_DOWNWARD
60 /* Type representing exception flags. */
61 typedef unsigned int fexcept_t;
63 /* Type representing floating-point environment. This structure
64 corresponds to the layout of the status and exception words in the
65 register file. */
66 typedef struct
68 unsigned int __status_word;
69 unsigned int __exception[7];
70 } fenv_t;
72 /* If the default argument is used we use this value. */
73 #define FE_DFL_ENV ((fenv_t *) -1)
75 #ifdef __USE_GNU
76 /* Floating-point environment where none of the exceptions are masked. */
77 # define FE_NOMASK_ENV ((fenv_t *) -2)
78 #endif