OSDN Git Service

- trim any trailing whitespace
[uclinux-h8/uClibc.git] / libc / sysdeps / linux / e1 / bits / fenv.h
1
2 /*  Copyright (C) 2002-2003,    George Thanos <george.thanos@gdt.gr>
3                                 Yannis Mitsos <yannis.mitsos@gdt.gr>
4
5    Copyright (C) 1997, 1998, 1999, 2000 Free Software Foundation, Inc.
6
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.
11
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.
16
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
20    02111-1307 USA.  */
21
22 #ifndef _FENV_H
23 # error "Never use <bits/fenv.h> directly; include <fenv.h> instead."
24 #endif
25
26
27 /* Define bits representing the exception.  We use the bit positions of
28    the appropriate bits in the SR.  */
29 enum
30   {
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
41   };
42
43 #define FE_ALL_EXCEPT \
44         (FE_INEXACT | FE_DIVBYZERO | FE_UNDERFLOW | FE_OVERFLOW | FE_INVALID)
45
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.  */
49 enum
50   {
51     FE_TONEAREST = 0,
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
57     FE_UPWARD = 3 << 13
58 #define FE_UPWARD       FE_UPWARD
59   };
60
61
62 /* Type representing exception flags.  */
63 typedef unsigned int fexcept_t;
64
65
66 /* Type representing floating-point environment.*/
67 typedef struct
68 {
69     unsigned int round_mode;
70     unsigned int trap_enabled;
71     unsigned int accrued_except;
72     unsigned int actual_except;
73 } fenv_t;
74
75 #if 0
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)
79
80 #ifdef __USE_GNU
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)
84 #endif
85
86 #endif
87
88 #include <bits/fenvinline.h>