]>
Commit | Line | Data |
---|---|---|
54c1bf78 | 1 | // The template and inlines for the -*- C++ -*- numeric_limits classes. |
de96ac46 | 2 | |
ffe94f83 | 3 | // Copyright (C) 1999, 2000, 2001, 2002 Free Software Foundation, Inc. |
de96ac46 BK |
4 | // |
5 | // This file is part of the GNU ISO C++ Library. This library is free | |
6 | // software; you can redistribute it and/or modify it under the | |
7 | // terms of the GNU General Public License as published by the | |
8 | // Free Software Foundation; either version 2, or (at your option) | |
9 | // any later version. | |
10 | ||
11 | // This library 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 | // You should have received a copy of the GNU General Public License along | |
17 | // with this library; see the file COPYING. If not, write to the Free | |
18 | // Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, | |
19 | // USA. | |
20 | ||
21 | // As a special exception, you may use this file as part of a free software | |
22 | // library without restriction. Specifically, if other files instantiate | |
23 | // templates or use macros or inline functions from this file, or you compile | |
24 | // this file and link it with other files to produce an executable, this | |
25 | // file does not by itself cause the resulting executable to be covered by | |
26 | // the GNU General Public License. This exception does not however | |
27 | // invalidate any other reasons why the executable file might be covered by | |
28 | // the GNU General Public License. | |
29 | ||
54c1bf78 BK |
30 | // Note: this is not a conforming implementation. |
31 | // Written by Gabriel Dos Reis <gdr@codesourcery.com> | |
32 | ||
33 | // | |
34 | // ISO 14882:1998 | |
35 | // 18.2.1 | |
36 | // | |
37 | ||
ffe94f83 PE |
38 | /** @file limits |
39 | * This is a Standard C++ Library header. You should @c #include this header | |
40 | * in your programs, rather than any of the "st[dl]_*.h" implementation files. | |
2f9d51b8 PE |
41 | */ |
42 | ||
54c1bf78 BK |
43 | #ifndef _CPP_NUMERIC_LIMITS |
44 | #define _CPP_NUMERIC_LIMITS 1 | |
45 | ||
46 | #pragma GCC system_header | |
47 | ||
48 | #include <bits/cpu_limits.h> | |
49 | #include <bits/c++config.h> | |
50 | ||
51 | // | |
52 | // The numeric_limits<> traits document implementation-defined aspects | |
53 | // of fundamental arithmetic data types (integers and floating points). | |
54 | // From Standard C++ point of view, there are 13 such types: | |
55 | // * integers | |
56 | // bool (1) | |
57 | // char, signed char, unsigned char (3) | |
58 | // short, unsigned short (2) | |
59 | // int, unsigned (2) | |
60 | // long, unsigned long (2) | |
61 | // | |
62 | // * floating points | |
63 | // float (1) | |
64 | // double (1) | |
65 | // long double (1) | |
66 | // | |
67 | // GNU C++ undertstands (where supported by the host C-library) | |
68 | // * integer | |
69 | // long long, unsigned long long (2) | |
70 | // | |
71 | // which brings us to 15 fundamental arithmetic data types in GNU C++. | |
72 | // | |
73 | // | |
74 | // Since a numeric_limits<> is a bit tricky to get right, we rely on | |
75 | // an interface composed of macros which should be defined in config/os | |
76 | // or config/cpu when they differ from the generic (read arbitrary) | |
77 | // definitions given here. | |
78 | // | |
79 | ||
54c1bf78 | 80 | #ifdef __CHAR_UNSIGNED__ |
f3cd98c4 | 81 | # define __glibcpp_plain_char_is_signed false |
54c1bf78 | 82 | #else |
f3cd98c4 | 83 | # define __glibcpp_plain_char_is_signed true |
54c1bf78 | 84 | #endif |
585e661a GDR |
85 | |
86 | #ifndef __WCHAR_UNSIGNED__ | |
87 | # define __glibcpp_wchar_t_is_signed false | |
88 | #else | |
f3cd98c4 | 89 | # define __glibcpp_wchar_t_is_signed true |
54c1bf78 | 90 | #endif |
585e661a GDR |
91 | |
92 | // These values can be overridden in the target configuration file. | |
93 | // The default values are appropriate for many 32-bit targets. | |
54c1bf78 BK |
94 | |
95 | #ifndef __glibcpp_char_traps | |
f3cd98c4 | 96 | # define __glibcpp_char_traps true |
54c1bf78 BK |
97 | #endif |
98 | #ifndef __glibcpp_short_traps | |
f3cd98c4 | 99 | # define __glibcpp_short_traps true |
54c1bf78 BK |
100 | #endif |
101 | #ifndef __glibcpp_int_traps | |
f3cd98c4 | 102 | # define __glibcpp_int_traps true |
54c1bf78 BK |
103 | #endif |
104 | #ifndef __glibcpp_long_traps | |
f3cd98c4 | 105 | # define __glibcpp_long_traps true |
54c1bf78 BK |
106 | #endif |
107 | #ifndef __glibcpp_wchar_t_traps | |
f3cd98c4 | 108 | # define __glibcpp_wchar_t_traps true |
54c1bf78 BK |
109 | #endif |
110 | #ifndef __glibcpp_long_long_traps | |
f3cd98c4 | 111 | # define __glibcpp_long_long_traps true |
54c1bf78 BK |
112 | #endif |
113 | ||
114 | // You should not need to define any macros below this point, unless | |
115 | // you have a machine with non-standard bit-widths. | |
116 | ||
117 | // These values are the minimums and maximums for standard data types | |
118 | // of common widths. | |
119 | ||
120 | #define __glibcpp_s8_max 127 | |
121 | #define __glibcpp_s8_min (-__glibcpp_s8_max - 1) | |
122 | #define __glibcpp_s8_digits 7 | |
123 | #define __glibcpp_s8_digits10 2 | |
124 | #define __glibcpp_u8_min 0U | |
125 | #define __glibcpp_u8_max (__glibcpp_s8_max * 2 + 1) | |
126 | #define __glibcpp_u8_digits 8 | |
127 | #define __glibcpp_u8_digits10 2 | |
128 | #define __glibcpp_s16_max 32767 | |
129 | #define __glibcpp_s16_min (-__glibcpp_s16_max - 1) | |
130 | #define __glibcpp_s16_digits 15 | |
131 | #define __glibcpp_s16_digits10 4 | |
132 | #define __glibcpp_u16_min 0U | |
133 | #define __glibcpp_u16_max (__glibcpp_s16_max * 2 + 1) | |
134 | #define __glibcpp_u16_digits 16 | |
135 | #define __glibcpp_u16_digits10 4 | |
136 | #define __glibcpp_s32_max 2147483647L | |
137 | #define __glibcpp_s32_min (-__glibcpp_s32_max - 1) | |
138 | #define __glibcpp_s32_digits 31 | |
139 | #define __glibcpp_s32_digits10 9 | |
140 | #define __glibcpp_u32_min 0UL | |
141 | #define __glibcpp_u32_max (__glibcpp_s32_max * 2U + 1) | |
142 | #define __glibcpp_u32_digits 32 | |
143 | #define __glibcpp_u32_digits10 9 | |
144 | #define __glibcpp_s64_max 9223372036854775807LL | |
145 | #define __glibcpp_s64_min (-__glibcpp_s64_max - 1) | |
146 | #define __glibcpp_s64_digits 63 | |
147 | #define __glibcpp_s64_digits10 18 | |
148 | #define __glibcpp_u64_min 0ULL | |
149 | #define __glibcpp_u64_max (__glibcpp_s64_max * 2ULL + 1) | |
150 | #define __glibcpp_u64_digits 64 | |
151 | #define __glibcpp_u64_digits10 19 | |
152 | ||
54c1bf78 | 153 | #define __glibcpp_f32_round_error 1.0F |
2559486f | 154 | #if __GCC_FLOAT_FORMAT__ == __IEEE_FORMAT__ |
2559486f GDR |
155 | # define __glibcpp_f32_is_iec559 true |
156 | #endif | |
2559486f GDR |
157 | #ifndef __glibcpp_f32_is_iec559 |
158 | # define __glibcpp_f32_is_iec559 false | |
159 | #endif | |
54c1bf78 | 160 | #define __glibcpp_f64_round_error 1.0 |
2559486f | 161 | #if __GCC_FLOAT_FORMAT__ == __IEEE_FORMAT__ |
2559486f GDR |
162 | # define __glibcpp_f64_is_iec559 true |
163 | #endif | |
2559486f GDR |
164 | #ifndef __glibcpp_f64_is_iec559 |
165 | # define __glibcpp_f64_is_iec559 false | |
166 | #endif | |
54c1bf78 | 167 | #define __glibcpp_f80_round_error 1.0L |
2559486f | 168 | #if __GCC_FLOAT_FORMAT__ == __IEEE_FORMAT__ |
2559486f GDR |
169 | # define __glibcpp_f80_is_iec559 true |
170 | #endif | |
2559486f GDR |
171 | #ifndef __glibcpp_f80_is_iec559 |
172 | # define __glibcpp_f80_is_iec559 false | |
173 | #endif | |
54c1bf78 | 174 | #define __glibcpp_f96_round_error 1.0L |
2559486f | 175 | #if __GCC_FLOAT_FORMAT__ == __IEEE_FORMAT__ |
2559486f GDR |
176 | # define __glibcpp_f96_is_iec559 true |
177 | #endif | |
54c1bf78 | 178 | #define __glibcpp_f128_round_error 1.0L |
2559486f | 179 | #if __GCC_FLOAT_FORMAT__ == __IEEE_FORMAT__ |
1472e41c | 180 | # define __glibcpp_f128_is_iec559 true |
2559486f | 181 | #endif |
2559486f GDR |
182 | #ifndef __glibcpp_f128_is_iec559 |
183 | # define __glibcpp_f128_is_iec559 false | |
184 | #endif | |
54c1bf78 BK |
185 | |
186 | // bool-specific hooks: | |
187 | // __glibcpp_bool_digits __glibcpp_int_traps __glibcpp_long_traps | |
188 | ||
54c1bf78 | 189 | #ifndef __glibcpp_bool_digits |
f3cd98c4 | 190 | # define __glibcpp_bool_digits 1 |
54c1bf78 BK |
191 | #endif |
192 | ||
193 | // char. | |
194 | ||
195 | #define __glibcpp_plain_char_traps true | |
196 | #define __glibcpp_signed_char_traps true | |
197 | #define __glibcpp_unsigned_char_traps true | |
198 | #ifndef __glibcpp_char_is_modulo | |
f3cd98c4 | 199 | # define __glibcpp_char_is_modulo true |
54c1bf78 BK |
200 | #endif |
201 | #ifndef __glibcpp_signed_char_is_modulo | |
f3cd98c4 | 202 | # define __glibcpp_signed_char_is_modulo true |
54c1bf78 | 203 | #endif |
585e661a | 204 | #if __CHAR_BIT__ == 8 |
f3cd98c4 GDR |
205 | # define __glibcpp_signed_char_min __glibcpp_s8_min |
206 | # define __glibcpp_signed_char_max __glibcpp_s8_max | |
207 | # define __glibcpp_signed_char_digits __glibcpp_s8_digits | |
208 | # define __glibcpp_signed_char_digits10 __glibcpp_s8_digits10 | |
209 | # define __glibcpp_unsigned_char_min __glibcpp_u8_min | |
210 | # define __glibcpp_unsigned_char_max __glibcpp_u8_max | |
211 | # define __glibcpp_unsigned_char_digits __glibcpp_u8_digits | |
212 | # define __glibcpp_unsigned_char_digits10 __glibcpp_u8_digits10 | |
585e661a | 213 | #elif __CHAR_BIT__ == 16 |
f3cd98c4 GDR |
214 | # define __glibcpp_signed_char_min __glibcpp_s16_min |
215 | # define __glibcpp_signed_char_max __glibcpp_s16_max | |
216 | # define __glibcpp_signed_char_digits __glibcpp_s16_digits | |
217 | # define __glibcpp_signed_char_digits10 __glibcpp_s16_digits10 | |
218 | # define __glibcpp_unsigned_char_min __glibcpp_u16_min | |
219 | # define __glibcpp_unsigned_char_max __glibcpp_u16_max | |
220 | # define __glibcpp_unsigned_char_digits __glibcpp_u16_digits | |
221 | # define __glibcpp_unsigned_char_digits10 __glibcpp_u16_digits10 | |
585e661a | 222 | #elif __CHAR_BIT__ == 32 |
f3cd98c4 GDR |
223 | # define __glibcpp_signed_char_min (signed char)__glibcpp_s32_min |
224 | # define __glibcpp_signed_char_max (signed char)__glibcpp_s32_max | |
225 | # define __glibcpp_signed_char_digits __glibcpp_s32_digits | |
226 | # define __glibcpp_signed_char_digits10 __glibcpp_s32_digits10 | |
227 | # define __glibcpp_unsigned_char_min (unsigned char)__glibcpp_u32_min | |
228 | # define __glibcpp_unsigned_char_max (unsigned char)__glibcpp_u32_max | |
229 | # define __glibcpp_unsigned_char_digits __glibcpp_u32_digits | |
230 | # define __glibcpp_unsigned_char_digits10 __glibcpp_u32_digits10 | |
585e661a | 231 | #elif __CHAR_BIT__ == 64 |
f3cd98c4 GDR |
232 | # define __glibcpp_signed_char_min (signed char)__glibcpp_s64_min |
233 | # define __glibcpp_signed_char_max (signed char)__glibcpp_s64_max | |
234 | # define __glibcpp_signed_char_digits __glibcpp_s64_digits | |
235 | # define __glibcpp_signed_char_digits10 __glibcpp_s64_digits10 | |
236 | # define __glibcpp_unsigned_char_min (unsigned char)__glibcpp_u64_min | |
237 | # define __glibcpp_unsigned_char_max (unsigned char)__glibcpp_u64_max | |
238 | # define __glibcpp_unsigned_char_digits __glibcpp_u64_digits | |
239 | # define __glibcpp_unsigned_char_digits10 __glibcpp_u64_digits10 | |
54c1bf78 BK |
240 | #else |
241 | // You must define these macros in the configuration file. | |
242 | #endif | |
243 | ||
244 | #if __glibcpp_plain_char_is_signed | |
f3cd98c4 GDR |
245 | # define __glibcpp_char_min (char)__glibcpp_signed_char_min |
246 | # define __glibcpp_char_max (char)__glibcpp_signed_char_max | |
247 | # define __glibcpp_char_digits __glibcpp_signed_char_digits | |
248 | # define __glibcpp_char_digits10 __glibcpp_signed_char_digits | |
54c1bf78 | 249 | #else |
f3cd98c4 GDR |
250 | # define __glibcpp_char_min (char)__glibcpp_unsigned_char_min |
251 | # define __glibcpp_char_max (char)__glibcpp_unsigned_char_max | |
252 | # define __glibcpp_char_digits __glibcpp_unsigned_char_digits | |
253 | # define __glibcpp_char_digits10 __glibcpp_unsigned_char_digits | |
54c1bf78 BK |
254 | #endif |
255 | ||
256 | // short | |
257 | ||
258 | #define __glibcpp_signed_short_traps true | |
259 | #define __glibcpp_unsigned_short_traps true | |
260 | #ifndef __glibcpp_signed_short_is_modulo | |
f3cd98c4 | 261 | # define __glibcpp_signed_short_is_modulo true |
54c1bf78 | 262 | #endif |
585e661a | 263 | #if __SHRT_BIT__ == 8 |
f3cd98c4 GDR |
264 | # define __glibcpp_signed_short_min __glibcpp_s8_min |
265 | # define __glibcpp_signed_short_max __glibcpp_s8_max | |
266 | # define __glibcpp_signed_short_digits __glibcpp_s8_digits | |
267 | # define __glibcpp_signed_short_digits10 __glibcpp_s8_digits10 | |
268 | # define __glibcpp_unsigned_short_min __glibcpp_u8_min | |
269 | # define __glibcpp_unsigned_short_max __glibcpp_u8_max | |
270 | # define __glibcpp_unsigned_short_digits __glibcpp_u8_digits | |
271 | # define __glibcpp_unsigned_short_digits10 __glibcpp_u8_digits10 | |
585e661a | 272 | #elif __SHRT_BIT__ == 16 |
f3cd98c4 GDR |
273 | # define __glibcpp_signed_short_min __glibcpp_s16_min |
274 | # define __glibcpp_signed_short_max __glibcpp_s16_max | |
275 | # define __glibcpp_signed_short_digits __glibcpp_s16_digits | |
276 | # define __glibcpp_signed_short_digits10 __glibcpp_s16_digits10 | |
277 | # define __glibcpp_unsigned_short_min __glibcpp_u16_min | |
278 | # define __glibcpp_unsigned_short_max __glibcpp_u16_max | |
279 | # define __glibcpp_unsigned_short_digits __glibcpp_u16_digits | |
280 | # define __glibcpp_unsigned_short_digits10 __glibcpp_u16_digits10 | |
585e661a | 281 | #elif __SHRT_BIT__ == 32 |
f3cd98c4 GDR |
282 | # define __glibcpp_signed_short_min (short)__glibcpp_s32_min |
283 | # define __glibcpp_signed_short_max (short)__glibcpp_s32_max | |
284 | # define __glibcpp_signed_short_digits __glibcpp_s32_digits | |
285 | # define __glibcpp_signed_short_digits10 __glibcpp_s32_digits10 | |
286 | # define __glibcpp_unsigned_short_min (unsigned short)__glibcpp_u32_min | |
287 | # define __glibcpp_unsigned_short_max (unsigned short)__glibcpp_u32_max | |
288 | # define __glibcpp_unsigned_short_digits __glibcpp_u32_digits | |
289 | # define __glibcpp_unsigned_short_digits10 __glibcpp_u32_digits10 | |
585e661a | 290 | #elif __SHRT_BIT__ == 64 |
f3cd98c4 GDR |
291 | # define __glibcpp_signed_short_min (short)__glibcpp_s64_min |
292 | # define __glibcpp_signed_short_max (short)__glibcpp_s64_max | |
293 | # define __glibcpp_signed_short_digits __glibcpp_s64_digits | |
294 | # define __glibcpp_signed_short_digits10 __glibcpp_s64_digits10 | |
295 | # define __glibcpp_unsigned_short_min (unsigned short)__glibcpp_u64_min | |
296 | # define __glibcpp_unsigned_short_max (unsigned short)__glibcpp_u64_max | |
297 | # define __glibcpp_unsigned_short_digits __glibcpp_u64_digits | |
298 | # define __glibcpp_unsigned_short_digits10 __glibcpp_u64_digits10 | |
54c1bf78 BK |
299 | #else |
300 | // You must define these macros in the configuration file. | |
301 | #endif | |
302 | ||
303 | // int | |
304 | ||
305 | #define __glibcpp_signed_int_traps true | |
306 | #define __glibcpp_unsigned_int_traps true | |
307 | #ifndef __glibcpp_signed_int_is_modulo | |
f3cd98c4 | 308 | # define __glibcpp_signed_int_is_modulo true |
54c1bf78 | 309 | #endif |
585e661a | 310 | #if __INT_BIT__ == 8 |
f3cd98c4 GDR |
311 | # define __glibcpp_signed_int_min __glibcpp_s8_min |
312 | # define __glibcpp_signed_int_max __glibcpp_s8_max | |
313 | # define __glibcpp_signed_int_digits __glibcpp_s8_digits | |
314 | # define __glibcpp_signed_int_digits10 __glibcpp_s8_digits10 | |
315 | # define __glibcpp_unsigned_int_min __glibcpp_u8_min | |
316 | # define __glibcpp_unsigned_int_max __glibcpp_u8_max | |
317 | # define __glibcpp_unsigned_int_digits __glibcpp_u8_digits | |
318 | # define __glibcpp_unsigned_int_digits10 __glibcpp_u8_digits10 | |
585e661a | 319 | #elif __INT_BIT__ == 16 |
f3cd98c4 GDR |
320 | # define __glibcpp_signed_int_min __glibcpp_s16_min |
321 | # define __glibcpp_signed_int_max __glibcpp_s16_max | |
322 | # define __glibcpp_signed_int_digits __glibcpp_s16_digits | |
323 | # define __glibcpp_signed_int_digits10 __glibcpp_s16_digits10 | |
324 | # define __glibcpp_unsigned_int_min __glibcpp_u16_min | |
325 | # define __glibcpp_unsigned_int_max __glibcpp_u16_max | |
326 | # define __glibcpp_unsigned_int_digits __glibcpp_u16_digits | |
327 | # define __glibcpp_unsigned_int_digits10 __glibcpp_u16_digits10 | |
585e661a | 328 | #elif __INT_BIT__ == 32 |
f3cd98c4 GDR |
329 | # define __glibcpp_signed_int_min (int)__glibcpp_s32_min |
330 | # define __glibcpp_signed_int_max (int)__glibcpp_s32_max | |
331 | # define __glibcpp_signed_int_digits __glibcpp_s32_digits | |
332 | # define __glibcpp_signed_int_digits10 __glibcpp_s32_digits10 | |
333 | # define __glibcpp_unsigned_int_min (unsigned)__glibcpp_u32_min | |
334 | # define __glibcpp_unsigned_int_max (unsigned)__glibcpp_u32_max | |
335 | # define __glibcpp_unsigned_int_digits __glibcpp_u32_digits | |
336 | # define __glibcpp_unsigned_int_digits10 __glibcpp_u32_digits10 | |
585e661a | 337 | #elif __INT_BIT__ == 64 |
f3cd98c4 GDR |
338 | # define __glibcpp_signed_int_min (int)__glibcpp_s64_min |
339 | # define __glibcpp_signed_int_max (int)__glibcpp_s64_max | |
340 | # define __glibcpp_signed_int_digits __glibcpp_s64_digits | |
341 | # define __glibcpp_signed_int_digits10 __glibcpp_s64_digits10 | |
342 | # define __glibcpp_unsigned_int_min (unsigned)__glibcpp_u64_min | |
343 | # define __glibcpp_unsigned_int_max (unsigned)__glibcpp_u64_max | |
344 | # define __glibcpp_unsigned_int_digits __glibcpp_u64_digits | |
345 | # define __glibcpp_unsigned_int_digits10 __glibcpp_u64_digits10 | |
54c1bf78 BK |
346 | #else |
347 | // You must define these macros in the configuration file. | |
348 | #endif | |
349 | ||
350 | // long | |
351 | ||
352 | #define __glibcpp_signed_long_traps true | |
353 | #define __glibcpp_unsigned_long_traps true | |
354 | #ifndef __glibcpp_signed_long_is_modulo | |
f3cd98c4 | 355 | # define __glibcpp_signed_long_is_modulo true |
54c1bf78 | 356 | #endif |
585e661a | 357 | #if __LONG_BIT__ == 8 |
f3cd98c4 GDR |
358 | # define __glibcpp_signed_long_min __glibcpp_s8_min |
359 | # define __glibcpp_signed_long_max __glibcpp_s8_max | |
360 | # define __glibcpp_signed_long_digits __glibcpp_s8_digits | |
361 | # define __glibcpp_signed_long_digits10 __glibcpp_s8_digits10 | |
362 | # define __glibcpp_unsigned_long_min __glibcpp_u8_min | |
363 | # define __glibcpp_unsigned_long_max __glibcpp_u8_max | |
364 | # define __glibcpp_unsigned_long_digits __glibcpp_u8_digits | |
365 | # define __glibcpp_unsigned_long_digits10 __glibcpp_u8_digits10 | |
585e661a | 366 | #elif __LONG_BIT__ == 16 |
f3cd98c4 GDR |
367 | # define __glibcpp_signed_long_min __glibcpp_s16_min |
368 | # define __glibcpp_signed_long_max __glibcpp_s16_max | |
369 | # define __glibcpp_signed_long_digits __glibcpp_s16_digits | |
370 | # define __glibcpp_signed_long_digits10 __glibcpp_s16_digits10 | |
371 | # define __glibcpp_unsigned_long_min __glibcpp_u16_min | |
372 | # define __glibcpp_unsigned_long_max __glibcpp_u16_max | |
373 | # define __glibcpp_unsigned_long_digits __glibcpp_u16_digits | |
374 | # define __glibcpp_unsigned_long_digits10 __glibcpp_u16_digits10 | |
585e661a | 375 | #elif __LONG_BIT__ == 32 |
f3cd98c4 GDR |
376 | # define __glibcpp_signed_long_min __glibcpp_s32_min |
377 | # define __glibcpp_signed_long_max __glibcpp_s32_max | |
378 | # define __glibcpp_signed_long_digits __glibcpp_s32_digits | |
379 | # define __glibcpp_signed_long_digits10 __glibcpp_s32_digits10 | |
380 | # define __glibcpp_unsigned_long_min __glibcpp_u32_min | |
381 | # define __glibcpp_unsigned_long_max __glibcpp_u32_max | |
382 | # define __glibcpp_unsigned_long_digits __glibcpp_u32_digits | |
383 | # define __glibcpp_unsigned_long_digits10 __glibcpp_u32_digits10 | |
585e661a | 384 | #elif __LONG_BIT__ == 64 |
f3cd98c4 GDR |
385 | # define __glibcpp_signed_long_min (long)__glibcpp_s64_min |
386 | # define __glibcpp_signed_long_max (long)__glibcpp_s64_max | |
387 | # define __glibcpp_signed_long_digits __glibcpp_s64_digits | |
388 | # define __glibcpp_signed_long_digits10 __glibcpp_s64_digits10 | |
389 | # define __glibcpp_unsigned_long_min (unsigned long)__glibcpp_u64_min | |
390 | # define __glibcpp_unsigned_long_max (unsigned long)__glibcpp_u64_max | |
391 | # define __glibcpp_unsigned_long_digits __glibcpp_u64_digits | |
392 | # define __glibcpp_unsigned_long_digits10 __glibcpp_u64_digits10 | |
54c1bf78 BK |
393 | #else |
394 | // You must define these macros in the configuration file. | |
395 | #endif | |
396 | ||
397 | // long long | |
398 | ||
399 | #define __glibcpp_signed_long_long_traps true | |
400 | #define __glibcpp_signed_long_long_traps true | |
401 | #ifndef __glibcpp_signed_long_long_is_modulo | |
f3cd98c4 | 402 | # define __glibcpp_signed_long_long_is_modulo true |
54c1bf78 | 403 | #endif |
585e661a | 404 | #if __LONG_LONG_BIT__ == 8 |
f3cd98c4 GDR |
405 | # define __glibcpp_signed_long_long_min __glibcpp_s8_min |
406 | # define __glibcpp_signed_long_long_max __glibcpp_s8_max | |
407 | # define __glibcpp_signed_long_long_digits __glibcpp_s8_digits | |
408 | # define __glibcpp_signed_long_long_digits10 __glibcpp_s8_digits10 | |
409 | # define __glibcpp_unsigned_long_long_min __glibcpp_u8_min | |
410 | # define __glibcpp_unsigned_long_long_max __glibcpp_u8_max | |
411 | # define __glibcpp_unsigned_long_long_digits __glibcpp_u8_digits | |
412 | # define __glibcpp_unsigned_long_long_digits10 __glibcpp_u8_digits10 | |
585e661a | 413 | #elif __LONG_LONG_BIT__ == 16 |
f3cd98c4 GDR |
414 | # define __glibcpp_signed_long_long_min __glibcpp_s16_min |
415 | # define __glibcpp_signed_long_long_max __glibcpp_s16_max | |
416 | # define __glibcpp_signed_long_long_digits __glibcpp_s16_digits | |
417 | # define __glibcpp_signed_long_long_digits10 __glibcpp_s16_digits10 | |
418 | # define __glibcpp_unsigned_long_long_min __glibcpp_u16_min | |
419 | # define __glibcpp_unsigned_long_long_max __glibcpp_u16_max | |
420 | # define __glibcpp_unsigned_long_long_digits __glibcpp_u16_digits | |
421 | # define __glibcpp_unsigned_long_long_digits10 __glibcpp_u16_digits10 | |
585e661a | 422 | #elif __LONG_LONG_BIT__ == 32 |
f3cd98c4 GDR |
423 | # define __glibcpp_signed_long_long_min __glibcpp_s32_min |
424 | # define __glibcpp_signed_long_long_max __glibcpp_s32_max | |
425 | # define __glibcpp_signed_long_long_digits __glibcpp_s32_digits | |
426 | # define __glibcpp_signed_long_long_digits10 __glibcpp_s32_digits10 | |
427 | # define __glibcpp_unsigned_long_long_min __glibcpp_u32_min | |
428 | # define __glibcpp_unsigned_long_long_max __glibcpp_u32_max | |
429 | # define __glibcpp_unsigned_long_long_digits __glibcpp_u32_digits | |
430 | # define __glibcpp_unsigned_long_long_digits10 __glibcpp_u32_digits10 | |
585e661a | 431 | #elif __LONG_LONG_BIT__ == 64 |
f3cd98c4 GDR |
432 | # define __glibcpp_signed_long_long_min __glibcpp_s64_min |
433 | # define __glibcpp_signed_long_long_max __glibcpp_s64_max | |
434 | # define __glibcpp_signed_long_long_digits __glibcpp_s64_digits | |
435 | # define __glibcpp_signed_long_long_digits10 __glibcpp_s64_digits10 | |
436 | # define __glibcpp_signed_long_long_traps true | |
437 | # define __glibcpp_unsigned_long_long_min __glibcpp_u64_min | |
438 | # define __glibcpp_unsigned_long_long_max __glibcpp_u64_max | |
439 | # define __glibcpp_unsigned_long_long_digits __glibcpp_u64_digits | |
440 | # define __glibcpp_unsigned_long_long_digits10 __glibcpp_u64_digits10 | |
441 | # define __glibcpp_unsigned_long_long_traps true | |
54c1bf78 BK |
442 | #else |
443 | // You must define these macros in the configuration file. | |
444 | #endif | |
445 | ||
446 | // wchar_t | |
447 | ||
448 | #define __glibcpp_wchar_t_traps true | |
449 | #ifndef __glibcpp_wchar_t_is_modulo | |
f3cd98c4 | 450 | # define __glibcpp_wchar_t_is_modulo true |
54c1bf78 BK |
451 | #endif |
452 | #if __glibcpp_wchar_t_is_signed | |
585e661a | 453 | # if __WCHAR_BIT__ == 8 |
f3cd98c4 GDR |
454 | # define __glibcpp_wchar_t_min __glibcpp_s8_min |
455 | # define __glibcpp_wchar_t_max __glibcpp_s8_max | |
456 | # define __glibcpp_wchar_t_digits __glibcpp_s8_digits | |
457 | # define __glibcpp_wchar_t_digits10 __glibcpp_s8_digits10 | |
585e661a | 458 | # elif __WCHAR_BIT__ == 16 |
f3cd98c4 GDR |
459 | # define __glibcpp_wchar_t_min __glibcpp_s16_min |
460 | # define __glibcpp_wchar_t_max __glibcpp_s16_max | |
461 | # define __glibcpp_wchar_t_digits __glibcpp_s16_digits | |
462 | # define __glibcpp_wchar_t_digits10 __glibcpp_s16_digits10 | |
585e661a | 463 | # elif __WCHAR_BIT__ == 32 |
f3cd98c4 GDR |
464 | # define __glibcpp_wchar_t_min (wchar_t)__glibcpp_s32_min |
465 | # define __glibcpp_wchar_t_max (wchar_t)__glibcpp_s32_max | |
466 | # define __glibcpp_wchar_t_digits __glibcpp_s32_digits | |
467 | # define __glibcpp_wchar_t_digits10 __glibcpp_s32_digits10 | |
585e661a | 468 | # elif __WCHAR_BIT__ == 64 |
f3cd98c4 GDR |
469 | # define __glibcpp_wchar_t_min (wchar_t)__glibcpp_s64_min |
470 | # define __glibcpp_wchar_t_max (wchar_t)__glibcpp_s64_max | |
471 | # define __glibcpp_wchar_t_digits __glibcpp_s64_digits | |
472 | # define __glibcpp_wchar_t_digits10 __glibcpp_s64_digits10 | |
473 | # else | |
54c1bf78 | 474 | // You must define these macros in the configuration file. |
f3cd98c4 | 475 | # endif |
54c1bf78 | 476 | #else |
585e661a | 477 | # if __WCHAR_BIT__ == 8 |
f3cd98c4 GDR |
478 | # define __glibcpp_wchar_t_min __glibcpp_u8_min |
479 | # define __glibcpp_wchar_t_max __glibcpp_u8_max | |
480 | # define __glibcpp_wchar_t_digits __glibcpp_u8_digits | |
481 | # define __glibcpp_wchar_t_digits10 __glibcpp_u8_digits10 | |
585e661a | 482 | # elif __WCHAR_BIT__ == 16 |
f3cd98c4 GDR |
483 | # define __glibcpp_wchar_t_min __glibcpp_u16_min |
484 | # define __glibcpp_wchar_t_max __glibcpp_u16_max | |
485 | # define __glibcpp_wchar_t_digits __glibcpp_u16_digits | |
486 | # define __glibcpp_wchar_t_digits10 __glibcpp_u16_digits10 | |
585e661a | 487 | # elif __WCHAR_BIT__ == 32 |
f3cd98c4 GDR |
488 | # define __glibcpp_wchar_t_min (wchar_t)__glibcpp_u32_min |
489 | # define __glibcpp_wchar_t_max (wchar_t)__glibcpp_u32_max | |
490 | # define __glibcpp_wchar_t_digits __glibcpp_u32_digits | |
491 | # define __glibcpp_wchar_t_digits10 __glibcpp_u32_digits10 | |
585e661a | 492 | # elif __WCHAR_BIT__ == 64 |
f3cd98c4 GDR |
493 | # define __glibcpp_wchar_t_min (wchar_t)__glibcpp_u64_min |
494 | # define __glibcpp_wchar_t_max (wchar_t)__glibcpp_u64_max | |
495 | # define __glibcpp_wchar_t_digits __glibcpp_u64_digits | |
496 | # define __glibcpp_wchar_t_digits10 __glibcpp_u64_digits10 | |
497 | # else | |
54c1bf78 | 498 | // You must define these macros in the configuration file. |
f3cd98c4 | 499 | # endif |
54c1bf78 BK |
500 | #endif |
501 | ||
502 | // float | |
503 | // | |
504 | ||
585e661a | 505 | #if __FLOAT_BIT__ == 32 |
f3cd98c4 | 506 | # define __glibcpp_float_round_error __glibcpp_f32_round_error |
2559486f | 507 | # define __glibcpp_float_is_iec559 __glibcpp_f32_is_iec559 |
585e661a | 508 | #elif __FLOAT_BIT__ == 64 |
f3cd98c4 | 509 | # define __glibcpp_float_round_error __glibcpp_f64_round_error |
2559486f | 510 | # define __glibcpp_float_is_iec559 __glibcpp_f64_is_iec559 |
585e661a | 511 | #elif __FLOAT_BIT__ == 80 |
f3cd98c4 | 512 | # define __glibcpp_float_round_error __glibcpp_f80_round_error |
2559486f | 513 | # define __glibcpp_float_is_iec559 __glibcpp_f80_is_iec559 |
54c1bf78 BK |
514 | #else |
515 | // You must define these macros in the configuration file. | |
516 | #endif | |
517 | ||
2559486f | 518 | // Default values. Should be overriden in configuration files if necessary. |
54c1bf78 | 519 | |
54c1bf78 | 520 | #ifndef __glibcpp_float_has_denorm_loss |
f3cd98c4 | 521 | # define __glibcpp_float_has_denorm_loss false |
54c1bf78 BK |
522 | #endif |
523 | ||
2559486f GDR |
524 | #ifndef __glibcpp_float_is_bounded |
525 | # define __glibcpp_float_is_bounded true | |
54c1bf78 BK |
526 | #endif |
527 | ||
528 | #ifndef __glibcpp_float_is_iec559 | |
f3cd98c4 | 529 | # define __glibcpp_float_is_iec559 false |
54c1bf78 BK |
530 | #endif |
531 | ||
54c1bf78 | 532 | #ifndef __glibcpp_float_is_modulo |
f3cd98c4 | 533 | # define __glibcpp_float_is_modulo false |
54c1bf78 BK |
534 | #endif |
535 | ||
536 | #ifndef __glibcpp_float_traps | |
f3cd98c4 | 537 | # define __glibcpp_float_traps false |
54c1bf78 BK |
538 | #endif |
539 | ||
540 | #ifndef __glibcpp_float_tinyness_before | |
f3cd98c4 | 541 | # define __glibcpp_float_tinyness_before false |
54c1bf78 BK |
542 | #endif |
543 | ||
544 | #ifndef __glibcpp_float_round_style | |
f3cd98c4 | 545 | # define __glibcpp_float_round_style round_toward_zero |
54c1bf78 BK |
546 | #endif |
547 | ||
548 | // double | |
549 | ||
585e661a | 550 | #if __DOUBLE_BIT__ == 32 |
f3cd98c4 | 551 | # define __glibcpp_double_round_error __glibcpp_f32_round_error |
2559486f | 552 | # define __glibcpp_double_is_iec559 __glibcpp_f32_is_iec559 |
585e661a | 553 | #elif __DOUBLE_BIT__ == 64 |
f3cd98c4 | 554 | # define __glibcpp_double_round_error __glibcpp_f64_round_error |
2559486f | 555 | # define __glibcpp_double_is_iec559 __glibcpp_f64_is_iec559 |
585e661a | 556 | #elif __DOUBLE_BIT__ == 80 |
f3cd98c4 | 557 | # define __glibcpp_double_round_error __glibcpp_f80_round_error |
2559486f | 558 | # define __glibcpp_double_is_iec559 __glibcpp_f80_is_iec559 |
54c1bf78 BK |
559 | #else |
560 | // You must define these macros in the configuration file. | |
561 | #endif | |
562 | ||
2559486f | 563 | // Default values. Should be overriden in configuration files if necessary. |
54c1bf78 | 564 | |
54c1bf78 | 565 | #ifndef __glibcpp_double_has_denorm_loss |
f3cd98c4 | 566 | # define __glibcpp_double_has_denorm_loss false |
54c1bf78 BK |
567 | #endif |
568 | ||
54c1bf78 | 569 | #ifndef __glibcpp_double_is_iec559 |
f3cd98c4 | 570 | # define __glibcpp_double_is_iec559 false |
54c1bf78 BK |
571 | #endif |
572 | ||
573 | #ifndef __glibcpp_double_is_bounded | |
f3cd98c4 | 574 | # define __glibcpp_double_is_bounded true |
54c1bf78 BK |
575 | #endif |
576 | ||
577 | #ifndef __glibcpp_double_is_modulo | |
f3cd98c4 | 578 | # define __glibcpp_double_is_modulo false |
54c1bf78 BK |
579 | #endif |
580 | ||
581 | #ifndef __glibcpp_double_traps | |
f3cd98c4 | 582 | # define __glibcpp_double_traps false |
54c1bf78 BK |
583 | #endif |
584 | ||
585 | #ifndef __glibcpp_double_tinyness_before | |
f3cd98c4 | 586 | # define __glibcpp_double_tinyness_before false |
54c1bf78 BK |
587 | #endif |
588 | ||
589 | #ifndef __glibcpp_double_round_style | |
f3cd98c4 | 590 | # define __glibcpp_double_round_style round_toward_zero |
54c1bf78 BK |
591 | #endif |
592 | ||
593 | // long double | |
594 | ||
585e661a | 595 | #if __LONG_DOUBLE_BIT__ == 32 |
f3cd98c4 | 596 | # define __glibcpp_long_double_round_error __glibcpp_f32_round_error |
2559486f | 597 | # define __glibcpp_long_double_is_iec559 __glibcpp_f32_is_iec559 |
585e661a | 598 | #elif __LONG_DOUBLE_BIT__ == 64 |
f3cd98c4 | 599 | # define __glibcpp_long_double_round_error __glibcpp_f64_round_error |
2559486f | 600 | # define __glibcpp_long_double_is_iec559 __glibcpp_f64_is_iec559 |
585e661a | 601 | #elif __LONG_DOUBLE_BIT__ == 80 |
f3cd98c4 | 602 | # define __glibcpp_long_double_round_error __glibcpp_f80_round_error |
2559486f | 603 | # define __glibcpp_long_double_is_iec559 __glibcpp_f80_is_iec559 |
585e661a | 604 | #elif __LONG_DOUBLE_BIT__ == 96 |
f3cd98c4 | 605 | # define __glibcpp_long_double_round_error __glibcpp_f96_round_error |
2559486f | 606 | # define __glibcpp_long_double_is_iec559 __glibcpp_f96_is_iec559 |
585e661a | 607 | #elif __LONG_DOUBLE_BIT__ == 128 |
f3cd98c4 | 608 | # define __glibcpp_long_double_round_error __glibcpp_f128_round_error |
2559486f | 609 | # define __glibcpp_long_double_is_iec559 __glibcpp_f128_is_iec559 |
54c1bf78 BK |
610 | #else |
611 | // You must define these macros in the configuration file. | |
612 | #endif | |
613 | ||
2559486f | 614 | // Default values. Should be overriden in configuration files if necessary. |
54c1bf78 | 615 | |
54c1bf78 | 616 | #ifndef __glibcpp_long_double_has_denorm_loss |
f3cd98c4 | 617 | # define __glibcpp_long_double_has_denorm_loss false |
54c1bf78 BK |
618 | #endif |
619 | ||
54c1bf78 | 620 | #ifndef __glibcpp_long_double_is_iec559 |
f3cd98c4 | 621 | # define __glibcpp_long_double_is_iec559 false |
54c1bf78 BK |
622 | #endif |
623 | ||
624 | #ifndef __glibcpp_long_double_is_bounded | |
f3cd98c4 | 625 | # define __glibcpp_long_double_is_bounded true |
54c1bf78 BK |
626 | #endif |
627 | ||
628 | #ifndef __glibcpp_long_double_is_modulo | |
f3cd98c4 | 629 | # define __glibcpp_long_double_is_modulo false |
54c1bf78 BK |
630 | #endif |
631 | ||
632 | #ifndef __glibcpp_long_double_traps | |
f3cd98c4 | 633 | # define __glibcpp_long_double_traps false |
54c1bf78 BK |
634 | #endif |
635 | ||
636 | #ifndef __glibcpp_long_double_tinyness_before | |
f3cd98c4 | 637 | # define __glibcpp_long_double_tinyness_before false |
725dc051 | 638 | #endif |
54c1bf78 BK |
639 | |
640 | #ifndef __glibcpp_long_double_round_style | |
f3cd98c4 | 641 | # define __glibcpp_long_double_round_style round_toward_zero |
54c1bf78 BK |
642 | #endif |
643 | ||
644 | ||
645 | namespace std | |
646 | { | |
2559486f GDR |
647 | // This is better handled by the compiler, but we do it here for the |
648 | // time being. (We're just second-guessing something the compiler | |
649 | // knows about better than we do.) -- Gaby | |
650 | typedef unsigned char __glibcpp_byte; | |
651 | #define __glibcpp_word_bits 32 | |
585e661a | 652 | #if __CHAR_BIT__ == __glibcpp_word_bits |
2559486f | 653 | # define __glibcpp_word unsigned char |
585e661a | 654 | #elif __SHRT_BIT__ == __glibcpp_word_bits |
2559486f | 655 | # define __glibcpp_word unsigned short |
585e661a | 656 | #elif __INT_BIT__ == __glibcpp_word_bits |
2559486f | 657 | # define __glibcpp_word unsigned int |
585e661a | 658 | #elif __LONG_BIT__ == __glibcpp_word_bits |
2559486f GDR |
659 | # define __glibcpp_word unsigned long |
660 | #endif | |
661 | ||
662 | // Define storage types for the single, double and extended floating | |
663 | // point data types. Maybe we could avoid the conditional #defines by | |
664 | // using the aligned_storage<> extension. -- Gaby | |
665 | typedef const | |
585e661a | 666 | #if __FLOAT_BIT__ % __glibcpp_word_bits == 0 |
2559486f GDR |
667 | __glibcpp_word __float_storage[sizeof (float) / sizeof (__glibcpp_word)] |
668 | #else | |
669 | __glibcpp_byte __float_storage[sizeof (float)] | |
670 | #endif | |
671 | __attribute__((__aligned__(__alignof__(float)))); | |
672 | ||
673 | typedef const | |
585e661a | 674 | #if __DOUBLE_BIT__ % __glibcpp_word_bits == 0 |
2559486f GDR |
675 | __glibcpp_word __double_storage[sizeof (double) / sizeof (__glibcpp_word)] |
676 | #else | |
677 | __glibcpp_byte __double_storage[sizeof (double)] | |
678 | #endif | |
679 | __attribute__((__aligned__(__alignof__(double)))); | |
680 | ||
681 | typedef const | |
585e661a | 682 | #if __LONG_DOUBLE_BIT__ % __glibcpp_word_bits == 0 |
2559486f GDR |
683 | __glibcpp_word __long_double_storage[sizeof (long double) / sizeof (__glibcpp_word)] |
684 | #else | |
685 | __glibcpp_byte __long_double_storage[sizeof (long double)] | |
686 | #endif | |
687 | __attribute__((__aligned__(__alignof__(long double)))); | |
688 | ||
54c1bf78 BK |
689 | enum float_round_style |
690 | { | |
691 | round_indeterminate = -1, | |
692 | round_toward_zero = 0, | |
693 | round_to_nearest = 1, | |
694 | round_toward_infinity = 2, | |
695 | round_toward_neg_infinity = 3 | |
696 | }; | |
697 | ||
698 | enum float_denorm_style | |
699 | { | |
700 | denorm_indeterminate = -1, | |
701 | denorm_absent = 0, | |
702 | denorm_present = 1 | |
703 | }; | |
704 | ||
705 | // | |
706 | // The primary class traits | |
707 | // | |
84979344 BK |
708 | struct __numeric_limits_base |
709 | { | |
710 | static const bool is_specialized = false; | |
711 | ||
712 | static const int digits = 0; | |
713 | static const int digits10 = 0; | |
714 | static const bool is_signed = false; | |
715 | static const bool is_integer = false; | |
716 | static const bool is_exact = false; | |
717 | static const int radix = 0; | |
718 | ||
719 | static const int min_exponent = 0; | |
720 | static const int min_exponent10 = 0; | |
721 | static const int max_exponent = 0; | |
722 | static const int max_exponent10 = 0; | |
723 | ||
724 | static const bool has_infinity = false; | |
725 | static const bool has_quiet_NaN = false; | |
726 | static const bool has_signaling_NaN = false; | |
727 | static const float_denorm_style has_denorm = denorm_absent; | |
728 | static const bool has_denorm_loss = false; | |
729 | ||
730 | static const bool is_iec559 = false; | |
731 | static const bool is_bounded = false; | |
732 | static const bool is_modulo = false; | |
733 | ||
734 | static const bool traps = false; | |
735 | static const bool tinyness_before = false; | |
736 | static const float_round_style round_style = round_toward_zero; | |
737 | }; | |
738 | ||
54c1bf78 | 739 | template<typename _Tp> |
84979344 | 740 | struct numeric_limits : public __numeric_limits_base |
54c1bf78 | 741 | { |
54c1bf78 BK |
742 | static _Tp min() throw() { return static_cast<_Tp>(0); } |
743 | static _Tp max() throw() { return static_cast<_Tp>(0); } | |
54c1bf78 BK |
744 | static _Tp epsilon() throw() { return static_cast<_Tp>(0); } |
745 | static _Tp round_error() throw() { return static_cast<_Tp>(0); } | |
54c1bf78 BK |
746 | static _Tp infinity() throw() { return static_cast<_Tp>(0); } |
747 | static _Tp quiet_NaN() throw() { return static_cast<_Tp>(0); } | |
748 | static _Tp signaling_NaN() throw() { return static_cast<_Tp>(0); } | |
749 | static _Tp denorm_min() throw() { return static_cast<_Tp>(0); } | |
54c1bf78 BK |
750 | }; |
751 | ||
54c1bf78 | 752 | // Now there follow 15 explicit specializations. Yes, 15. Make sure |
84979344 | 753 | // you get the count right. |
54c1bf78 BK |
754 | template<> |
755 | struct numeric_limits<bool> | |
756 | { | |
757 | static const bool is_specialized = true; | |
758 | ||
759 | static bool min() throw() | |
760 | { return false; } | |
761 | ||
762 | static bool max() throw() | |
763 | { return true; } | |
764 | ||
765 | static const int digits = __glibcpp_bool_digits; | |
766 | static const int digits10 = 0; | |
767 | static const bool is_signed = false; | |
768 | static const bool is_integer = true; | |
769 | static const bool is_exact = true; | |
770 | static const int radix = 2; | |
771 | static bool epsilon() throw() | |
772 | { return false; } | |
773 | static bool round_error() throw() | |
774 | { return false; } | |
775 | ||
776 | static const int min_exponent = 0; | |
777 | static const int min_exponent10 = 0; | |
778 | static const int max_exponent = 0; | |
779 | static const int max_exponent10 = 0; | |
780 | ||
781 | static const bool has_infinity = false; | |
782 | static const bool has_quiet_NaN = false; | |
783 | static const bool has_signaling_NaN = false; | |
784 | static const float_denorm_style has_denorm = denorm_absent; | |
785 | static const bool has_denorm_loss = false; | |
786 | ||
787 | static bool infinity() throw() | |
788 | { return false; } | |
789 | static bool quiet_NaN() throw() | |
790 | { return false; } | |
791 | static bool signaling_NaN() throw() | |
792 | { return false; } | |
793 | static bool denorm_min() throw() | |
794 | { return false; } | |
795 | ||
a9bb75a7 | 796 | static const bool is_iec559 = false; |
54c1bf78 | 797 | static const bool is_bounded = true; |
a9bb75a7 | 798 | static const bool is_modulo = false; |
54c1bf78 BK |
799 | |
800 | // It is not clear what it means for a boolean type to trap. | |
801 | // This is a DR on the LWG issue list. Here, I use integer | |
802 | // promotion semantics. | |
803 | static const bool traps = __glibcpp_signed_int_traps | |
804 | || __glibcpp_signed_long_traps; | |
805 | static const bool tinyness_before = false; | |
806 | static const float_round_style round_style = round_toward_zero; | |
807 | }; | |
808 | ||
809 | #undef __glibcpp_bool_digits | |
810 | ||
811 | template<> | |
812 | struct numeric_limits<char> | |
813 | { | |
814 | static const bool is_specialized = true; | |
815 | ||
816 | static char min() throw() | |
817 | { return __glibcpp_char_min; } | |
818 | static char max() throw() | |
819 | { return __glibcpp_char_max; } | |
820 | ||
821 | static const int digits = __glibcpp_char_digits; | |
822 | static const int digits10 = __glibcpp_char_digits10; | |
823 | static const bool is_signed = __glibcpp_plain_char_is_signed; | |
824 | static const bool is_integer = true; | |
825 | static const bool is_exact = true; | |
826 | static const int radix = 2; | |
827 | static char epsilon() throw() | |
828 | { return char(); } | |
829 | static char round_error() throw() | |
830 | { return char(); } | |
831 | ||
832 | static const int min_exponent = 0; | |
833 | static const int min_exponent10 = 0; | |
834 | static const int max_exponent = 0; | |
835 | static const int max_exponent10 = 0; | |
836 | ||
837 | static const bool has_infinity = false; | |
838 | static const bool has_quiet_NaN = false; | |
839 | static const bool has_signaling_NaN = false; | |
840 | static const float_denorm_style has_denorm = denorm_absent; | |
841 | static const bool has_denorm_loss = false; | |
842 | ||
843 | static char infinity() throw() | |
844 | { return char(); } | |
845 | static char quiet_NaN() throw() | |
846 | { return char(); } | |
847 | static char signaling_NaN() throw() | |
848 | { return char(); } | |
849 | static char denorm_min() throw() | |
850 | { return static_cast<char>(0); } | |
851 | ||
852 | static const bool is_iec559 = false; | |
853 | static const bool is_bounded = true; | |
854 | static const bool is_modulo = __glibcpp_char_is_modulo; | |
855 | ||
856 | static const bool traps = __glibcpp_char_traps; | |
857 | static const bool tinyness_before = false; | |
858 | static const float_round_style round_style = round_toward_zero; | |
859 | }; | |
860 | ||
861 | #undef __glibcpp_char_min | |
862 | #undef __glibcpp_char_max | |
863 | #undef __glibcpp_char_digits | |
864 | #undef __glibcpp_char_digits10 | |
865 | #undef __glibcpp_char_is_signed | |
866 | #undef __glibcpp_char_is_modulo | |
867 | #undef __glibcpp_char_traps | |
868 | ||
869 | ||
870 | ||
871 | template<> | |
872 | struct numeric_limits<signed char> | |
873 | { | |
874 | static const bool is_specialized = true; | |
875 | ||
876 | static signed char min() throw() | |
877 | { return __glibcpp_signed_char_min; } | |
878 | static signed char max() throw() | |
879 | { return __glibcpp_signed_char_max; } | |
880 | ||
881 | static const int digits = __glibcpp_signed_char_digits; | |
882 | static const int digits10 = __glibcpp_signed_char_digits10; | |
883 | static const bool is_signed = true; | |
884 | static const bool is_integer = true; | |
885 | static const bool is_exact = true; | |
886 | static const int radix = 2; | |
887 | static signed char epsilon() throw() | |
888 | { return 0; } | |
889 | static signed char round_error() throw() | |
890 | { return 0; } | |
891 | ||
892 | static const int min_exponent = 0; | |
893 | static const int min_exponent10 = 0; | |
894 | static const int max_exponent = 0; | |
895 | static const int max_exponent10 = 0; | |
896 | ||
897 | static const bool has_infinity = false; | |
898 | static const bool has_quiet_NaN = false; | |
899 | static const bool has_signaling_NaN = false; | |
900 | static const float_denorm_style has_denorm = denorm_absent; | |
901 | static const bool has_denorm_loss = false; | |
902 | ||
903 | static signed char infinity() throw() | |
904 | { return static_cast<signed char>(0); } | |
905 | static signed char quiet_NaN() throw() | |
906 | { return static_cast<signed char>(0); } | |
907 | static signed char signaling_NaN() throw() | |
908 | { return static_cast<signed char>(0); } | |
909 | static signed char denorm_min() throw() | |
910 | { return static_cast<signed char>(0); } | |
911 | ||
912 | static const bool is_iec559 = false; | |
913 | static const bool is_bounded = true; | |
914 | static const bool is_modulo = __glibcpp_signed_char_is_modulo; | |
915 | ||
916 | static const bool traps = __glibcpp_signed_char_traps; | |
917 | static const bool tinyness_before = false; | |
918 | static const float_round_style round_style = round_toward_zero; | |
919 | }; | |
920 | ||
921 | #undef __glibcpp_signed_char_min | |
922 | #undef __glibcpp_signed_char_max | |
923 | #undef __glibcpp_signed_char_digits | |
924 | #undef __glibcpp_signed_char_digits10 | |
925 | #undef __glibcpp_signed_char_is_modulo | |
926 | #undef __glibcpp_signed_char_traps | |
927 | ||
928 | template<> | |
929 | struct numeric_limits<unsigned char> | |
930 | { | |
931 | static const bool is_specialized = true; | |
932 | ||
933 | static unsigned char min() throw() | |
934 | { return 0; } | |
935 | static unsigned char max() throw() | |
936 | { return __glibcpp_unsigned_char_max; } | |
937 | ||
938 | static const int digits = __glibcpp_unsigned_char_digits; | |
939 | static const int digits10 = __glibcpp_unsigned_char_digits10; | |
940 | static const bool is_signed = false; | |
941 | static const bool is_integer = true; | |
942 | static const bool is_exact = true; | |
943 | static const int radix = 2; | |
944 | static unsigned char epsilon() throw() | |
945 | { return 0; } | |
946 | static unsigned char round_error() throw() | |
947 | { return 0; } | |
948 | ||
949 | static const int min_exponent = 0; | |
950 | static const int min_exponent10 = 0; | |
951 | static const int max_exponent = 0; | |
952 | static const int max_exponent10 = 0; | |
953 | ||
954 | static const bool has_infinity = false; | |
955 | static const bool has_quiet_NaN = false; | |
956 | static const bool has_signaling_NaN = false; | |
957 | static const float_denorm_style has_denorm = denorm_absent; | |
958 | static const bool has_denorm_loss = false; | |
959 | ||
960 | static unsigned char infinity() throw() | |
961 | { return static_cast<unsigned char>(0); } | |
962 | static unsigned char quiet_NaN() throw() | |
963 | { return static_cast<unsigned char>(0); } | |
964 | static unsigned char signaling_NaN() throw() | |
965 | { return static_cast<unsigned char>(0); } | |
966 | static unsigned char denorm_min() throw() | |
967 | { return static_cast<unsigned char>(0); } | |
968 | ||
969 | static const bool is_iec559 = false; | |
970 | static const bool is_bounded = true; | |
971 | static const bool is_modulo = true; | |
972 | ||
973 | static const bool traps = __glibcpp_unsigned_char_traps; | |
974 | static const bool tinyness_before = false; | |
975 | static const float_round_style round_style = round_toward_zero; | |
976 | }; | |
977 | ||
978 | #undef __glibcpp_unsigned_char_max | |
979 | #undef __glibcpp_unsigned_char_digits | |
980 | #undef __glibcpp_unsigned_char_digits10 | |
981 | #undef __glibcpp_unsigned_char_traps | |
982 | ||
983 | template<> | |
984 | struct numeric_limits<wchar_t> | |
985 | { | |
986 | static const bool is_specialized = true; | |
987 | ||
988 | static wchar_t min() throw() | |
989 | { return __glibcpp_wchar_t_min; } | |
990 | static wchar_t max() throw() | |
991 | { return __glibcpp_wchar_t_max; } | |
992 | ||
993 | static const int digits = __glibcpp_wchar_t_digits; | |
994 | static const int digits10 = __glibcpp_wchar_t_digits10; | |
995 | static const bool is_signed = __glibcpp_wchar_t_is_signed; | |
996 | static const bool is_integer = true; | |
997 | static const bool is_exact = true; | |
998 | static const int radix = 2; | |
999 | static wchar_t epsilon() throw() | |
1000 | { return 0; } | |
1001 | static wchar_t round_error() throw() | |
1002 | { return 0; } | |
1003 | ||
1004 | static const int min_exponent = 0; | |
1005 | static const int min_exponent10 = 0; | |
1006 | static const int max_exponent = 0; | |
1007 | static const int max_exponent10 = 0; | |
1008 | ||
1009 | static const bool has_infinity = false; | |
1010 | static const bool has_quiet_NaN = false; | |
1011 | static const bool has_signaling_NaN = false; | |
1012 | static const float_denorm_style has_denorm = denorm_absent; | |
1013 | static const bool has_denorm_loss = false; | |
1014 | ||
1015 | static wchar_t infinity() throw() | |
1016 | { return wchar_t(); } | |
1017 | static wchar_t quiet_NaN() throw() | |
1018 | { return wchar_t(); } | |
1019 | static wchar_t signaling_NaN() throw() | |
1020 | { return wchar_t(); } | |
1021 | static wchar_t denorm_min() throw() | |
1022 | { return wchar_t(); } | |
1023 | ||
1024 | static const bool is_iec559 = false; | |
1025 | static const bool is_bounded = true; | |
1026 | static const bool is_modulo = __glibcpp_wchar_t_is_modulo; | |
1027 | ||
1028 | static const bool traps = __glibcpp_wchar_t_traps; | |
1029 | static const bool tinyness_before = false; | |
1030 | static const float_round_style round_style = round_toward_zero; | |
1031 | }; | |
1032 | ||
1033 | #undef __glibcpp_wchar_t_min | |
1034 | #undef __glibcpp_wchar_t_max | |
1035 | #undef __glibcpp_wchar_t_digits | |
1036 | #undef __glibcpp_wchar_t_digits10 | |
1037 | #undef __glibcpp_wchar_t_is_signed | |
1038 | #undef __glibcpp_wchar_t_is_modulo | |
1039 | #undef __glibcpp_wchar_t_traps | |
1040 | ||
1041 | template<> | |
1042 | struct numeric_limits<short> | |
1043 | { | |
1044 | static const bool is_specialized = true; | |
1045 | ||
1046 | static short min() throw() | |
1047 | { return __glibcpp_signed_short_min; } | |
1048 | static short max() throw() | |
1049 | { return __glibcpp_signed_short_max; } | |
1050 | ||
1051 | static const int digits = __glibcpp_signed_short_digits; | |
1052 | static const int digits10 = __glibcpp_signed_short_digits10; | |
1053 | static const bool is_signed = true; | |
1054 | static const bool is_integer = true; | |
1055 | static const bool is_exact = true; | |
1056 | static const int radix = 2; | |
1057 | static short epsilon() throw() | |
1058 | { return 0; } | |
1059 | static short round_error() throw() | |
1060 | { return 0; } | |
1061 | ||
1062 | static const int min_exponent = 0; | |
1063 | static const int min_exponent10 = 0; | |
1064 | static const int max_exponent = 0; | |
1065 | static const int max_exponent10 = 0; | |
1066 | ||
1067 | static const bool has_infinity = false; | |
1068 | static const bool has_quiet_NaN = false; | |
1069 | static const bool has_signaling_NaN = false; | |
1070 | static const float_denorm_style has_denorm = denorm_absent; | |
1071 | static const bool has_denorm_loss = false; | |
1072 | ||
1073 | static short infinity() throw() | |
1074 | { return short(); } | |
1075 | static short quiet_NaN() throw() | |
1076 | { return short(); } | |
1077 | static short signaling_NaN() throw() | |
1078 | { return short(); } | |
1079 | static short denorm_min() throw() | |
1080 | { return short(); } | |
1081 | ||
1082 | static const bool is_iec559 = true; | |
1083 | static const bool is_bounded = true; | |
1084 | static const bool is_modulo = __glibcpp_signed_short_is_modulo; | |
1085 | ||
1086 | static const bool traps = __glibcpp_signed_short_traps; | |
1087 | static const bool tinyness_before = false; | |
1088 | static const float_round_style round_style = round_toward_zero; | |
1089 | }; | |
1090 | ||
1091 | #undef __glibcpp_signed_short_min | |
1092 | #undef __glibcpp_signed_short_max | |
1093 | #undef __glibcpp_signed_short_digits | |
1094 | #undef __glibcpp_signed_short_digits10 | |
1095 | #undef __glibcpp_signed_short_is_modulo | |
1096 | #undef __glibcpp_signed_short_traps | |
1097 | ||
1098 | template<> | |
1099 | struct numeric_limits<unsigned short> | |
1100 | { | |
1101 | static const bool is_specialized = true; | |
1102 | ||
1103 | static unsigned short min() throw() | |
1104 | { return 0; } | |
1105 | static unsigned short max() throw() | |
1106 | { return __glibcpp_unsigned_short_max; } | |
1107 | ||
1108 | static const int digits = __glibcpp_unsigned_short_digits; | |
1109 | static const int digits10 = __glibcpp_unsigned_short_digits10; | |
1110 | static const bool is_signed = false; | |
1111 | static const bool is_integer = true; | |
1112 | static const bool is_exact = true; | |
1113 | static const int radix = 2; | |
1114 | static unsigned short epsilon() throw() | |
1115 | { return 0; } | |
1116 | static unsigned short round_error() throw() | |
1117 | { return 0; } | |
1118 | ||
1119 | static const int min_exponent = 0; | |
1120 | static const int min_exponent10 = 0; | |
1121 | static const int max_exponent = 0; | |
1122 | static const int max_exponent10 = 0; | |
1123 | ||
1124 | static const bool has_infinity = false; | |
1125 | static const bool has_quiet_NaN = false; | |
1126 | static const bool has_signaling_NaN = false; | |
1127 | static const float_denorm_style has_denorm = denorm_absent; | |
1128 | static const bool has_denorm_loss = false; | |
1129 | ||
1130 | static unsigned short infinity() throw() | |
1131 | { return static_cast<unsigned short>(0); } | |
1132 | static unsigned short quiet_NaN() throw() | |
1133 | { return static_cast<unsigned short>(0); } | |
1134 | static unsigned short signaling_NaN() throw() | |
1135 | { return static_cast<unsigned short>(0); } | |
1136 | static unsigned short denorm_min() throw() | |
1137 | { return static_cast<unsigned short>(0); } | |
1138 | ||
1139 | static const bool is_iec559 = true; | |
1140 | static const bool is_bounded = true; | |
1141 | static const bool is_modulo = true; | |
1142 | ||
1143 | static const bool traps = __glibcpp_unsigned_short_traps; | |
1144 | static const bool tinyness_before = false; | |
1145 | static const float_round_style round_style = round_toward_zero; | |
1146 | }; | |
1147 | ||
1148 | #undef __glibcpp_unsigned_short_max | |
1149 | #undef __glibcpp_unsigned_short_digits | |
1150 | #undef __glibcpp_unsigned_short_digits10 | |
1151 | #undef __glibcpp_unsigned_short_traps | |
1152 | ||
1153 | template<> | |
1154 | struct numeric_limits<int> | |
1155 | { | |
1156 | static const bool is_specialized = true; | |
1157 | ||
1158 | static int min() throw() | |
1159 | { return __glibcpp_signed_int_min; } | |
1160 | static int max() throw() | |
1161 | { return __glibcpp_signed_int_max; } | |
1162 | ||
1163 | static const int digits = __glibcpp_signed_int_digits; | |
1164 | static const int digits10 = __glibcpp_signed_int_digits10; | |
1165 | static const bool is_signed = true; | |
1166 | static const bool is_integer = true; | |
1167 | static const bool is_exact = true; | |
1168 | static const int radix = 2; | |
1169 | static int epsilon() throw() | |
1170 | { return 0; } | |
1171 | static int round_error() throw() | |
1172 | { return 0; } | |
1173 | ||
1174 | static const int min_exponent = 0; | |
1175 | static const int min_exponent10 = 0; | |
1176 | static const int max_exponent = 0; | |
1177 | static const int max_exponent10 = 0; | |
1178 | ||
1179 | static const bool has_infinity = false; | |
1180 | static const bool has_quiet_NaN = false; | |
1181 | static const bool has_signaling_NaN = false; | |
1182 | static const float_denorm_style has_denorm = denorm_absent; | |
1183 | static const bool has_denorm_loss = false; | |
1184 | ||
1185 | static int infinity() throw() | |
1186 | { return static_cast<int>(0); } | |
1187 | static int quiet_NaN() throw() | |
1188 | { return static_cast<int>(0); } | |
1189 | static int signaling_NaN() throw() | |
1190 | { return static_cast<int>(0); } | |
1191 | static int denorm_min() throw() | |
1192 | { return static_cast<int>(0); } | |
1193 | ||
1194 | static const bool is_iec559 = true; | |
1195 | static const bool is_bounded = true; | |
1196 | static const bool is_modulo = __glibcpp_signed_int_is_modulo; | |
1197 | ||
1198 | static const bool traps = __glibcpp_signed_int_traps; | |
1199 | static const bool tinyness_before = false; | |
1200 | static const float_round_style round_style = round_toward_zero; | |
1201 | }; | |
1202 | ||
1203 | #undef __glibcpp_signed_int_min | |
1204 | #undef __glibcpp_signed_int_max | |
1205 | #undef __glibcpp_signed_int_digits | |
1206 | #undef __glibcpp_signed_int_digits10 | |
1207 | #undef __glibcpp_signed_int_is_modulo | |
1208 | #undef __glibcpp_signed_int_traps | |
1209 | ||
1210 | template<> | |
1211 | struct numeric_limits<unsigned int> | |
1212 | { | |
1213 | static const bool is_specialized = true; | |
1214 | ||
1215 | static unsigned int min() throw() | |
1216 | { return 0; } | |
1217 | static unsigned int max() throw() | |
1218 | { return __glibcpp_unsigned_int_max; } | |
1219 | ||
1220 | static const int digits = __glibcpp_unsigned_int_digits; | |
1221 | static const int digits10 = __glibcpp_unsigned_int_digits10; | |
1222 | static const bool is_signed = false; | |
1223 | static const bool is_integer = true; | |
1224 | static const bool is_exact = true; | |
1225 | static const int radix = 2; | |
1226 | static unsigned int epsilon() throw() | |
1227 | { return 0; } | |
1228 | static unsigned int round_error() throw() | |
1229 | { return 0; } | |
1230 | ||
1231 | static const int min_exponent = 0; | |
1232 | static const int min_exponent10 = 0; | |
1233 | static const int max_exponent = 0; | |
1234 | static const int max_exponent10 = 0; | |
1235 | ||
1236 | static const bool has_infinity = false; | |
1237 | static const bool has_quiet_NaN = false; | |
1238 | static const bool has_signaling_NaN = false; | |
1239 | static const float_denorm_style has_denorm = denorm_absent; | |
1240 | static const bool has_denorm_loss = false; | |
1241 | ||
1242 | static unsigned int infinity() throw() | |
1243 | { return static_cast<unsigned int>(0); } | |
1244 | static unsigned int quiet_NaN() throw() | |
1245 | { return static_cast<unsigned int>(0); } | |
1246 | static unsigned int signaling_NaN() throw() | |
1247 | { return static_cast<unsigned int>(0); } | |
1248 | static unsigned int denorm_min() throw() | |
1249 | { return static_cast<unsigned int>(0); } | |
1250 | ||
1251 | static const bool is_iec559 = true; | |
1252 | static const bool is_bounded = true; | |
1253 | static const bool is_modulo = true; | |
1254 | ||
1255 | static const bool traps = __glibcpp_unsigned_int_traps; | |
1256 | static const bool tinyness_before = false; | |
1257 | static const float_round_style round_style = round_toward_zero; | |
1258 | }; | |
1259 | ||
1260 | #undef __glibcpp_unsigned_int_max | |
1261 | #undef __glibcpp_unsigned_int_digits | |
1262 | #undef __glibcpp_unsigned_int_digits10 | |
1263 | #undef __glibcpp_unsigned_int_traps | |
1264 | ||
1265 | template<> | |
1266 | struct numeric_limits<long> | |
1267 | { | |
1268 | static const bool is_specialized = true; | |
1269 | ||
1270 | static long min() throw() | |
1271 | { return __glibcpp_signed_long_min; } | |
1272 | static long max() throw() | |
1273 | { return __glibcpp_signed_long_max; } | |
1274 | ||
1275 | static const int digits = __glibcpp_signed_long_digits; | |
1276 | static const int digits10 = __glibcpp_signed_long_digits10; | |
1277 | static const bool is_signed = true; | |
1278 | static const bool is_integer = true; | |
1279 | static const bool is_exact = true; | |
1280 | static const int radix = 2; | |
1281 | static long epsilon() throw() | |
1282 | { return 0; } | |
1283 | static long round_error() throw() | |
1284 | { return 0; } | |
1285 | ||
1286 | static const int min_exponent = 0; | |
1287 | static const int min_exponent10 = 0; | |
1288 | static const int max_exponent = 0; | |
1289 | static const int max_exponent10 = 0; | |
1290 | ||
1291 | static const bool has_infinity = false; | |
1292 | static const bool has_quiet_NaN = false; | |
1293 | static const bool has_signaling_NaN = false; | |
1294 | static const float_denorm_style has_denorm = denorm_absent; | |
1295 | static const bool has_denorm_loss = false; | |
1296 | ||
1297 | static long infinity() throw() | |
1298 | { return static_cast<long>(0); } | |
1299 | static long quiet_NaN() throw() | |
1300 | { return static_cast<long>(0); } | |
1301 | static long signaling_NaN() throw() | |
1302 | { return static_cast<long>(0); } | |
1303 | static long denorm_min() throw() | |
1304 | { return static_cast<long>(0); } | |
1305 | ||
1306 | static const bool is_iec559 = true; | |
1307 | static const bool is_bounded = true; | |
1308 | static const bool is_modulo = __glibcpp_signed_long_is_modulo; | |
1309 | ||
1310 | static const bool traps = __glibcpp_signed_long_traps; | |
1311 | static const bool tinyness_before = false; | |
1312 | static const float_round_style round_style = round_toward_zero; | |
1313 | }; | |
1314 | ||
1315 | #undef __glibcpp_signed_long_min | |
1316 | #undef __glibcpp_signed_long_max | |
1317 | #undef __glibcpp_signed_long_digits | |
1318 | #undef __glibcpp_signed_long_digits10 | |
1319 | #undef __glibcpp_signed_long_is_modulo | |
1320 | #undef __glibcpp_signed_long_traps | |
1321 | ||
1322 | template<> | |
1323 | struct numeric_limits<unsigned long> | |
1324 | { | |
1325 | static const bool is_specialized = true; | |
1326 | ||
1327 | static unsigned long min() throw() | |
1328 | { return 0; } | |
1329 | static unsigned long max() throw() | |
1330 | { return __glibcpp_unsigned_long_max; } | |
1331 | ||
1332 | static const int digits = __glibcpp_unsigned_long_digits; | |
1333 | static const int digits10 = __glibcpp_unsigned_long_digits10; | |
1334 | static const bool is_signed = false; | |
1335 | static const bool is_integer = true; | |
1336 | static const bool is_exact = true; | |
1337 | static const int radix = 2; | |
1338 | static unsigned long epsilon() throw() | |
1339 | { return 0; } | |
1340 | static unsigned long round_error() throw() | |
1341 | { return 0; } | |
1342 | ||
1343 | static const int min_exponent = 0; | |
1344 | static const int min_exponent10 = 0; | |
1345 | static const int max_exponent = 0; | |
1346 | static const int max_exponent10 = 0; | |
1347 | ||
1348 | static const bool has_infinity = false; | |
1349 | static const bool has_quiet_NaN = false; | |
1350 | static const bool has_signaling_NaN = false; | |
1351 | static const float_denorm_style has_denorm = denorm_absent; | |
1352 | static const bool has_denorm_loss = false; | |
1353 | ||
1354 | static unsigned long infinity() throw() | |
1355 | { return static_cast<unsigned long>(0); } | |
1356 | static unsigned long quiet_NaN() throw() | |
1357 | { return static_cast<unsigned long>(0); } | |
1358 | static unsigned long signaling_NaN() throw() | |
1359 | { return static_cast<unsigned long>(0); } | |
1360 | static unsigned long denorm_min() throw() | |
1361 | { return static_cast<unsigned long>(0); } | |
1362 | ||
1363 | static const bool is_iec559 = true; | |
1364 | static const bool is_bounded = true; | |
1365 | static const bool is_modulo = true; | |
1366 | ||
1367 | static const bool traps = __glibcpp_unsigned_long_traps; | |
1368 | static const bool tinyness_before = false; | |
1369 | static const float_round_style round_style = round_toward_zero; | |
1370 | }; | |
1371 | ||
1372 | #undef __glibcpp_unsigned_long_max | |
1373 | #undef __glibcpp_unsigned_long_digits | |
1374 | #undef __glibcpp_unsigned_long_digits10 | |
1375 | #undef __glibcpp_unsigned_long_traps | |
1376 | ||
1377 | template<> | |
1378 | struct numeric_limits<long long> | |
1379 | { | |
1380 | static const bool is_specialized = true; | |
1381 | ||
1382 | static long long min() throw() | |
1383 | { return __glibcpp_signed_long_long_min; } | |
1384 | static long long max() throw() | |
1385 | { return __glibcpp_signed_long_long_max; } | |
1386 | ||
1387 | static const int digits = __glibcpp_signed_long_long_digits; | |
1388 | static const int digits10 = __glibcpp_signed_long_long_digits10; | |
1389 | static const bool is_signed = true; | |
1390 | static const bool is_integer = true; | |
1391 | static const bool is_exact = true; | |
1392 | static const int radix = 2; | |
1393 | static long long epsilon() throw() | |
1394 | { return 0; } | |
1395 | static long long round_error() throw() | |
1396 | { return 0; } | |
1397 | ||
1398 | static const int min_exponent = 0; | |
1399 | static const int min_exponent10 = 0; | |
1400 | static const int max_exponent = 0; | |
1401 | static const int max_exponent10 = 0; | |
1402 | ||
1403 | static const bool has_infinity = false; | |
1404 | static const bool has_quiet_NaN = false; | |
1405 | static const bool has_signaling_NaN = false; | |
1406 | static const float_denorm_style has_denorm = denorm_absent; | |
1407 | static const bool has_denorm_loss = false; | |
1408 | ||
1409 | static long long infinity() throw() | |
1410 | { return static_cast<long long>(0); } | |
1411 | static long long quiet_NaN() throw() | |
1412 | { return static_cast<long long>(0); } | |
1413 | static long long signaling_NaN() throw() | |
1414 | { return static_cast<long long>(0); } | |
1415 | static long long denorm_min() throw() | |
1416 | { return static_cast<long long>(0); } | |
1417 | ||
1418 | static const bool is_iec559 = true; | |
1419 | static const bool is_bounded = true; | |
1420 | static const bool is_modulo = __glibcpp_signed_long_long_is_modulo; | |
1421 | ||
1422 | static const bool traps = __glibcpp_signed_long_long_traps; | |
1423 | static const bool tinyness_before = false; | |
1424 | static const float_round_style round_style = round_toward_zero; | |
1425 | }; | |
1426 | ||
1427 | #undef __glibcpp_signed_long_long_min | |
1428 | #undef __glibcpp_signed_long_long_max | |
1429 | #undef __glibcpp_signed_long_long_digits | |
1430 | #undef __glibcpp_signed_long_long_digits10 | |
1431 | #undef __glibcpp_signed_long_long_is_modulo | |
1432 | #undef __glibcpp_signed_long_long_traps | |
1433 | ||
1434 | template<> | |
1435 | struct numeric_limits<unsigned long long> | |
1436 | { | |
1437 | static const bool is_specialized = true; | |
1438 | ||
1439 | static unsigned long long min() throw() | |
1440 | { return 0; } | |
1441 | static unsigned long long max() throw() | |
1442 | { return __glibcpp_unsigned_long_long_max; } | |
1443 | ||
1444 | static const int digits = __glibcpp_unsigned_long_long_digits; | |
1445 | static const int digits10 = __glibcpp_unsigned_long_long_digits10; | |
1446 | static const bool is_signed = false; | |
1447 | static const bool is_integer = true; | |
1448 | static const bool is_exact = true; | |
1449 | static const int radix = 2; | |
1450 | static unsigned long long epsilon() throw() | |
1451 | { return 0; } | |
1452 | static unsigned long long round_error() throw() | |
1453 | { return 0; } | |
1454 | ||
1455 | static const int min_exponent = 0; | |
1456 | static const int min_exponent10 = 0; | |
1457 | static const int max_exponent = 0; | |
1458 | static const int max_exponent10 = 0; | |
1459 | ||
1460 | static const bool has_infinity = false; | |
1461 | static const bool has_quiet_NaN = false; | |
1462 | static const bool has_signaling_NaN = false; | |
1463 | static const float_denorm_style has_denorm = denorm_absent; | |
1464 | static const bool has_denorm_loss = false; | |
1465 | ||
1466 | static unsigned long long infinity() throw() | |
1467 | { return static_cast<unsigned long long>(0); } | |
1468 | static unsigned long long quiet_NaN() throw() | |
1469 | { return static_cast<unsigned long long>(0); } | |
1470 | static unsigned long long signaling_NaN() throw() | |
1471 | { return static_cast<unsigned long long>(0); } | |
1472 | static unsigned long long denorm_min() throw() | |
1473 | { return static_cast<unsigned long long>(0); } | |
1474 | ||
1475 | static const bool is_iec559 = true; | |
1476 | static const bool is_bounded = true; | |
1477 | static const bool is_modulo = true; | |
1478 | ||
1479 | static const bool traps = true; | |
1480 | static const bool tinyness_before = false; | |
1481 | static const float_round_style round_style = round_toward_zero; | |
1482 | }; | |
1483 | ||
1484 | #undef __glibcpp_unsigned_long_long_max | |
1485 | #undef __glibcpp_unsigned_long_long_digits | |
1486 | #undef __glibcpp_unsigned_long_long_digits10 | |
1487 | #undef __glibcpp_unsigned_long_long_traps | |
1488 | ||
1489 | template<> | |
1490 | struct numeric_limits<float> | |
1491 | { | |
1492 | static const bool is_specialized = true; | |
1493 | ||
1494 | static float min() throw() | |
5e25fa22 | 1495 | { return __FLT_MIN__; } |
54c1bf78 | 1496 | static float max() throw() |
5e25fa22 | 1497 | { return __FLT_MAX__; } |
54c1bf78 | 1498 | |
5e25fa22 RH |
1499 | static const int digits = __FLT_MANT_DIG__; |
1500 | static const int digits10 = __FLT_DIG__; | |
54c1bf78 BK |
1501 | static const bool is_signed = true; |
1502 | static const bool is_integer = false; | |
1503 | static const bool is_exact = false; | |
5e25fa22 | 1504 | static const int radix = __FLT_RADIX__; |
54c1bf78 | 1505 | static float epsilon() throw() |
5e25fa22 | 1506 | { return __FLT_EPSILON__; } |
54c1bf78 BK |
1507 | static float round_error() throw() |
1508 | { return __glibcpp_float_round_error; } | |
1509 | ||
5e25fa22 RH |
1510 | static const int min_exponent = __FLT_MIN_EXP__; |
1511 | static const int min_exponent10 = __FLT_MIN_10_EXP__; | |
1512 | static const int max_exponent = __FLT_MAX_EXP__; | |
1513 | static const int max_exponent10 = __FLT_MAX_10_EXP__; | |
54c1bf78 | 1514 | |
65e32b88 RH |
1515 | static const bool has_infinity |
1516 | = __builtin_huge_valf () / 2 == __builtin_huge_valf (); | |
1472e41c RH |
1517 | static const bool has_quiet_NaN |
1518 | = __builtin_nanf ("") != __builtin_nanf (""); | |
1519 | static const bool has_signaling_NaN = has_quiet_NaN; | |
ac520ec9 RH |
1520 | static const float_denorm_style has_denorm |
1521 | = __FLT_DENORM_MIN__ ? denorm_present : denorm_absent; | |
54c1bf78 BK |
1522 | static const bool has_denorm_loss = __glibcpp_float_has_denorm_loss; |
1523 | ||
1524 | static float infinity() throw() | |
65e32b88 | 1525 | { return __builtin_huge_valf (); } |
54c1bf78 | 1526 | static float quiet_NaN() throw() |
1472e41c | 1527 | { return __builtin_nanf (""); } |
54c1bf78 | 1528 | static float signaling_NaN() throw() |
1472e41c | 1529 | { return __builtin_nansf (""); } |
54c1bf78 | 1530 | static float denorm_min() throw() |
ac520ec9 | 1531 | { return __FLT_DENORM_MIN__; } |
54c1bf78 BK |
1532 | |
1533 | static const bool is_iec559 = __glibcpp_float_is_iec559; | |
1534 | static const bool is_bounded = __glibcpp_float_is_bounded; | |
1535 | static const bool is_modulo = __glibcpp_float_is_modulo; | |
1536 | ||
1537 | static const bool traps = __glibcpp_float_traps; | |
1538 | static const bool tinyness_before = __glibcpp_float_tinyness_before; | |
1539 | static const float_round_style round_style = __glibcpp_float_round_style; | |
1540 | }; | |
1541 | ||
54c1bf78 | 1542 | #undef __glibcpp_float_round_error |
54c1bf78 | 1543 | #undef __glibcpp_float_has_denorm_loss |
54c1bf78 BK |
1544 | #undef __glibcpp_float_is_iec559 |
1545 | #undef __glibcpp_float_is_bounded | |
1546 | #undef __glibcpp_float_is_modulo | |
1547 | #undef __glibcpp_float_traps | |
1548 | #undef __glibcpp_float_tinyness_before | |
1549 | #undef __glibcpp_float_round_style | |
1550 | ||
1551 | template<> | |
1552 | struct numeric_limits<double> | |
1553 | { | |
1554 | static const bool is_specialized = true; | |
1555 | ||
1556 | static double min() throw() | |
5e25fa22 | 1557 | { return __DBL_MIN__; } |
54c1bf78 | 1558 | static double max() throw() |
5e25fa22 | 1559 | { return __DBL_MAX__; } |
54c1bf78 | 1560 | |
5e25fa22 RH |
1561 | static const int digits = __DBL_MANT_DIG__; |
1562 | static const int digits10 = __DBL_DIG__; | |
54c1bf78 BK |
1563 | static const bool is_signed = true; |
1564 | static const bool is_integer = false; | |
1565 | static const bool is_exact = false; | |
5e25fa22 | 1566 | static const int radix = __FLT_RADIX__; |
54c1bf78 | 1567 | static double epsilon() throw() |
5e25fa22 | 1568 | { return __DBL_EPSILON__; } |
54c1bf78 BK |
1569 | static double round_error() throw() |
1570 | { return __glibcpp_double_round_error; } | |
1571 | ||
5e25fa22 RH |
1572 | static const int min_exponent = __DBL_MIN_EXP__; |
1573 | static const int min_exponent10 = __DBL_MIN_10_EXP__; | |
1574 | static const int max_exponent = __DBL_MAX_EXP__; | |
1575 | static const int max_exponent10 = __DBL_MAX_10_EXP__; | |
54c1bf78 | 1576 | |
65e32b88 RH |
1577 | static const bool has_infinity |
1578 | = __builtin_huge_val () / 2 == __builtin_huge_val (); | |
1472e41c RH |
1579 | static const bool has_quiet_NaN |
1580 | = __builtin_nan ("") != __builtin_nan (""); | |
1581 | static const bool has_signaling_NaN = has_quiet_NaN; | |
ac520ec9 RH |
1582 | static const float_denorm_style has_denorm |
1583 | = __DBL_DENORM_MIN__ ? denorm_present : denorm_absent; | |
54c1bf78 BK |
1584 | static const bool has_denorm_loss = __glibcpp_double_has_denorm_loss; |
1585 | ||
1586 | static double infinity() throw() | |
65e32b88 | 1587 | { return __builtin_huge_val(); } |
54c1bf78 | 1588 | static double quiet_NaN() throw() |
1472e41c | 1589 | { return __builtin_nan (""); } |
54c1bf78 | 1590 | static double signaling_NaN() throw() |
1472e41c | 1591 | { return __builtin_nans (""); } |
54c1bf78 | 1592 | static double denorm_min() throw() |
ac520ec9 | 1593 | { return __DBL_DENORM_MIN__; } |
54c1bf78 BK |
1594 | |
1595 | static const bool is_iec559 = __glibcpp_double_is_iec559; | |
1596 | static const bool is_bounded = __glibcpp_double_is_bounded; | |
1597 | static const bool is_modulo = __glibcpp_double_is_modulo; | |
1598 | ||
1599 | static const bool traps = __glibcpp_double_traps; | |
1600 | static const bool tinyness_before = __glibcpp_double_tinyness_before; | |
1601 | static const float_round_style round_style = | |
1602 | __glibcpp_double_round_style; | |
1603 | }; | |
1604 | ||
54c1bf78 | 1605 | #undef __glibcpp_double_round_error |
54c1bf78 | 1606 | #undef __glibcpp_double_has_denorm_loss |
54c1bf78 BK |
1607 | #undef __glibcpp_double_is_iec559 |
1608 | #undef __glibcpp_double_is_bounded | |
1609 | #undef __glibcpp_double_is_modulo | |
1610 | #undef __glibcpp_double_traps | |
1611 | #undef __glibcpp_double_tinyness_before | |
1612 | #undef __glibcpp_double_round_style | |
1613 | ||
1614 | ||
1615 | template<> | |
1616 | struct numeric_limits<long double> | |
1617 | { | |
1618 | static const bool is_specialized = true; | |
1619 | ||
1620 | static long double min() throw() | |
5e25fa22 | 1621 | { return __LDBL_MIN__; } |
54c1bf78 | 1622 | static long double max() throw() |
5e25fa22 | 1623 | { return __LDBL_MAX__; } |
54c1bf78 | 1624 | |
5e25fa22 RH |
1625 | static const int digits = __LDBL_MANT_DIG__; |
1626 | static const int digits10 = __LDBL_DIG__; | |
54c1bf78 BK |
1627 | static const bool is_signed = true; |
1628 | static const bool is_integer = false; | |
1629 | static const bool is_exact = false; | |
5e25fa22 | 1630 | static const int radix = __FLT_RADIX__; |
54c1bf78 | 1631 | static long double epsilon() throw() |
5e25fa22 | 1632 | { return __LDBL_EPSILON__; } |
54c1bf78 BK |
1633 | static long double round_error() throw() |
1634 | { return __glibcpp_long_double_round_error; } | |
1635 | ||
5e25fa22 RH |
1636 | static const int min_exponent = __LDBL_MIN_EXP__; |
1637 | static const int min_exponent10 = __LDBL_MIN_10_EXP__; | |
1638 | static const int max_exponent = __LDBL_MAX_EXP__; | |
1639 | static const int max_exponent10 = __LDBL_MAX_10_EXP__; | |
54c1bf78 | 1640 | |
65e32b88 RH |
1641 | static const bool has_infinity |
1642 | = __builtin_huge_vall () / 2 == __builtin_huge_vall (); | |
1472e41c RH |
1643 | static const bool has_quiet_NaN |
1644 | = __builtin_nanl ("") != __builtin_nanl (""); | |
1645 | static const bool has_signaling_NaN = has_quiet_NaN; | |
ac520ec9 RH |
1646 | static const float_denorm_style has_denorm |
1647 | = __LDBL_DENORM_MIN__ ? denorm_present : denorm_absent; | |
1648 | static const bool has_denorm_loss | |
1649 | = __glibcpp_long_double_has_denorm_loss; | |
54c1bf78 BK |
1650 | |
1651 | static long double infinity() throw() | |
65e32b88 | 1652 | { return __builtin_huge_vall (); } |
54c1bf78 | 1653 | static long double quiet_NaN() throw() |
1472e41c | 1654 | { return __builtin_nanl (""); } |
54c1bf78 | 1655 | static long double signaling_NaN() throw() |
1472e41c | 1656 | { return __builtin_nansl (""); } |
54c1bf78 | 1657 | static long double denorm_min() throw() |
ac520ec9 | 1658 | { return __LDBL_DENORM_MIN__; } |
54c1bf78 BK |
1659 | |
1660 | static const bool is_iec559 = __glibcpp_long_double_is_iec559; | |
1661 | static const bool is_bounded = __glibcpp_long_double_is_bounded; | |
1662 | static const bool is_modulo = __glibcpp_long_double_is_modulo; | |
1663 | ||
1664 | static const bool traps = __glibcpp_long_double_traps; | |
1665 | static const bool tinyness_before = __glibcpp_long_double_tinyness_before; | |
1666 | static const float_round_style round_style = | |
1667 | __glibcpp_long_double_round_style; | |
1668 | }; | |
1669 | ||
54c1bf78 | 1670 | #undef __glibcpp_long_double_round_error |
54c1bf78 | 1671 | #undef __glibcpp_long_double_has_denorm_loss |
54c1bf78 BK |
1672 | #undef __glibcpp_long_double_is_iec559 |
1673 | #undef __glibcpp_long_double_is_bounded | |
1674 | #undef __glibcpp_long_double_is_modulo | |
1675 | #undef __glibcpp_long_double_traps | |
1676 | #undef __glibcpp_long_double_tinyness_before | |
1677 | #undef __glibcpp_long_double_round_style | |
1678 | ||
1679 | } // namespace std | |
1680 | ||
1681 | #endif // _CPP_NUMERIC_LIMITS |