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