]>
Commit | Line | Data |
---|---|---|
3d9156a7 A |
1 | /* This file exists soley to keep Metrowerks' compilers happy. The version |
2 | used by GCC can be found in /usr/lib/gcc, although it's | |
3 | not very informative. */ | |
4 | ||
5 | #ifndef _FLOAT_H_ | |
6 | ||
7 | #if defined(__GNUC__) | |
8 | #include_next <float.h> | |
9 | ||
10 | #elif defined(__MWERKS__) | |
11 | #define _FLOAT_H_ | |
12 | ||
13 | /* APPLE LOCAL begin MW compatibility */ | |
14 | /* Define various characteristics of floating-point types, if needed. */ | |
15 | #ifndef __FLT_RADIX__ | |
16 | #define __FLT_RADIX__ 2 | |
17 | #endif | |
18 | #ifndef __FLT_MANT_DIG__ | |
19 | #define __FLT_MANT_DIG__ 24 | |
20 | #endif | |
21 | #ifndef __FLT_DIG__ | |
22 | #define __FLT_DIG__ 6 | |
23 | #endif | |
24 | #ifndef __FLT_EPSILON__ | |
25 | #define __FLT_EPSILON__ 1.19209290e-07F | |
26 | #endif | |
27 | #ifndef __FLT_MIN__ | |
28 | #define __FLT_MIN__ 1.17549435e-38F | |
29 | #endif | |
30 | #ifndef __FLT_MAX__ | |
31 | #define __FLT_MAX__ 3.40282347e+38F | |
32 | #endif | |
33 | #ifndef __FLT_MIN_EXP__ | |
34 | #define __FLT_MIN_EXP__ (-125) | |
35 | #endif | |
36 | #ifndef __FLT_MIN_10_EXP__ | |
37 | #define __FLT_MIN_10_EXP__ (-37) | |
38 | #endif | |
39 | #ifndef __FLT_MAX_EXP__ | |
40 | #define __FLT_MAX_EXP__ 128 | |
41 | #endif | |
42 | #ifndef __FLT_MAX_10_EXP__ | |
43 | #define __FLT_MAX_10_EXP__ 38 | |
44 | #endif | |
45 | #ifndef __DBL_MANT_DIG__ | |
46 | #define __DBL_MANT_DIG__ 53 | |
47 | #endif | |
48 | #ifndef __DBL_DIG__ | |
49 | #define __DBL_DIG__ 15 | |
50 | #endif | |
51 | #ifndef __DBL_EPSILON__ | |
52 | #define __DBL_EPSILON__ 2.2204460492503131e-16 | |
53 | #endif | |
54 | #ifndef __DBL_MIN__ | |
55 | #define __DBL_MIN__ 2.2250738585072014e-308 | |
56 | #endif | |
57 | #ifndef __DBL_MAX__ | |
58 | #define __DBL_MAX__ 1.7976931348623157e+308 | |
59 | #endif | |
60 | #ifndef __DBL_MIN_EXP__ | |
61 | #define __DBL_MIN_EXP__ (-1021) | |
62 | #endif | |
63 | #ifndef __DBL_MIN_10_EXP__ | |
64 | #define __DBL_MIN_10_EXP__ (-307) | |
65 | #endif | |
66 | #ifndef __DBL_MAX_EXP__ | |
67 | #define __DBL_MAX_EXP__ 1024 | |
68 | #endif | |
69 | #ifndef __DBL_MAX_10_EXP__ | |
70 | #define __DBL_MAX_10_EXP__ 308 | |
71 | #endif | |
72 | #ifndef __LDBL_MANT_DIG__ | |
73 | #define __LDBL_MANT_DIG__ 53 | |
74 | #endif | |
75 | #ifndef __LDBL_DIG__ | |
76 | #define __LDBL_DIG__ 15 | |
77 | #endif | |
78 | #ifndef __LDBL_EPSILON__ | |
79 | #define __LDBL_EPSILON__ 2.2204460492503131e-16 | |
80 | #endif | |
81 | #ifndef __LDBL_MIN__ | |
82 | #define __LDBL_MIN__ 2.2250738585072014e-308 | |
83 | #endif | |
84 | #ifndef __LDBL_MAX__ | |
85 | #define __LDBL_MAX__ 1.7976931348623157e+308 | |
86 | #endif | |
87 | #ifndef __LDBL_MIN_EXP__ | |
88 | #define __LDBL_MIN_EXP__ (-1021) | |
89 | #endif | |
90 | #ifndef __LDBL_MIN_10_EXP__ | |
91 | #define __LDBL_MIN_10_EXP__ (-307) | |
92 | #endif | |
93 | #ifndef __LDBL_MAX_EXP__ | |
94 | #define __LDBL_MAX_EXP__ 1024 | |
95 | #endif | |
96 | #ifndef __LDBL_MAX_10_EXP__ | |
97 | #define __LDBL_MAX_10_EXP__ 308 | |
98 | #endif | |
99 | /* APPLE LOCAl end MW compatibility */ | |
100 | ||
101 | /* Copyright (C) 2002 Free Software Foundation, Inc. | |
102 | ||
103 | This file is part of GNU CC. | |
104 | ||
105 | GNU CC is free software; you can redistribute it and/or modify | |
106 | it under the terms of the GNU General Public License as published by | |
107 | the Free Software Foundation; either version 2, or (at your option) | |
108 | any later version. | |
109 | ||
110 | GNU CC is distributed in the hope that it will be useful, | |
111 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
112 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
113 | GNU General Public License for more details. | |
114 | ||
115 | You should have received a copy of the GNU General Public License | |
116 | along with GNU CC; see the file COPYING. If not, write to | |
117 | the Free Software Foundation, 59 Temple Place - Suite 330, | |
118 | Boston, MA 02111-1307, USA. */ | |
119 | ||
120 | /* As a special exception, if you include this header file into source | |
121 | files compiled by GCC, this header file does not by itself cause | |
122 | the resulting executable to be covered by the GNU General Public | |
123 | License. This exception does not however invalidate any other | |
124 | reasons why the executable file might be covered by the GNU General | |
125 | Public License. */ | |
126 | ||
127 | /* | |
128 | * ISO C Standard: 5.2.4.2.2 Characteristics of floating types <float.h> | |
129 | */ | |
130 | ||
131 | ||
132 | /* Radix of exponent representation, b. */ | |
133 | #undef FLT_RADIX | |
134 | #define FLT_RADIX __FLT_RADIX__ | |
135 | ||
136 | /* Number of base-FLT_RADIX digits in the significand, p. */ | |
137 | #undef FLT_MANT_DIG | |
138 | #undef DBL_MANT_DIG | |
139 | #undef LDBL_MANT_DIG | |
140 | #define FLT_MANT_DIG __FLT_MANT_DIG__ | |
141 | #define DBL_MANT_DIG __DBL_MANT_DIG__ | |
142 | #define LDBL_MANT_DIG __LDBL_MANT_DIG__ | |
143 | ||
144 | /* Number of decimal digits, q, such that any floating-point number with q | |
145 | decimal digits can be rounded into a floating-point number with p radix b | |
146 | digits and back again without change to the q decimal digits, | |
147 | ||
148 | p * log10(b) if b is a power of 10 | |
149 | floor((p - 1) * log10(b)) otherwise | |
150 | */ | |
151 | #undef FLT_DIG | |
152 | #undef DBL_DIG | |
153 | #undef LDBL_DIG | |
154 | #define FLT_DIG __FLT_DIG__ | |
155 | #define DBL_DIG __DBL_DIG__ | |
156 | #define LDBL_DIG __LDBL_DIG__ | |
157 | ||
158 | /* Minimum int x such that FLT_RADIX**(x-1) is a normalized float, emin */ | |
159 | #undef FLT_MIN_EXP | |
160 | #undef DBL_MIN_EXP | |
161 | #undef LDBL_MIN_EXP | |
162 | #define FLT_MIN_EXP __FLT_MIN_EXP__ | |
163 | #define DBL_MIN_EXP __DBL_MIN_EXP__ | |
164 | #define LDBL_MIN_EXP __LDBL_MIN_EXP__ | |
165 | ||
166 | /* Minimum negative integer such that 10 raised to that power is in the | |
167 | range of normalized floating-point numbers, | |
168 | ||
169 | ceil(log10(b) * (emin - 1)) | |
170 | */ | |
171 | #undef FLT_MIN_10_EXP | |
172 | #undef DBL_MIN_10_EXP | |
173 | #undef LDBL_MIN_10_EXP | |
174 | #define FLT_MIN_10_EXP __FLT_MIN_10_EXP__ | |
175 | #define DBL_MIN_10_EXP __DBL_MIN_10_EXP__ | |
176 | #define LDBL_MIN_10_EXP __LDBL_MIN_10_EXP__ | |
177 | ||
178 | /* Maximum int x such that FLT_RADIX**(x-1) is a representable float, emax. */ | |
179 | #undef FLT_MAX_EXP | |
180 | #undef DBL_MAX_EXP | |
181 | #undef LDBL_MAX_EXP | |
182 | #define FLT_MAX_EXP __FLT_MAX_EXP__ | |
183 | #define DBL_MAX_EXP __DBL_MAX_EXP__ | |
184 | #define LDBL_MAX_EXP __LDBL_MAX_EXP__ | |
185 | ||
186 | /* Maximum integer such that 10 raised to that power is in the range of | |
187 | representable finite floating-point numbers, | |
188 | ||
189 | floor(log10((1 - b**-p) * b**emax)) | |
190 | */ | |
191 | #undef FLT_MAX_10_EXP | |
192 | #undef DBL_MAX_10_EXP | |
193 | #undef LDBL_MAX_10_EXP | |
194 | #define FLT_MAX_10_EXP __FLT_MAX_10_EXP__ | |
195 | #define DBL_MAX_10_EXP __DBL_MAX_10_EXP__ | |
196 | #define LDBL_MAX_10_EXP __LDBL_MAX_10_EXP__ | |
197 | ||
198 | /* Maximum representable finite floating-point number, | |
199 | ||
200 | (1 - b**-p) * b**emax | |
201 | */ | |
202 | #undef FLT_MAX | |
203 | #undef DBL_MAX | |
204 | #undef LDBL_MAX | |
205 | #define FLT_MAX __FLT_MAX__ | |
206 | #define DBL_MAX __DBL_MAX__ | |
207 | #define LDBL_MAX __LDBL_MAX__ | |
208 | ||
209 | /* The difference between 1 and the least value greater than 1 that is | |
210 | representable in the given floating point type, b**1-p. */ | |
211 | #undef FLT_EPSILON | |
212 | #undef DBL_EPSILON | |
213 | #undef LDBL_EPSILON | |
214 | #define FLT_EPSILON __FLT_EPSILON__ | |
215 | #define DBL_EPSILON __DBL_EPSILON__ | |
216 | #define LDBL_EPSILON __LDBL_EPSILON__ | |
217 | ||
218 | /* Minimum normalized positive floating-point number, b**(emin - 1). */ | |
219 | #undef FLT_MIN | |
220 | #undef DBL_MIN | |
221 | #undef LDBL_MIN | |
222 | #define FLT_MIN __FLT_MIN__ | |
223 | #define DBL_MIN __DBL_MIN__ | |
224 | #define LDBL_MIN __LDBL_MIN__ | |
225 | ||
226 | /* Addition rounds to 0: zero, 1: nearest, 2: +inf, 3: -inf, -1: unknown. */ | |
227 | /* ??? This is supposed to change with calls to fesetround in <fenv.h>. */ | |
228 | #undef FLT_ROUNDS | |
229 | #define FLT_ROUNDS 1 | |
230 | ||
231 | #if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L | |
232 | /* The floating-point expression evaluation method. | |
233 | -1 indeterminate | |
234 | 0 evaluate all operations and constants just to the range and | |
235 | precision of the type | |
236 | 1 evaluate operations and constants of type float and double | |
237 | to the range and precision of the double type, evaluate | |
238 | long double operations and constants to the range and | |
239 | precision of the long double type | |
240 | 2 evaluate all operations and constants to the range and | |
241 | precision of the long double type | |
242 | ||
243 | ??? This ought to change with the setting of the fp control word; | |
244 | the value provided by the compiler assumes the widest setting. */ | |
245 | #undef FLT_EVAL_METHOD | |
246 | #define FLT_EVAL_METHOD __FLT_EVAL_METHOD__ | |
247 | ||
248 | /* Number of decimal digits, n, such that any floating-point number in the | |
249 | widest supported floating type with pmax radix b digits can be rounded | |
250 | to a floating-point number with n decimal digits and back again without | |
251 | change to the value, | |
252 | ||
253 | pmax * log10(b) if b is a power of 10 | |
254 | ceil(1 + pmax * log10(b)) otherwise | |
255 | */ | |
256 | #undef DECIMAL_DIG | |
257 | #define DECIMAL_DIG __DECIMAL_DIG__ | |
258 | ||
259 | #endif /* C99 */ | |
260 | ||
261 | #ifdef __cplusplus | |
262 | extern "C" { | |
263 | #endif | |
264 | extern int __fegetfltrounds( void ); | |
265 | #ifdef __cplusplus | |
266 | } | |
267 | #endif | |
268 | #undef FLT_ROUNDS | |
269 | #define FLT_ROUNDS (__fegetfltrounds ()) | |
270 | /* End of GNU CC file */ | |
271 | ||
272 | /* APPLE LOCAL begin CW compatibility */ | |
273 | /* CodeWarrior defines the following on its own. */ | |
274 | #undef DECIMAL_DIG | |
275 | /* APPLE LOCAL end CW compatibility */ | |
276 | ||
277 | #else | |
278 | #error This file is only for Metrowerks compatibilty. | |
279 | #endif | |
280 | ||
281 | #endif /* _FLOAT_H_ */ |