1 | /* Copyright (C) 2002-2015 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 3, 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 | Under Section 7 of GPL version 3, you are granted additional
|
---|
16 | permissions described in the GCC Runtime Library Exception, version
|
---|
17 | 3.1, as published by the Free Software Foundation.
|
---|
18 |
|
---|
19 | You should have received a copy of the GNU General Public License and
|
---|
20 | a copy of the GCC Runtime Library Exception along with this program;
|
---|
21 | see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
|
---|
22 | <http://www.gnu.org/licenses/>. */
|
---|
23 |
|
---|
24 | /*
|
---|
25 | * ISO C Standard: 5.2.4.2.2 Characteristics of floating types <float.h>
|
---|
26 | */
|
---|
27 |
|
---|
28 | #ifndef _FLOAT_H___
|
---|
29 | #define _FLOAT_H___
|
---|
30 |
|
---|
31 | /* Radix of exponent representation, b. */
|
---|
32 | #undef FLT_RADIX
|
---|
33 | #define FLT_RADIX __FLT_RADIX__
|
---|
34 |
|
---|
35 | /* Number of base-FLT_RADIX digits in the significand, p. */
|
---|
36 | #undef FLT_MANT_DIG
|
---|
37 | #undef DBL_MANT_DIG
|
---|
38 | #undef LDBL_MANT_DIG
|
---|
39 | #define FLT_MANT_DIG __FLT_MANT_DIG__
|
---|
40 | #define DBL_MANT_DIG __DBL_MANT_DIG__
|
---|
41 | #define LDBL_MANT_DIG __LDBL_MANT_DIG__
|
---|
42 |
|
---|
43 | /* Number of decimal digits, q, such that any floating-point number with q
|
---|
44 | decimal digits can be rounded into a floating-point number with p radix b
|
---|
45 | digits and back again without change to the q decimal digits,
|
---|
46 |
|
---|
47 | p * log10(b) if b is a power of 10
|
---|
48 | floor((p - 1) * log10(b)) otherwise
|
---|
49 | */
|
---|
50 | #undef FLT_DIG
|
---|
51 | #undef DBL_DIG
|
---|
52 | #undef LDBL_DIG
|
---|
53 | #define FLT_DIG __FLT_DIG__
|
---|
54 | #define DBL_DIG __DBL_DIG__
|
---|
55 | #define LDBL_DIG __LDBL_DIG__
|
---|
56 |
|
---|
57 | /* Minimum int x such that FLT_RADIX**(x-1) is a normalized float, emin */
|
---|
58 | #undef FLT_MIN_EXP
|
---|
59 | #undef DBL_MIN_EXP
|
---|
60 | #undef LDBL_MIN_EXP
|
---|
61 | #define FLT_MIN_EXP __FLT_MIN_EXP__
|
---|
62 | #define DBL_MIN_EXP __DBL_MIN_EXP__
|
---|
63 | #define LDBL_MIN_EXP __LDBL_MIN_EXP__
|
---|
64 |
|
---|
65 | /* Minimum negative integer such that 10 raised to that power is in the
|
---|
66 | range of normalized floating-point numbers,
|
---|
67 |
|
---|
68 | ceil(log10(b) * (emin - 1))
|
---|
69 | */
|
---|
70 | #undef FLT_MIN_10_EXP
|
---|
71 | #undef DBL_MIN_10_EXP
|
---|
72 | #undef LDBL_MIN_10_EXP
|
---|
73 | #define FLT_MIN_10_EXP __FLT_MIN_10_EXP__
|
---|
74 | #define DBL_MIN_10_EXP __DBL_MIN_10_EXP__
|
---|
75 | #define LDBL_MIN_10_EXP __LDBL_MIN_10_EXP__
|
---|
76 |
|
---|
77 | /* Maximum int x such that FLT_RADIX**(x-1) is a representable float, emax. */
|
---|
78 | #undef FLT_MAX_EXP
|
---|
79 | #undef DBL_MAX_EXP
|
---|
80 | #undef LDBL_MAX_EXP
|
---|
81 | #define FLT_MAX_EXP __FLT_MAX_EXP__
|
---|
82 | #define DBL_MAX_EXP __DBL_MAX_EXP__
|
---|
83 | #define LDBL_MAX_EXP __LDBL_MAX_EXP__
|
---|
84 |
|
---|
85 | /* Maximum integer such that 10 raised to that power is in the range of
|
---|
86 | representable finite floating-point numbers,
|
---|
87 |
|
---|
88 | floor(log10((1 - b**-p) * b**emax))
|
---|
89 | */
|
---|
90 | #undef FLT_MAX_10_EXP
|
---|
91 | #undef DBL_MAX_10_EXP
|
---|
92 | #undef LDBL_MAX_10_EXP
|
---|
93 | #define FLT_MAX_10_EXP __FLT_MAX_10_EXP__
|
---|
94 | #define DBL_MAX_10_EXP __DBL_MAX_10_EXP__
|
---|
95 | #define LDBL_MAX_10_EXP __LDBL_MAX_10_EXP__
|
---|
96 |
|
---|
97 | /* Maximum representable finite floating-point number,
|
---|
98 |
|
---|
99 | (1 - b**-p) * b**emax
|
---|
100 | */
|
---|
101 | #undef FLT_MAX
|
---|
102 | #undef DBL_MAX
|
---|
103 | #undef LDBL_MAX
|
---|
104 | #define FLT_MAX __FLT_MAX__
|
---|
105 | #define DBL_MAX __DBL_MAX__
|
---|
106 | #define LDBL_MAX __LDBL_MAX__
|
---|
107 |
|
---|
108 | /* The difference between 1 and the least value greater than 1 that is
|
---|
109 | representable in the given floating point type, b**1-p. */
|
---|
110 | #undef FLT_EPSILON
|
---|
111 | #undef DBL_EPSILON
|
---|
112 | #undef LDBL_EPSILON
|
---|
113 | #define FLT_EPSILON __FLT_EPSILON__
|
---|
114 | #define DBL_EPSILON __DBL_EPSILON__
|
---|
115 | #define LDBL_EPSILON __LDBL_EPSILON__
|
---|
116 |
|
---|
117 | /* Minimum normalized positive floating-point number, b**(emin - 1). */
|
---|
118 | #undef FLT_MIN
|
---|
119 | #undef DBL_MIN
|
---|
120 | #undef LDBL_MIN
|
---|
121 | #define FLT_MIN __FLT_MIN__
|
---|
122 | #define DBL_MIN __DBL_MIN__
|
---|
123 | #define LDBL_MIN __LDBL_MIN__
|
---|
124 |
|
---|
125 | /* Addition rounds to 0: zero, 1: nearest, 2: +inf, 3: -inf, -1: unknown. */
|
---|
126 | /* ??? This is supposed to change with calls to fesetround in <fenv.h>. */
|
---|
127 | #undef FLT_ROUNDS
|
---|
128 | #define FLT_ROUNDS 1
|
---|
129 |
|
---|
130 | #if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
|
---|
131 | /* The floating-point expression evaluation method.
|
---|
132 | -1 indeterminate
|
---|
133 | 0 evaluate all operations and constants just to the range and
|
---|
134 | precision of the type
|
---|
135 | 1 evaluate operations and constants of type float and double
|
---|
136 | to the range and precision of the double type, evaluate
|
---|
137 | long double operations and constants to the range and
|
---|
138 | precision of the long double type
|
---|
139 | 2 evaluate all operations and constants to the range and
|
---|
140 | precision of the long double type
|
---|
141 |
|
---|
142 | ??? This ought to change with the setting of the fp control word;
|
---|
143 | the value provided by the compiler assumes the widest setting. */
|
---|
144 | #undef FLT_EVAL_METHOD
|
---|
145 | #define FLT_EVAL_METHOD __FLT_EVAL_METHOD__
|
---|
146 |
|
---|
147 | /* Number of decimal digits, n, such that any floating-point number in the
|
---|
148 | widest supported floating type with pmax radix b digits can be rounded
|
---|
149 | to a floating-point number with n decimal digits and back again without
|
---|
150 | change to the value,
|
---|
151 |
|
---|
152 | pmax * log10(b) if b is a power of 10
|
---|
153 | ceil(1 + pmax * log10(b)) otherwise
|
---|
154 | */
|
---|
155 | #undef DECIMAL_DIG
|
---|
156 | #define DECIMAL_DIG __DECIMAL_DIG__
|
---|
157 |
|
---|
158 | #endif /* C99 */
|
---|
159 |
|
---|
160 | #if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 201112L
|
---|
161 | /* Versions of DECIMAL_DIG for each floating-point type. */
|
---|
162 | #undef FLT_DECIMAL_DIG
|
---|
163 | #undef DBL_DECIMAL_DIG
|
---|
164 | #undef LDBL_DECIMAL_DIG
|
---|
165 | #define FLT_DECIMAL_DIG __FLT_DECIMAL_DIG__
|
---|
166 | #define DBL_DECIMAL_DIG __DBL_DECIMAL_DIG__
|
---|
167 | #define LDBL_DECIMAL_DIG __DECIMAL_DIG__
|
---|
168 |
|
---|
169 | /* Whether types support subnormal numbers. */
|
---|
170 | #undef FLT_HAS_SUBNORM
|
---|
171 | #undef DBL_HAS_SUBNORM
|
---|
172 | #undef LDBL_HAS_SUBNORM
|
---|
173 | #define FLT_HAS_SUBNORM __FLT_HAS_DENORM__
|
---|
174 | #define DBL_HAS_SUBNORM __DBL_HAS_DENORM__
|
---|
175 | #define LDBL_HAS_SUBNORM __LDBL_HAS_DENORM__
|
---|
176 |
|
---|
177 | /* Minimum positive values, including subnormals. */
|
---|
178 | #undef FLT_TRUE_MIN
|
---|
179 | #undef DBL_TRUE_MIN
|
---|
180 | #undef LDBL_TRUE_MIN
|
---|
181 | #define FLT_TRUE_MIN __FLT_DENORM_MIN__
|
---|
182 | #define DBL_TRUE_MIN __DBL_DENORM_MIN__
|
---|
183 | #define LDBL_TRUE_MIN __LDBL_DENORM_MIN__
|
---|
184 |
|
---|
185 | #endif /* C11 */
|
---|
186 |
|
---|
187 | #ifdef __STDC_WANT_DEC_FP__
|
---|
188 | /* Draft Technical Report 24732, extension for decimal floating-point
|
---|
189 | arithmetic: Characteristic of decimal floating types <float.h>. */
|
---|
190 |
|
---|
191 | /* Number of base-FLT_RADIX digits in the significand, p. */
|
---|
192 | #undef DEC32_MANT_DIG
|
---|
193 | #undef DEC64_MANT_DIG
|
---|
194 | #undef DEC128_MANT_DIG
|
---|
195 | #define DEC32_MANT_DIG __DEC32_MANT_DIG__
|
---|
196 | #define DEC64_MANT_DIG __DEC64_MANT_DIG__
|
---|
197 | #define DEC128_MANT_DIG __DEC128_MANT_DIG__
|
---|
198 |
|
---|
199 | /* Minimum exponent. */
|
---|
200 | #undef DEC32_MIN_EXP
|
---|
201 | #undef DEC64_MIN_EXP
|
---|
202 | #undef DEC128_MIN_EXP
|
---|
203 | #define DEC32_MIN_EXP __DEC32_MIN_EXP__
|
---|
204 | #define DEC64_MIN_EXP __DEC64_MIN_EXP__
|
---|
205 | #define DEC128_MIN_EXP __DEC128_MIN_EXP__
|
---|
206 |
|
---|
207 | /* Maximum exponent. */
|
---|
208 | #undef DEC32_MAX_EXP
|
---|
209 | #undef DEC64_MAX_EXP
|
---|
210 | #undef DEC128_MAX_EXP
|
---|
211 | #define DEC32_MAX_EXP __DEC32_MAX_EXP__
|
---|
212 | #define DEC64_MAX_EXP __DEC64_MAX_EXP__
|
---|
213 | #define DEC128_MAX_EXP __DEC128_MAX_EXP__
|
---|
214 |
|
---|
215 | /* Maximum representable finite decimal floating-point number
|
---|
216 | (there are 6, 15, and 33 9s after the decimal points respectively). */
|
---|
217 | #undef DEC32_MAX
|
---|
218 | #undef DEC64_MAX
|
---|
219 | #undef DEC128_MAX
|
---|
220 | #define DEC32_MAX __DEC32_MAX__
|
---|
221 | #define DEC64_MAX __DEC64_MAX__
|
---|
222 | #define DEC128_MAX __DEC128_MAX__
|
---|
223 |
|
---|
224 | /* The difference between 1 and the least value greater than 1 that is
|
---|
225 | representable in the given floating point type. */
|
---|
226 | #undef DEC32_EPSILON
|
---|
227 | #undef DEC64_EPSILON
|
---|
228 | #undef DEC128_EPSILON
|
---|
229 | #define DEC32_EPSILON __DEC32_EPSILON__
|
---|
230 | #define DEC64_EPSILON __DEC64_EPSILON__
|
---|
231 | #define DEC128_EPSILON __DEC128_EPSILON__
|
---|
232 |
|
---|
233 | /* Minimum normalized positive floating-point number. */
|
---|
234 | #undef DEC32_MIN
|
---|
235 | #undef DEC64_MIN
|
---|
236 | #undef DEC128_MIN
|
---|
237 | #define DEC32_MIN __DEC32_MIN__
|
---|
238 | #define DEC64_MIN __DEC64_MIN__
|
---|
239 | #define DEC128_MIN __DEC128_MIN__
|
---|
240 |
|
---|
241 | /* Minimum subnormal positive floating-point number. */
|
---|
242 | #undef DEC32_SUBNORMAL_MIN
|
---|
243 | #undef DEC64_SUBNORMAL_MIN
|
---|
244 | #undef DEC128_SUBNORMAL_MIN
|
---|
245 | #define DEC32_SUBNORMAL_MIN __DEC32_SUBNORMAL_MIN__
|
---|
246 | #define DEC64_SUBNORMAL_MIN __DEC64_SUBNORMAL_MIN__
|
---|
247 | #define DEC128_SUBNORMAL_MIN __DEC128_SUBNORMAL_MIN__
|
---|
248 |
|
---|
249 | /* The floating-point expression evaluation method.
|
---|
250 | -1 indeterminate
|
---|
251 | 0 evaluate all operations and constants just to the range and
|
---|
252 | precision of the type
|
---|
253 | 1 evaluate operations and constants of type _Decimal32
|
---|
254 | and _Decimal64 to the range and precision of the _Decimal64
|
---|
255 | type, evaluate _Decimal128 operations and constants to the
|
---|
256 | range and precision of the _Decimal128 type;
|
---|
257 | 2 evaluate all operations and constants to the range and
|
---|
258 | precision of the _Decimal128 type. */
|
---|
259 |
|
---|
260 | #undef DEC_EVAL_METHOD
|
---|
261 | #define DEC_EVAL_METHOD __DEC_EVAL_METHOD__
|
---|
262 |
|
---|
263 | #endif /* __STDC_WANT_DEC_FP__ */
|
---|
264 |
|
---|
265 | #if defined (__MINGW32__) && ! defined (_MINGW_FLOAT_H_)
|
---|
266 | /* MinGW.org's runtime libraries provide a supplementary float.h, which
|
---|
267 | * must also be included to complement this one. Ideally that MinGW.org
|
---|
268 | * header should be included first, and it will include this one, but in
|
---|
269 | * a default configuration it doesn't normally happen this way; when we
|
---|
270 | * didn't see it first, include the MinGW.org header now!
|
---|
271 | */
|
---|
272 | # include_next <float.h>
|
---|
273 | #endif
|
---|
274 |
|
---|
275 | #endif /* _FLOAT_H___ */
|
---|