OSDN Git Service

gcc/
[pf3gnuchains/gcc-fork.git] / gcc / ginclude / float.h
1 /* Copyright (C) 2002, 2007 Free Software Foundation, Inc.
2
3 This file is part of GCC.
4
5 GCC is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2, or (at your option)
8 any later version.
9
10 GCC 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
13 GNU General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with GCC; see the file COPYING.  If not, write to
17 the Free Software Foundation, 51 Franklin Street, Fifth Floor,
18 Boston, MA 02110-1301, USA.  */
19
20 /* As a special exception, if you include this header file into source
21    files compiled by GCC, this header file does not by itself cause
22    the resulting executable to be covered by the GNU General Public
23    License.  This exception does not however invalidate any other
24    reasons why the executable file might be covered by the GNU General
25    Public License.  */
26
27 /*
28  * ISO C Standard:  5.2.4.2.2  Characteristics of floating types <float.h>
29  */
30
31 #ifndef _FLOAT_H___
32 #define _FLOAT_H___
33
34 /* Radix of exponent representation, b. */
35 #undef FLT_RADIX
36 #define FLT_RADIX       __FLT_RADIX__
37
38 /* Number of base-FLT_RADIX digits in the significand, p.  */
39 #undef FLT_MANT_DIG
40 #undef DBL_MANT_DIG
41 #undef LDBL_MANT_DIG
42 #define FLT_MANT_DIG    __FLT_MANT_DIG__
43 #define DBL_MANT_DIG    __DBL_MANT_DIG__
44 #define LDBL_MANT_DIG   __LDBL_MANT_DIG__
45
46 /* Number of decimal digits, q, such that any floating-point number with q
47    decimal digits can be rounded into a floating-point number with p radix b
48    digits and back again without change to the q decimal digits,
49
50         p * log10(b)                    if b is a power of 10
51         floor((p - 1) * log10(b))       otherwise
52 */
53 #undef FLT_DIG
54 #undef DBL_DIG
55 #undef LDBL_DIG
56 #define FLT_DIG         __FLT_DIG__
57 #define DBL_DIG         __DBL_DIG__
58 #define LDBL_DIG        __LDBL_DIG__
59
60 /* Minimum int x such that FLT_RADIX**(x-1) is a normalized float, emin */
61 #undef FLT_MIN_EXP
62 #undef DBL_MIN_EXP
63 #undef LDBL_MIN_EXP
64 #define FLT_MIN_EXP     __FLT_MIN_EXP__
65 #define DBL_MIN_EXP     __DBL_MIN_EXP__
66 #define LDBL_MIN_EXP    __LDBL_MIN_EXP__
67
68 /* Minimum negative integer such that 10 raised to that power is in the
69    range of normalized floating-point numbers,
70
71         ceil(log10(b) * (emin - 1))
72 */
73 #undef FLT_MIN_10_EXP
74 #undef DBL_MIN_10_EXP
75 #undef LDBL_MIN_10_EXP
76 #define FLT_MIN_10_EXP  __FLT_MIN_10_EXP__
77 #define DBL_MIN_10_EXP  __DBL_MIN_10_EXP__
78 #define LDBL_MIN_10_EXP __LDBL_MIN_10_EXP__
79
80 /* Maximum int x such that FLT_RADIX**(x-1) is a representable float, emax.  */
81 #undef FLT_MAX_EXP
82 #undef DBL_MAX_EXP
83 #undef LDBL_MAX_EXP
84 #define FLT_MAX_EXP     __FLT_MAX_EXP__
85 #define DBL_MAX_EXP     __DBL_MAX_EXP__
86 #define LDBL_MAX_EXP    __LDBL_MAX_EXP__
87
88 /* Maximum integer such that 10 raised to that power is in the range of
89    representable finite floating-point numbers,
90
91         floor(log10((1 - b**-p) * b**emax))
92 */
93 #undef FLT_MAX_10_EXP
94 #undef DBL_MAX_10_EXP
95 #undef LDBL_MAX_10_EXP
96 #define FLT_MAX_10_EXP  __FLT_MAX_10_EXP__
97 #define DBL_MAX_10_EXP  __DBL_MAX_10_EXP__
98 #define LDBL_MAX_10_EXP __LDBL_MAX_10_EXP__
99
100 /* Maximum representable finite floating-point number,
101
102         (1 - b**-p) * b**emax
103 */
104 #undef FLT_MAX
105 #undef DBL_MAX
106 #undef LDBL_MAX
107 #define FLT_MAX         __FLT_MAX__
108 #define DBL_MAX         __DBL_MAX__
109 #define LDBL_MAX        __LDBL_MAX__
110
111 /* The difference between 1 and the least value greater than 1 that is
112    representable in the given floating point type, b**1-p.  */
113 #undef FLT_EPSILON
114 #undef DBL_EPSILON
115 #undef LDBL_EPSILON
116 #define FLT_EPSILON     __FLT_EPSILON__
117 #define DBL_EPSILON     __DBL_EPSILON__
118 #define LDBL_EPSILON    __LDBL_EPSILON__
119
120 /* Minimum normalized positive floating-point number, b**(emin - 1).  */
121 #undef FLT_MIN
122 #undef DBL_MIN
123 #undef LDBL_MIN
124 #define FLT_MIN         __FLT_MIN__
125 #define DBL_MIN         __DBL_MIN__
126 #define LDBL_MIN        __LDBL_MIN__
127
128 /* Addition rounds to 0: zero, 1: nearest, 2: +inf, 3: -inf, -1: unknown.  */
129 /* ??? This is supposed to change with calls to fesetround in <fenv.h>.  */
130 #undef FLT_ROUNDS
131 #define FLT_ROUNDS 1
132
133 #if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
134 /* The floating-point expression evaluation method.
135         -1  indeterminate
136          0  evaluate all operations and constants just to the range and
137             precision of the type
138          1  evaluate operations and constants of type float and double
139             to the range and precision of the double type, evaluate
140             long double operations and constants to the range and
141             precision of the long double type
142          2  evaluate all operations and constants to the range and
143             precision of the long double type
144
145    ??? This ought to change with the setting of the fp control word;
146    the value provided by the compiler assumes the widest setting.  */
147 #undef FLT_EVAL_METHOD
148 #define FLT_EVAL_METHOD __FLT_EVAL_METHOD__
149
150 /* Number of decimal digits, n, such that any floating-point number in the
151    widest supported floating type with pmax radix b digits can be rounded
152    to a floating-point number with n decimal digits and back again without
153    change to the value,
154
155         pmax * log10(b)                 if b is a power of 10
156         ceil(1 + pmax * log10(b))       otherwise
157 */
158 #undef DECIMAL_DIG
159 #define DECIMAL_DIG     __DECIMAL_DIG__
160
161 #endif /* C99 */
162
163 #if __STDC_WANT_DEC_FP__ == 1
164 /* Draft Technical Report 24732, extension for decimal floating-point
165    arithmetic: Characteristic of decimal floating types <float.h>.  */
166
167 /* Number of base-FLT_RADIX digits in the significand, p.  */
168 #undef DEC32_MANT_DIG
169 #undef DEC64_MANT_DIG
170 #undef DEC128_MANT_DIG
171 #define DEC32_MANT_DIG  __DEC32_MANT_DIG__
172 #define DEC64_MANT_DIG  __DEC64_MANT_DIG__
173 #define DEC128_MANT_DIG __DEC128_MANT_DIG__
174
175 /* Minimum exponent. */
176 #undef DEC32_MIN_EXP
177 #undef DEC64_MIN_EXP
178 #undef DEC128_MIN_EXP
179 #define DEC32_MIN_EXP   __DEC32_MIN_EXP__
180 #define DEC64_MIN_EXP   __DEC64_MIN_EXP__
181 #define DEC128_MIN_EXP  __DEC128_MIN_EXP__
182
183 /* Maximum exponent. */
184 #undef DEC32_MAX_EXP
185 #undef DEC64_MAX_EXP
186 #undef DEC128_MAX_EXP
187 #define DEC32_MAX_EXP   __DEC32_MAX_EXP__
188 #define DEC64_MAX_EXP   __DEC64_MAX_EXP__
189 #define DEC128_MAX_EXP  __DEC128_MAX_EXP__
190
191 /* Maximum representable finite decimal floating-point number
192    (there are 6, 15, and 33 9s after the decimal points respectively). */
193 #undef DEC32_MAX
194 #undef DEC64_MAX
195 #undef DEC128_MAX
196 #define DEC32_MAX   __DEC32_MAX__
197 #define DEC64_MAX   __DEC64_MAX__
198 #define DEC128_MAX  __DEC128_MAX__
199
200 /* The difference between 1 and the least value greater than 1 that is
201    representable in the given floating point type. */
202 #undef DEC32_EPSILON
203 #undef DEC64_EPSILON
204 #undef DEC128_EPSILON
205 #define DEC32_EPSILON   __DEC32_EPSILON__
206 #define DEC64_EPSILON   __DEC64_EPSILON__
207 #define DEC128_EPSILON  __DEC128_EPSILON__
208
209 /* Minimum normalized positive floating-point number. */
210 #undef DEC32_MIN
211 #undef DEC64_MIN
212 #undef DEC128_MIN
213 #define DEC32_MIN       __DEC32_MIN__
214 #define DEC64_MIN       __DEC64_MIN__
215 #define DEC128_MIN      __DEC128_MIN__
216
217 /* Minimum denormalized positive floating-point number. */
218 #undef DEC32_DEN
219 #undef DEC64_DEN
220 #undef DEC128_DEN
221 #define DEC32_DEN       __DEC32_DEN__
222 #define DEC64_DEN       __DEC64_DEN__
223 #define DEC128_DEN      __DEC128_DEN__
224
225 /* The floating-point expression evaluation method.
226          -1  indeterminate
227          0  evaluate all operations and constants just to the range and
228             precision of the type
229          1  evaluate operations and constants of type _Decimal32 
230             and _Decimal64 to the range and precision of the _Decimal64 
231             type, evaluate _Decimal128 operations and constants to the 
232             range and precision of the _Decimal128 type;
233          2  evaluate all operations and constants to the range and
234             precision of the _Decimal128 type.  */
235
236 #undef DECFLT_EVAL_METHOD
237 #define DECFLT_EVAL_METHOD      __DECFLT_EVAL_METHOD__
238
239 #endif /* __STDC_WANT_DEC_FP__ == 1 */
240
241 #endif /* _FLOAT_H___ */