2 /* Copyright (C) 2002-2003, George Thanos <george.thanos@gdt.gr>
3 Yannis Mitsos <yannis.mitsos@gdt.gr>
5 Copyright (C) 1997, 1998, 1999, 2000 Free Software Foundation, Inc.
7 The GNU C Library is free software; you can redistribute it and/or
8 modify it under the terms of the GNU Lesser General Public
9 License as published by the Free Software Foundation; either
10 version 2.1 of the License, or (at your option) any later version.
12 The GNU C Library is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 Lesser General Public License for more details.
17 You should have received a copy of the GNU Lesser General Public
18 License along with the GNU C Library; if not, write to the Free
19 Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
23 # error "Never use <bits/fenv.h> directly; include <fenv.h> instead."
27 /* Define bits representing the exception. We use the bit positions of
28 the appropriate bits in the SR. */
31 FE_INEXACT = (1 << 8),
32 #define FE_INEXACT FE_INEXACT
33 FE_UNDERFLOW = (1 << 9),
34 #define FE_UNDERFLOW FE_UNDERFLOW
35 FE_OVERFLOW = (1 << 10),
36 #define FE_OVERFLOW FE_OVERFLOW
37 FE_DIVBYZERO = (1 << 11),
38 #define FE_DIVBYZERO FE_DIVBYZERO
39 FE_INVALID = (1 << 12)
40 #define FE_INVALID FE_INVALID
43 #define FE_ALL_EXCEPT \
44 (FE_INEXACT | FE_DIVBYZERO | FE_UNDERFLOW | FE_OVERFLOW | FE_INVALID)
46 /* We support all of the four defined rounding modes. We use
47 the bit positions in the FPCR Mode Control Byte as the values for the
48 appropriate macros. */
52 #define FE_TONEAREST FE_TONEAREST
53 FE_TOWARDZERO = 1 << 13 ,
54 #define FE_TOWARDZERO FE_TOWARDZERO
55 FE_DOWNWARD = 2 << 13,
56 #define FE_DOWNWARD FE_DOWNWARD
58 #define FE_UPWARD FE_UPWARD
62 /* Type representing exception flags. */
63 typedef unsigned int fexcept_t;
66 /* Type representing floating-point environment.*/
69 unsigned int round_mode;
70 unsigned int trap_enabled;
71 unsigned int accrued_except;
72 unsigned int actual_except;
76 /* If the default argument is used we use this value. */
77 const fenv FE_DFL_ENV_OBJ = {0, 0x1C00, 0}
78 #define FE_DFL_ENV (&FE_DFL_ENV_OBJ)
81 /* Floating-point environment where none of the exceptions are masked. */
82 const fenv_t FE_NOMASK_ENV_OBJ = { 0, 0x1F00, 0 };
83 # define FE_NOMASK_ENV (&FE_NOMASK_ENV_OBJ)
88 #include <bits/fenvinline.h>