]>
Commit | Line | Data |
---|---|---|
94a86be0 | 1 | // The template and inlines for the numeric_limits classes. -*- C++ -*- |
de96ac46 | 2 | |
5624e564 | 3 | // Copyright (C) 1999-2015 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 | |
748086b7 | 8 | // Free Software Foundation; either version 3, or (at your option) |
de96ac46 BK |
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 | ||
748086b7 JJ |
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/>. | |
de96ac46 | 24 | |
f910786b | 25 | /** @file include/limits |
0aa06b18 BK |
26 | * This is a Standard C++ Library header. |
27 | */ | |
28 | ||
54c1bf78 BK |
29 | // Note: this is not a conforming implementation. |
30 | // Written by Gabriel Dos Reis <gdr@codesourcery.com> | |
31 | ||
32 | // | |
33 | // ISO 14882:1998 | |
34 | // 18.2.1 | |
35 | // | |
36 | ||
1143680e SE |
37 | #ifndef _GLIBCXX_NUMERIC_LIMITS |
38 | #define _GLIBCXX_NUMERIC_LIMITS 1 | |
54c1bf78 BK |
39 | |
40 | #pragma GCC system_header | |
41 | ||
54c1bf78 BK |
42 | #include <bits/c++config.h> |
43 | ||
44 | // | |
45 | // The numeric_limits<> traits document implementation-defined aspects | |
46 | // of fundamental arithmetic data types (integers and floating points). | |
ce4674f2 | 47 | // From Standard C++ point of view, there are 14 such types: |
54c1bf78 | 48 | // * integers |
94a86be0 | 49 | // bool (1) |
ce4674f2 | 50 | // char, signed char, unsigned char, wchar_t (4) |
54c1bf78 BK |
51 | // short, unsigned short (2) |
52 | // int, unsigned (2) | |
53 | // long, unsigned long (2) | |
54 | // | |
55 | // * floating points | |
56 | // float (1) | |
57 | // double (1) | |
58 | // long double (1) | |
59 | // | |
28dac70a | 60 | // GNU C++ understands (where supported by the host C-library) |
54c1bf78 BK |
61 | // * integer |
62 | // long long, unsigned long long (2) | |
63 | // | |
ce4674f2 | 64 | // which brings us to 16 fundamental arithmetic data types in GNU C++. |
54c1bf78 | 65 | // |
6ad8f949 | 66 | // |
54c1bf78 BK |
67 | // Since a numeric_limits<> is a bit tricky to get right, we rely on |
68 | // an interface composed of macros which should be defined in config/os | |
69 | // or config/cpu when they differ from the generic (read arbitrary) | |
70 | // definitions given here. | |
71 | // | |
72 | ||
585e661a GDR |
73 | // These values can be overridden in the target configuration file. |
74 | // The default values are appropriate for many 32-bit targets. | |
54c1bf78 | 75 | |
28dac70a | 76 | // GCC only intrinsically supports modulo integral types. The only remaining |
da28539c RH |
77 | // integral exceptional values is division by zero. Only targets that do not |
78 | // signal division by zero in some "hard to ignore" way should use false. | |
2778669a PE |
79 | #ifndef __glibcxx_integral_traps |
80 | # define __glibcxx_integral_traps true | |
54c1bf78 BK |
81 | #endif |
82 | ||
54c1bf78 BK |
83 | // float |
84 | // | |
85 | ||
28dac70a | 86 | // Default values. Should be overridden in configuration files if necessary. |
54c1bf78 | 87 | |
2778669a PE |
88 | #ifndef __glibcxx_float_has_denorm_loss |
89 | # define __glibcxx_float_has_denorm_loss false | |
54c1bf78 | 90 | #endif |
2778669a PE |
91 | #ifndef __glibcxx_float_traps |
92 | # define __glibcxx_float_traps false | |
54c1bf78 | 93 | #endif |
2778669a PE |
94 | #ifndef __glibcxx_float_tinyness_before |
95 | # define __glibcxx_float_tinyness_before false | |
54c1bf78 BK |
96 | #endif |
97 | ||
54c1bf78 BK |
98 | // double |
99 | ||
28dac70a | 100 | // Default values. Should be overridden in configuration files if necessary. |
54c1bf78 | 101 | |
2778669a PE |
102 | #ifndef __glibcxx_double_has_denorm_loss |
103 | # define __glibcxx_double_has_denorm_loss false | |
54c1bf78 | 104 | #endif |
2778669a PE |
105 | #ifndef __glibcxx_double_traps |
106 | # define __glibcxx_double_traps false | |
54c1bf78 | 107 | #endif |
2778669a PE |
108 | #ifndef __glibcxx_double_tinyness_before |
109 | # define __glibcxx_double_tinyness_before false | |
54c1bf78 BK |
110 | #endif |
111 | ||
54c1bf78 BK |
112 | // long double |
113 | ||
28dac70a | 114 | // Default values. Should be overridden in configuration files if necessary. |
54c1bf78 | 115 | |
2778669a PE |
116 | #ifndef __glibcxx_long_double_has_denorm_loss |
117 | # define __glibcxx_long_double_has_denorm_loss false | |
54c1bf78 | 118 | #endif |
2778669a PE |
119 | #ifndef __glibcxx_long_double_traps |
120 | # define __glibcxx_long_double_traps false | |
54c1bf78 | 121 | #endif |
2778669a PE |
122 | #ifndef __glibcxx_long_double_tinyness_before |
123 | # define __glibcxx_long_double_tinyness_before false | |
725dc051 | 124 | #endif |
54c1bf78 | 125 | |
6ad8f949 RH |
126 | // You should not need to define any macros below this point. |
127 | ||
78a7c317 | 128 | #define __glibcxx_signed_b(T,B) ((T)(-1) < 0) |
6ad8f949 | 129 | |
78a7c317 DD |
130 | #define __glibcxx_min_b(T,B) \ |
131 | (__glibcxx_signed_b (T,B) ? -__glibcxx_max_b (T,B) - 1 : (T)0) | |
6ad8f949 | 132 | |
78a7c317 DD |
133 | #define __glibcxx_max_b(T,B) \ |
134 | (__glibcxx_signed_b (T,B) ? \ | |
135 | (((((T)1 << (__glibcxx_digits_b (T,B) - 1)) - 1) << 1) + 1) : ~(T)0) | |
6ad8f949 | 136 | |
78a7c317 DD |
137 | #define __glibcxx_digits_b(T,B) \ |
138 | (B - __glibcxx_signed_b (T,B)) | |
6ad8f949 RH |
139 | |
140 | // The fraction 643/2136 approximates log10(2) to 7 significant digits. | |
78a7c317 DD |
141 | #define __glibcxx_digits10_b(T,B) \ |
142 | (__glibcxx_digits_b (T,B) * 643L / 2136) | |
143 | ||
144 | #define __glibcxx_signed(T) \ | |
145 | __glibcxx_signed_b (T, sizeof(T) * __CHAR_BIT__) | |
146 | #define __glibcxx_min(T) \ | |
147 | __glibcxx_min_b (T, sizeof(T) * __CHAR_BIT__) | |
148 | #define __glibcxx_max(T) \ | |
149 | __glibcxx_max_b (T, sizeof(T) * __CHAR_BIT__) | |
150 | #define __glibcxx_digits(T) \ | |
151 | __glibcxx_digits_b (T, sizeof(T) * __CHAR_BIT__) | |
2778669a | 152 | #define __glibcxx_digits10(T) \ |
78a7c317 | 153 | __glibcxx_digits10_b (T, sizeof(T) * __CHAR_BIT__) |
6ad8f949 | 154 | |
018afad3 | 155 | #define __glibcxx_max_digits10(T) \ |
dd60dacd | 156 | (2 + (T) * 643L / 2136) |
54c1bf78 | 157 | |
12ffa228 BK |
158 | namespace std _GLIBCXX_VISIBILITY(default) |
159 | { | |
160 | _GLIBCXX_BEGIN_NAMESPACE_VERSION | |
3cbc7af0 | 161 | |
bd2726e0 PE |
162 | /** |
163 | * @brief Describes the rounding style for floating-point types. | |
164 | * | |
165 | * This is used in the std::numeric_limits class. | |
166 | */ | |
6ad8f949 | 167 | enum float_round_style |
54c1bf78 | 168 | { |
f910786b BK |
169 | round_indeterminate = -1, /// Intermediate. |
170 | round_toward_zero = 0, /// To zero. | |
171 | round_to_nearest = 1, /// To the nearest representable value. | |
172 | round_toward_infinity = 2, /// To infinity. | |
173 | round_toward_neg_infinity = 3 /// To negative infinity. | |
54c1bf78 BK |
174 | }; |
175 | ||
bd2726e0 PE |
176 | /** |
177 | * @brief Describes the denormalization for floating-point types. | |
178 | * | |
179 | * These values represent the presence or absence of a variable number | |
180 | * of exponent bits. This type is used in the std::numeric_limits class. | |
181 | */ | |
6ad8f949 | 182 | enum float_denorm_style |
54c1bf78 | 183 | { |
bd2726e0 | 184 | /// Indeterminate at compile time whether denormalized values are allowed. |
54c1bf78 | 185 | denorm_indeterminate = -1, |
bd2726e0 | 186 | /// The type does not allow denormalized values. |
54c1bf78 | 187 | denorm_absent = 0, |
bd2726e0 | 188 | /// The type allows denormalized values. |
54c1bf78 BK |
189 | denorm_present = 1 |
190 | }; | |
191 | ||
bd2726e0 PE |
192 | /** |
193 | * @brief Part of std::numeric_limits. | |
194 | * | |
195 | * The @c static @c const members are usable as integral constant | |
196 | * expressions. | |
197 | * | |
28dac70a | 198 | * @note This is a separate class for purposes of efficiency; you |
bd2726e0 PE |
199 | * should only access these members as part of an instantiation |
200 | * of the std::numeric_limits class. | |
201 | */ | |
84979344 BK |
202 | struct __numeric_limits_base |
203 | { | |
bd2726e0 | 204 | /** This will be true for all fundamental types (which have |
94a86be0 BK |
205 | specializations), and false for everything else. */ |
206 | static _GLIBCXX_USE_CONSTEXPR bool is_specialized = false; | |
84979344 | 207 | |
bd2726e0 | 208 | /** The number of @c radix digits that be represented without change: for |
94a86be0 BK |
209 | integer types, the number of non-sign bits in the mantissa; for |
210 | floating types, the number of @c radix digits in the mantissa. */ | |
211 | static _GLIBCXX_USE_CONSTEXPR int digits = 0; | |
212 | ||
bd2726e0 | 213 | /** The number of base 10 digits that can be represented without change. */ |
94a86be0 BK |
214 | static _GLIBCXX_USE_CONSTEXPR int digits10 = 0; |
215 | ||
734f5023 | 216 | #if __cplusplus >= 201103L |
018afad3 ESR |
217 | /** The number of base 10 digits required to ensure that values which |
218 | differ are always differentiated. */ | |
94a86be0 | 219 | static constexpr int max_digits10 = 0; |
018afad3 | 220 | #endif |
94a86be0 | 221 | |
bd2726e0 | 222 | /** True if the type is signed. */ |
94a86be0 BK |
223 | static _GLIBCXX_USE_CONSTEXPR bool is_signed = false; |
224 | ||
c0ffa2ba | 225 | /** True if the type is integer. */ |
94a86be0 BK |
226 | static _GLIBCXX_USE_CONSTEXPR bool is_integer = false; |
227 | ||
c0ffa2ba | 228 | /** True if the type uses an exact representation. All integer types are |
94a86be0 | 229 | exact, but not all exact types are integer. For example, rational and |
c0ffa2ba | 230 | fixed-exponent representations are exact but not integer. */ |
94a86be0 BK |
231 | static _GLIBCXX_USE_CONSTEXPR bool is_exact = false; |
232 | ||
bd2726e0 | 233 | /** For integer types, specifies the base of the representation. For |
94a86be0 BK |
234 | floating types, specifies the base of the exponent representation. */ |
235 | static _GLIBCXX_USE_CONSTEXPR int radix = 0; | |
84979344 | 236 | |
bd2726e0 | 237 | /** The minimum negative integer such that @c radix raised to the power of |
94a86be0 BK |
238 | (one less than that integer) is a normalized floating point number. */ |
239 | static _GLIBCXX_USE_CONSTEXPR int min_exponent = 0; | |
240 | ||
bd2726e0 | 241 | /** The minimum negative integer such that 10 raised to that power is in |
94a86be0 BK |
242 | the range of normalized floating point numbers. */ |
243 | static _GLIBCXX_USE_CONSTEXPR int min_exponent10 = 0; | |
244 | ||
bd2726e0 | 245 | /** The maximum positive integer such that @c radix raised to the power of |
94a86be0 | 246 | (one less than that integer) is a representable finite floating point |
bd2726e0 | 247 | number. */ |
94a86be0 BK |
248 | static _GLIBCXX_USE_CONSTEXPR int max_exponent = 0; |
249 | ||
bd2726e0 | 250 | /** The maximum positive integer such that 10 raised to that power is in |
94a86be0 BK |
251 | the range of representable finite floating point numbers. */ |
252 | static _GLIBCXX_USE_CONSTEXPR int max_exponent10 = 0; | |
6ad8f949 | 253 | |
bd2726e0 | 254 | /** True if the type has a representation for positive infinity. */ |
94a86be0 BK |
255 | static _GLIBCXX_USE_CONSTEXPR bool has_infinity = false; |
256 | ||
bd2726e0 | 257 | /** True if the type has a representation for a quiet (non-signaling) |
c0ffa2ba | 258 | Not a Number. */ |
94a86be0 BK |
259 | static _GLIBCXX_USE_CONSTEXPR bool has_quiet_NaN = false; |
260 | ||
bd2726e0 | 261 | /** True if the type has a representation for a signaling |
c0ffa2ba | 262 | Not a Number. */ |
94a86be0 BK |
263 | static _GLIBCXX_USE_CONSTEXPR bool has_signaling_NaN = false; |
264 | ||
bd2726e0 | 265 | /** See std::float_denorm_style for more information. */ |
94a86be0 BK |
266 | static _GLIBCXX_USE_CONSTEXPR float_denorm_style has_denorm = denorm_absent; |
267 | ||
c0ffa2ba BK |
268 | /** True if loss of accuracy is detected as a denormalization loss, |
269 | rather than as an inexact result. */ | |
94a86be0 | 270 | static _GLIBCXX_USE_CONSTEXPR bool has_denorm_loss = false; |
84979344 | 271 | |
bd2726e0 | 272 | /** True if-and-only-if the type adheres to the IEC 559 standard, also |
94a86be0 BK |
273 | known as IEEE 754. (Only makes sense for floating point types.) */ |
274 | static _GLIBCXX_USE_CONSTEXPR bool is_iec559 = false; | |
275 | ||
c0ffa2ba | 276 | /** True if the set of values representable by the type is |
94a86be0 | 277 | finite. All built-in types are bounded, this member would be |
c0ffa2ba | 278 | false for arbitrary precision types. */ |
94a86be0 BK |
279 | static _GLIBCXX_USE_CONSTEXPR bool is_bounded = false; |
280 | ||
1c830087 MG |
281 | /** True if the type is @e modulo. A type is modulo if, for any |
282 | operation involving +, -, or * on values of that type whose | |
283 | result would fall outside the range [min(),max()], the value | |
284 | returned differs from the true value by an integer multiple of | |
285 | max() - min() + 1. On most machines, this is false for floating | |
286 | types, true for unsigned integers, and true for signed integers. | |
287 | See PR22200 about signed integers. */ | |
94a86be0 | 288 | static _GLIBCXX_USE_CONSTEXPR bool is_modulo = false; |
84979344 | 289 | |
bd2726e0 | 290 | /** True if trapping is implemented for this type. */ |
94a86be0 BK |
291 | static _GLIBCXX_USE_CONSTEXPR bool traps = false; |
292 | ||
28dac70a | 293 | /** True if tininess is detected before rounding. (see IEC 559) */ |
94a86be0 BK |
294 | static _GLIBCXX_USE_CONSTEXPR bool tinyness_before = false; |
295 | ||
bd2726e0 | 296 | /** See std::float_round_style for more information. This is only |
94a86be0 | 297 | meaningful for floating types; integer types will all be |
bd2726e0 | 298 | round_toward_zero. */ |
94a86be0 BK |
299 | static _GLIBCXX_USE_CONSTEXPR float_round_style round_style = |
300 | round_toward_zero; | |
84979344 BK |
301 | }; |
302 | ||
bd2726e0 PE |
303 | /** |
304 | * @brief Properties of fundamental types. | |
305 | * | |
306 | * This class allows a program to obtain information about the | |
307 | * representation of a fundamental type on a given platform. For | |
308 | * non-fundamental types, the functions will return 0 and the data | |
309 | * members will all be @c false. | |
310 | * | |
3d7c150e | 311 | * _GLIBCXX_RESOLVE_LIB_DEFECTS: DRs 201 and 184 (hi Gaby!) are |
bd2726e0 | 312 | * noted, but not incorporated in this documented (yet). |
bd2726e0 | 313 | */ |
6ad8f949 RH |
314 | template<typename _Tp> |
315 | struct numeric_limits : public __numeric_limits_base | |
54c1bf78 | 316 | { |
bd2726e0 | 317 | /** The minimum finite value, or for floating types with |
94a86be0 BK |
318 | denormalization, the minimum positive normalized value. */ |
319 | static _GLIBCXX_CONSTEXPR _Tp | |
b98fcf6e | 320 | min() _GLIBCXX_USE_NOEXCEPT { return _Tp(); } |
94a86be0 | 321 | |
bd2726e0 | 322 | /** The maximum finite value. */ |
94a86be0 | 323 | static _GLIBCXX_CONSTEXPR _Tp |
b98fcf6e | 324 | max() _GLIBCXX_USE_NOEXCEPT { return _Tp(); } |
94a86be0 | 325 | |
734f5023 | 326 | #if __cplusplus >= 201103L |
018afad3 ESR |
327 | /** A finite value x such that there is no other finite value y |
328 | * where y < x. */ | |
94a86be0 | 329 | static constexpr _Tp |
b98fcf6e | 330 | lowest() noexcept { return _Tp(); } |
018afad3 | 331 | #endif |
94a86be0 | 332 | |
bd2726e0 | 333 | /** The @e machine @e epsilon: the difference between 1 and the least |
94a86be0 BK |
334 | value greater than 1 that is representable. */ |
335 | static _GLIBCXX_CONSTEXPR _Tp | |
b98fcf6e | 336 | epsilon() _GLIBCXX_USE_NOEXCEPT { return _Tp(); } |
94a86be0 | 337 | |
bd2726e0 | 338 | /** The maximum rounding error measurement (see LIA-1). */ |
94a86be0 | 339 | static _GLIBCXX_CONSTEXPR _Tp |
b98fcf6e | 340 | round_error() _GLIBCXX_USE_NOEXCEPT { return _Tp(); } |
94a86be0 | 341 | |
bd2726e0 | 342 | /** The representation of positive infinity, if @c has_infinity. */ |
94a86be0 | 343 | static _GLIBCXX_CONSTEXPR _Tp |
b98fcf6e | 344 | infinity() _GLIBCXX_USE_NOEXCEPT { return _Tp(); } |
2a60a9f6 | 345 | |
c0ffa2ba | 346 | /** The representation of a quiet Not a Number, |
2a60a9f6 | 347 | if @c has_quiet_NaN. */ |
94a86be0 | 348 | static _GLIBCXX_CONSTEXPR _Tp |
b98fcf6e | 349 | quiet_NaN() _GLIBCXX_USE_NOEXCEPT { return _Tp(); } |
94a86be0 | 350 | |
c0ffa2ba | 351 | /** The representation of a signaling Not a Number, if |
94a86be0 BK |
352 | @c has_signaling_NaN. */ |
353 | static _GLIBCXX_CONSTEXPR _Tp | |
b98fcf6e | 354 | signaling_NaN() _GLIBCXX_USE_NOEXCEPT { return _Tp(); } |
94a86be0 | 355 | |
bd2726e0 | 356 | /** The minimum positive denormalized value. For types where |
94a86be0 | 357 | @c has_denorm is false, this is the minimum positive normalized |
bd2726e0 | 358 | value. */ |
94a86be0 | 359 | static _GLIBCXX_CONSTEXPR _Tp |
b98fcf6e | 360 | denorm_min() _GLIBCXX_USE_NOEXCEPT { return _Tp(); } |
54c1bf78 BK |
361 | }; |
362 | ||
734f5023 | 363 | #if __cplusplus >= 201103L |
ce4674f2 PC |
364 | template<typename _Tp> |
365 | struct numeric_limits<const _Tp> | |
366 | : public numeric_limits<_Tp> { }; | |
367 | ||
368 | template<typename _Tp> | |
369 | struct numeric_limits<volatile _Tp> | |
370 | : public numeric_limits<_Tp> { }; | |
371 | ||
372 | template<typename _Tp> | |
373 | struct numeric_limits<const volatile _Tp> | |
374 | : public numeric_limits<_Tp> { }; | |
375 | #endif | |
376 | ||
377 | // Now there follow 16 explicit specializations. Yes, 16. Make sure | |
378 | // you get the count right. (18 in c++0x mode) | |
0aa06b18 BK |
379 | |
380 | /// numeric_limits<bool> specialization. | |
54c1bf78 BK |
381 | template<> |
382 | struct numeric_limits<bool> | |
383 | { | |
94a86be0 BK |
384 | static _GLIBCXX_USE_CONSTEXPR bool is_specialized = true; |
385 | ||
386 | static _GLIBCXX_CONSTEXPR bool | |
4d4cf144 | 387 | min() _GLIBCXX_USE_NOEXCEPT { return false; } |
94a86be0 BK |
388 | |
389 | static _GLIBCXX_CONSTEXPR bool | |
4d4cf144 | 390 | max() _GLIBCXX_USE_NOEXCEPT { return true; } |
54c1bf78 | 391 | |
734f5023 | 392 | #if __cplusplus >= 201103L |
94a86be0 | 393 | static constexpr bool |
4d4cf144 | 394 | lowest() noexcept { return min(); } |
018afad3 | 395 | #endif |
94a86be0 BK |
396 | static _GLIBCXX_USE_CONSTEXPR int digits = 1; |
397 | static _GLIBCXX_USE_CONSTEXPR int digits10 = 0; | |
734f5023 | 398 | #if __cplusplus >= 201103L |
94a86be0 | 399 | static constexpr int max_digits10 = 0; |
018afad3 | 400 | #endif |
94a86be0 BK |
401 | static _GLIBCXX_USE_CONSTEXPR bool is_signed = false; |
402 | static _GLIBCXX_USE_CONSTEXPR bool is_integer = true; | |
403 | static _GLIBCXX_USE_CONSTEXPR bool is_exact = true; | |
404 | static _GLIBCXX_USE_CONSTEXPR int radix = 2; | |
405 | ||
406 | static _GLIBCXX_CONSTEXPR bool | |
4d4cf144 | 407 | epsilon() _GLIBCXX_USE_NOEXCEPT { return false; } |
94a86be0 BK |
408 | |
409 | static _GLIBCXX_CONSTEXPR bool | |
4d4cf144 | 410 | round_error() _GLIBCXX_USE_NOEXCEPT { return false; } |
94a86be0 BK |
411 | |
412 | static _GLIBCXX_USE_CONSTEXPR int min_exponent = 0; | |
413 | static _GLIBCXX_USE_CONSTEXPR int min_exponent10 = 0; | |
414 | static _GLIBCXX_USE_CONSTEXPR int max_exponent = 0; | |
415 | static _GLIBCXX_USE_CONSTEXPR int max_exponent10 = 0; | |
416 | ||
417 | static _GLIBCXX_USE_CONSTEXPR bool has_infinity = false; | |
418 | static _GLIBCXX_USE_CONSTEXPR bool has_quiet_NaN = false; | |
419 | static _GLIBCXX_USE_CONSTEXPR bool has_signaling_NaN = false; | |
420 | static _GLIBCXX_USE_CONSTEXPR float_denorm_style has_denorm | |
421 | = denorm_absent; | |
422 | static _GLIBCXX_USE_CONSTEXPR bool has_denorm_loss = false; | |
423 | ||
424 | static _GLIBCXX_CONSTEXPR bool | |
4d4cf144 | 425 | infinity() _GLIBCXX_USE_NOEXCEPT { return false; } |
94a86be0 BK |
426 | |
427 | static _GLIBCXX_CONSTEXPR bool | |
4d4cf144 | 428 | quiet_NaN() _GLIBCXX_USE_NOEXCEPT { return false; } |
94a86be0 BK |
429 | |
430 | static _GLIBCXX_CONSTEXPR bool | |
4d4cf144 | 431 | signaling_NaN() _GLIBCXX_USE_NOEXCEPT { return false; } |
94a86be0 BK |
432 | |
433 | static _GLIBCXX_CONSTEXPR bool | |
4d4cf144 | 434 | denorm_min() _GLIBCXX_USE_NOEXCEPT { return false; } |
94a86be0 BK |
435 | |
436 | static _GLIBCXX_USE_CONSTEXPR bool is_iec559 = false; | |
437 | static _GLIBCXX_USE_CONSTEXPR bool is_bounded = true; | |
438 | static _GLIBCXX_USE_CONSTEXPR bool is_modulo = false; | |
54c1bf78 BK |
439 | |
440 | // It is not clear what it means for a boolean type to trap. | |
441 | // This is a DR on the LWG issue list. Here, I use integer | |
442 | // promotion semantics. | |
94a86be0 BK |
443 | static _GLIBCXX_USE_CONSTEXPR bool traps = __glibcxx_integral_traps; |
444 | static _GLIBCXX_USE_CONSTEXPR bool tinyness_before = false; | |
445 | static _GLIBCXX_USE_CONSTEXPR float_round_style round_style | |
446 | = round_toward_zero; | |
54c1bf78 BK |
447 | }; |
448 | ||
0aa06b18 | 449 | /// numeric_limits<char> specialization. |
54c1bf78 BK |
450 | template<> |
451 | struct numeric_limits<char> | |
452 | { | |
94a86be0 BK |
453 | static _GLIBCXX_USE_CONSTEXPR bool is_specialized = true; |
454 | ||
455 | static _GLIBCXX_CONSTEXPR char | |
4d4cf144 | 456 | min() _GLIBCXX_USE_NOEXCEPT { return __glibcxx_min(char); } |
94a86be0 BK |
457 | |
458 | static _GLIBCXX_CONSTEXPR char | |
4d4cf144 | 459 | max() _GLIBCXX_USE_NOEXCEPT { return __glibcxx_max(char); } |
54c1bf78 | 460 | |
734f5023 | 461 | #if __cplusplus >= 201103L |
94a86be0 | 462 | static constexpr char |
4d4cf144 | 463 | lowest() noexcept { return min(); } |
018afad3 | 464 | #endif |
54c1bf78 | 465 | |
94a86be0 BK |
466 | static _GLIBCXX_USE_CONSTEXPR int digits = __glibcxx_digits (char); |
467 | static _GLIBCXX_USE_CONSTEXPR int digits10 = __glibcxx_digits10 (char); | |
734f5023 | 468 | #if __cplusplus >= 201103L |
94a86be0 | 469 | static constexpr int max_digits10 = 0; |
018afad3 | 470 | #endif |
94a86be0 BK |
471 | static _GLIBCXX_USE_CONSTEXPR bool is_signed = __glibcxx_signed (char); |
472 | static _GLIBCXX_USE_CONSTEXPR bool is_integer = true; | |
473 | static _GLIBCXX_USE_CONSTEXPR bool is_exact = true; | |
474 | static _GLIBCXX_USE_CONSTEXPR int radix = 2; | |
475 | ||
476 | static _GLIBCXX_CONSTEXPR char | |
4d4cf144 | 477 | epsilon() _GLIBCXX_USE_NOEXCEPT { return 0; } |
94a86be0 BK |
478 | |
479 | static _GLIBCXX_CONSTEXPR char | |
4d4cf144 | 480 | round_error() _GLIBCXX_USE_NOEXCEPT { return 0; } |
94a86be0 BK |
481 | |
482 | static _GLIBCXX_USE_CONSTEXPR int min_exponent = 0; | |
483 | static _GLIBCXX_USE_CONSTEXPR int min_exponent10 = 0; | |
484 | static _GLIBCXX_USE_CONSTEXPR int max_exponent = 0; | |
485 | static _GLIBCXX_USE_CONSTEXPR int max_exponent10 = 0; | |
486 | ||
487 | static _GLIBCXX_USE_CONSTEXPR bool has_infinity = false; | |
488 | static _GLIBCXX_USE_CONSTEXPR bool has_quiet_NaN = false; | |
489 | static _GLIBCXX_USE_CONSTEXPR bool has_signaling_NaN = false; | |
490 | static _GLIBCXX_USE_CONSTEXPR float_denorm_style has_denorm | |
491 | = denorm_absent; | |
492 | static _GLIBCXX_USE_CONSTEXPR bool has_denorm_loss = false; | |
493 | ||
494 | static _GLIBCXX_CONSTEXPR | |
4d4cf144 | 495 | char infinity() _GLIBCXX_USE_NOEXCEPT { return char(); } |
94a86be0 BK |
496 | |
497 | static _GLIBCXX_CONSTEXPR char | |
4d4cf144 | 498 | quiet_NaN() _GLIBCXX_USE_NOEXCEPT { return char(); } |
94a86be0 BK |
499 | |
500 | static _GLIBCXX_CONSTEXPR char | |
4d4cf144 | 501 | signaling_NaN() _GLIBCXX_USE_NOEXCEPT { return char(); } |
94a86be0 BK |
502 | |
503 | static _GLIBCXX_CONSTEXPR char | |
4d4cf144 | 504 | denorm_min() _GLIBCXX_USE_NOEXCEPT { return static_cast<char>(0); } |
94a86be0 BK |
505 | |
506 | static _GLIBCXX_USE_CONSTEXPR bool is_iec559 = false; | |
507 | static _GLIBCXX_USE_CONSTEXPR bool is_bounded = true; | |
1c830087 | 508 | static _GLIBCXX_USE_CONSTEXPR bool is_modulo = !is_signed; |
94a86be0 BK |
509 | |
510 | static _GLIBCXX_USE_CONSTEXPR bool traps = __glibcxx_integral_traps; | |
511 | static _GLIBCXX_USE_CONSTEXPR bool tinyness_before = false; | |
512 | static _GLIBCXX_USE_CONSTEXPR float_round_style round_style | |
513 | = round_toward_zero; | |
54c1bf78 BK |
514 | }; |
515 | ||
0aa06b18 | 516 | /// numeric_limits<signed char> specialization. |
54c1bf78 BK |
517 | template<> |
518 | struct numeric_limits<signed char> | |
519 | { | |
94a86be0 BK |
520 | static _GLIBCXX_USE_CONSTEXPR bool is_specialized = true; |
521 | ||
522 | static _GLIBCXX_CONSTEXPR signed char | |
4d4cf144 | 523 | min() _GLIBCXX_USE_NOEXCEPT { return -__SCHAR_MAX__ - 1; } |
94a86be0 BK |
524 | |
525 | static _GLIBCXX_CONSTEXPR signed char | |
4d4cf144 | 526 | max() _GLIBCXX_USE_NOEXCEPT { return __SCHAR_MAX__; } |
54c1bf78 | 527 | |
734f5023 | 528 | #if __cplusplus >= 201103L |
94a86be0 | 529 | static constexpr signed char |
4d4cf144 | 530 | lowest() noexcept { return min(); } |
018afad3 | 531 | #endif |
54c1bf78 | 532 | |
94a86be0 BK |
533 | static _GLIBCXX_USE_CONSTEXPR int digits = __glibcxx_digits (signed char); |
534 | static _GLIBCXX_USE_CONSTEXPR int digits10 | |
535 | = __glibcxx_digits10 (signed char); | |
734f5023 | 536 | #if __cplusplus >= 201103L |
94a86be0 | 537 | static constexpr int max_digits10 = 0; |
018afad3 | 538 | #endif |
94a86be0 BK |
539 | static _GLIBCXX_USE_CONSTEXPR bool is_signed = true; |
540 | static _GLIBCXX_USE_CONSTEXPR bool is_integer = true; | |
541 | static _GLIBCXX_USE_CONSTEXPR bool is_exact = true; | |
542 | static _GLIBCXX_USE_CONSTEXPR int radix = 2; | |
543 | ||
544 | static _GLIBCXX_CONSTEXPR signed char | |
4d4cf144 | 545 | epsilon() _GLIBCXX_USE_NOEXCEPT { return 0; } |
94a86be0 BK |
546 | |
547 | static _GLIBCXX_CONSTEXPR signed char | |
4d4cf144 | 548 | round_error() _GLIBCXX_USE_NOEXCEPT { return 0; } |
94a86be0 BK |
549 | |
550 | static _GLIBCXX_USE_CONSTEXPR int min_exponent = 0; | |
551 | static _GLIBCXX_USE_CONSTEXPR int min_exponent10 = 0; | |
552 | static _GLIBCXX_USE_CONSTEXPR int max_exponent = 0; | |
553 | static _GLIBCXX_USE_CONSTEXPR int max_exponent10 = 0; | |
554 | ||
555 | static _GLIBCXX_USE_CONSTEXPR bool has_infinity = false; | |
556 | static _GLIBCXX_USE_CONSTEXPR bool has_quiet_NaN = false; | |
557 | static _GLIBCXX_USE_CONSTEXPR bool has_signaling_NaN = false; | |
558 | static _GLIBCXX_USE_CONSTEXPR float_denorm_style has_denorm | |
559 | = denorm_absent; | |
560 | static _GLIBCXX_USE_CONSTEXPR bool has_denorm_loss = false; | |
561 | ||
562 | static _GLIBCXX_CONSTEXPR signed char | |
4d4cf144 | 563 | infinity() _GLIBCXX_USE_NOEXCEPT { return static_cast<signed char>(0); } |
94a86be0 BK |
564 | |
565 | static _GLIBCXX_CONSTEXPR signed char | |
4d4cf144 | 566 | quiet_NaN() _GLIBCXX_USE_NOEXCEPT { return static_cast<signed char>(0); } |
94a86be0 BK |
567 | |
568 | static _GLIBCXX_CONSTEXPR signed char | |
4d4cf144 PC |
569 | signaling_NaN() _GLIBCXX_USE_NOEXCEPT |
570 | { return static_cast<signed char>(0); } | |
94a86be0 BK |
571 | |
572 | static _GLIBCXX_CONSTEXPR signed char | |
4d4cf144 PC |
573 | denorm_min() _GLIBCXX_USE_NOEXCEPT |
574 | { return static_cast<signed char>(0); } | |
94a86be0 BK |
575 | |
576 | static _GLIBCXX_USE_CONSTEXPR bool is_iec559 = false; | |
577 | static _GLIBCXX_USE_CONSTEXPR bool is_bounded = true; | |
1c830087 | 578 | static _GLIBCXX_USE_CONSTEXPR bool is_modulo = false; |
94a86be0 BK |
579 | |
580 | static _GLIBCXX_USE_CONSTEXPR bool traps = __glibcxx_integral_traps; | |
581 | static _GLIBCXX_USE_CONSTEXPR bool tinyness_before = false; | |
582 | static _GLIBCXX_USE_CONSTEXPR float_round_style round_style | |
583 | = round_toward_zero; | |
54c1bf78 BK |
584 | }; |
585 | ||
0aa06b18 | 586 | /// numeric_limits<unsigned char> specialization. |
54c1bf78 BK |
587 | template<> |
588 | struct numeric_limits<unsigned char> | |
589 | { | |
94a86be0 BK |
590 | static _GLIBCXX_USE_CONSTEXPR bool is_specialized = true; |
591 | ||
592 | static _GLIBCXX_CONSTEXPR unsigned char | |
4d4cf144 | 593 | min() _GLIBCXX_USE_NOEXCEPT { return 0; } |
94a86be0 BK |
594 | |
595 | static _GLIBCXX_CONSTEXPR unsigned char | |
4d4cf144 | 596 | max() _GLIBCXX_USE_NOEXCEPT { return __SCHAR_MAX__ * 2U + 1; } |
54c1bf78 | 597 | |
734f5023 | 598 | #if __cplusplus >= 201103L |
94a86be0 | 599 | static constexpr unsigned char |
4d4cf144 | 600 | lowest() noexcept { return min(); } |
018afad3 | 601 | #endif |
54c1bf78 | 602 | |
94a86be0 BK |
603 | static _GLIBCXX_USE_CONSTEXPR int digits |
604 | = __glibcxx_digits (unsigned char); | |
605 | static _GLIBCXX_USE_CONSTEXPR int digits10 | |
606 | = __glibcxx_digits10 (unsigned char); | |
734f5023 | 607 | #if __cplusplus >= 201103L |
94a86be0 | 608 | static constexpr int max_digits10 = 0; |
018afad3 | 609 | #endif |
94a86be0 BK |
610 | static _GLIBCXX_USE_CONSTEXPR bool is_signed = false; |
611 | static _GLIBCXX_USE_CONSTEXPR bool is_integer = true; | |
612 | static _GLIBCXX_USE_CONSTEXPR bool is_exact = true; | |
613 | static _GLIBCXX_USE_CONSTEXPR int radix = 2; | |
614 | ||
615 | static _GLIBCXX_CONSTEXPR unsigned char | |
4d4cf144 | 616 | epsilon() _GLIBCXX_USE_NOEXCEPT { return 0; } |
94a86be0 BK |
617 | |
618 | static _GLIBCXX_CONSTEXPR unsigned char | |
4d4cf144 | 619 | round_error() _GLIBCXX_USE_NOEXCEPT { return 0; } |
94a86be0 BK |
620 | |
621 | static _GLIBCXX_USE_CONSTEXPR int min_exponent = 0; | |
622 | static _GLIBCXX_USE_CONSTEXPR int min_exponent10 = 0; | |
623 | static _GLIBCXX_USE_CONSTEXPR int max_exponent = 0; | |
624 | static _GLIBCXX_USE_CONSTEXPR int max_exponent10 = 0; | |
625 | ||
626 | static _GLIBCXX_USE_CONSTEXPR bool has_infinity = false; | |
627 | static _GLIBCXX_USE_CONSTEXPR bool has_quiet_NaN = false; | |
628 | static _GLIBCXX_USE_CONSTEXPR bool has_signaling_NaN = false; | |
629 | static _GLIBCXX_USE_CONSTEXPR float_denorm_style has_denorm | |
630 | = denorm_absent; | |
631 | static _GLIBCXX_USE_CONSTEXPR bool has_denorm_loss = false; | |
632 | ||
633 | static _GLIBCXX_CONSTEXPR unsigned char | |
4d4cf144 PC |
634 | infinity() _GLIBCXX_USE_NOEXCEPT |
635 | { return static_cast<unsigned char>(0); } | |
94a86be0 BK |
636 | |
637 | static _GLIBCXX_CONSTEXPR unsigned char | |
4d4cf144 PC |
638 | quiet_NaN() _GLIBCXX_USE_NOEXCEPT |
639 | { return static_cast<unsigned char>(0); } | |
94a86be0 BK |
640 | |
641 | static _GLIBCXX_CONSTEXPR unsigned char | |
4d4cf144 PC |
642 | signaling_NaN() _GLIBCXX_USE_NOEXCEPT |
643 | { return static_cast<unsigned char>(0); } | |
94a86be0 BK |
644 | |
645 | static _GLIBCXX_CONSTEXPR unsigned char | |
4d4cf144 PC |
646 | denorm_min() _GLIBCXX_USE_NOEXCEPT |
647 | { return static_cast<unsigned char>(0); } | |
94a86be0 BK |
648 | |
649 | static _GLIBCXX_USE_CONSTEXPR bool is_iec559 = false; | |
650 | static _GLIBCXX_USE_CONSTEXPR bool is_bounded = true; | |
651 | static _GLIBCXX_USE_CONSTEXPR bool is_modulo = true; | |
652 | ||
653 | static _GLIBCXX_USE_CONSTEXPR bool traps = __glibcxx_integral_traps; | |
654 | static _GLIBCXX_USE_CONSTEXPR bool tinyness_before = false; | |
655 | static _GLIBCXX_USE_CONSTEXPR float_round_style round_style | |
656 | = round_toward_zero; | |
54c1bf78 BK |
657 | }; |
658 | ||
0aa06b18 | 659 | /// numeric_limits<wchar_t> specialization. |
54c1bf78 BK |
660 | template<> |
661 | struct numeric_limits<wchar_t> | |
662 | { | |
94a86be0 BK |
663 | static _GLIBCXX_USE_CONSTEXPR bool is_specialized = true; |
664 | ||
665 | static _GLIBCXX_CONSTEXPR wchar_t | |
4d4cf144 | 666 | min() _GLIBCXX_USE_NOEXCEPT { return __glibcxx_min (wchar_t); } |
94a86be0 BK |
667 | |
668 | static _GLIBCXX_CONSTEXPR wchar_t | |
4d4cf144 | 669 | max() _GLIBCXX_USE_NOEXCEPT { return __glibcxx_max (wchar_t); } |
54c1bf78 | 670 | |
734f5023 | 671 | #if __cplusplus >= 201103L |
4d4cf144 PC |
672 | static constexpr wchar_t |
673 | lowest() noexcept { return min(); } | |
018afad3 | 674 | #endif |
54c1bf78 | 675 | |
94a86be0 BK |
676 | static _GLIBCXX_USE_CONSTEXPR int digits = __glibcxx_digits (wchar_t); |
677 | static _GLIBCXX_USE_CONSTEXPR int digits10 | |
678 | = __glibcxx_digits10 (wchar_t); | |
734f5023 | 679 | #if __cplusplus >= 201103L |
94a86be0 | 680 | static constexpr int max_digits10 = 0; |
018afad3 | 681 | #endif |
94a86be0 BK |
682 | static _GLIBCXX_USE_CONSTEXPR bool is_signed = __glibcxx_signed (wchar_t); |
683 | static _GLIBCXX_USE_CONSTEXPR bool is_integer = true; | |
684 | static _GLIBCXX_USE_CONSTEXPR bool is_exact = true; | |
685 | static _GLIBCXX_USE_CONSTEXPR int radix = 2; | |
686 | ||
687 | static _GLIBCXX_CONSTEXPR wchar_t | |
4d4cf144 | 688 | epsilon() _GLIBCXX_USE_NOEXCEPT { return 0; } |
94a86be0 BK |
689 | |
690 | static _GLIBCXX_CONSTEXPR wchar_t | |
4d4cf144 | 691 | round_error() _GLIBCXX_USE_NOEXCEPT { return 0; } |
94a86be0 BK |
692 | |
693 | static _GLIBCXX_USE_CONSTEXPR int min_exponent = 0; | |
694 | static _GLIBCXX_USE_CONSTEXPR int min_exponent10 = 0; | |
695 | static _GLIBCXX_USE_CONSTEXPR int max_exponent = 0; | |
696 | static _GLIBCXX_USE_CONSTEXPR int max_exponent10 = 0; | |
697 | ||
698 | static _GLIBCXX_USE_CONSTEXPR bool has_infinity = false; | |
699 | static _GLIBCXX_USE_CONSTEXPR bool has_quiet_NaN = false; | |
700 | static _GLIBCXX_USE_CONSTEXPR bool has_signaling_NaN = false; | |
701 | static _GLIBCXX_USE_CONSTEXPR float_denorm_style has_denorm | |
702 | = denorm_absent; | |
703 | static _GLIBCXX_USE_CONSTEXPR bool has_denorm_loss = false; | |
704 | ||
705 | static _GLIBCXX_CONSTEXPR wchar_t | |
4d4cf144 | 706 | infinity() _GLIBCXX_USE_NOEXCEPT { return wchar_t(); } |
94a86be0 BK |
707 | |
708 | static _GLIBCXX_CONSTEXPR wchar_t | |
4d4cf144 | 709 | quiet_NaN() _GLIBCXX_USE_NOEXCEPT { return wchar_t(); } |
94a86be0 BK |
710 | |
711 | static _GLIBCXX_CONSTEXPR wchar_t | |
4d4cf144 | 712 | signaling_NaN() _GLIBCXX_USE_NOEXCEPT { return wchar_t(); } |
94a86be0 BK |
713 | |
714 | static _GLIBCXX_CONSTEXPR wchar_t | |
4d4cf144 | 715 | denorm_min() _GLIBCXX_USE_NOEXCEPT { return wchar_t(); } |
94a86be0 BK |
716 | |
717 | static _GLIBCXX_USE_CONSTEXPR bool is_iec559 = false; | |
718 | static _GLIBCXX_USE_CONSTEXPR bool is_bounded = true; | |
1c830087 | 719 | static _GLIBCXX_USE_CONSTEXPR bool is_modulo = !is_signed; |
94a86be0 BK |
720 | |
721 | static _GLIBCXX_USE_CONSTEXPR bool traps = __glibcxx_integral_traps; | |
722 | static _GLIBCXX_USE_CONSTEXPR bool tinyness_before = false; | |
723 | static _GLIBCXX_USE_CONSTEXPR float_round_style round_style | |
724 | = round_toward_zero; | |
54c1bf78 BK |
725 | }; |
726 | ||
734f5023 | 727 | #if __cplusplus >= 201103L |
5fb0445d PC |
728 | /// numeric_limits<char16_t> specialization. |
729 | template<> | |
730 | struct numeric_limits<char16_t> | |
731 | { | |
4d4cf144 | 732 | static constexpr bool is_specialized = true; |
94a86be0 | 733 | |
4d4cf144 PC |
734 | static constexpr char16_t |
735 | min() noexcept { return __glibcxx_min (char16_t); } | |
94a86be0 | 736 | |
4d4cf144 PC |
737 | static constexpr char16_t |
738 | max() noexcept { return __glibcxx_max (char16_t); } | |
5fb0445d | 739 | |
94a86be0 | 740 | static constexpr char16_t |
4d4cf144 | 741 | lowest() noexcept { return min(); } |
5fb0445d | 742 | |
4d4cf144 PC |
743 | static constexpr int digits = __glibcxx_digits (char16_t); |
744 | static constexpr int digits10 = __glibcxx_digits10 (char16_t); | |
94a86be0 | 745 | static constexpr int max_digits10 = 0; |
4d4cf144 PC |
746 | static constexpr bool is_signed = __glibcxx_signed (char16_t); |
747 | static constexpr bool is_integer = true; | |
748 | static constexpr bool is_exact = true; | |
749 | static constexpr int radix = 2; | |
94a86be0 | 750 | |
4d4cf144 PC |
751 | static constexpr char16_t |
752 | epsilon() noexcept { return 0; } | |
94a86be0 | 753 | |
4d4cf144 PC |
754 | static constexpr char16_t |
755 | round_error() noexcept { return 0; } | |
94a86be0 | 756 | |
4d4cf144 PC |
757 | static constexpr int min_exponent = 0; |
758 | static constexpr int min_exponent10 = 0; | |
759 | static constexpr int max_exponent = 0; | |
760 | static constexpr int max_exponent10 = 0; | |
94a86be0 | 761 | |
4d4cf144 PC |
762 | static constexpr bool has_infinity = false; |
763 | static constexpr bool has_quiet_NaN = false; | |
764 | static constexpr bool has_signaling_NaN = false; | |
765 | static constexpr float_denorm_style has_denorm = denorm_absent; | |
766 | static constexpr bool has_denorm_loss = false; | |
94a86be0 | 767 | |
4d4cf144 PC |
768 | static constexpr char16_t |
769 | infinity() noexcept { return char16_t(); } | |
94a86be0 | 770 | |
4d4cf144 PC |
771 | static constexpr char16_t |
772 | quiet_NaN() noexcept { return char16_t(); } | |
94a86be0 | 773 | |
4d4cf144 PC |
774 | static constexpr char16_t |
775 | signaling_NaN() noexcept { return char16_t(); } | |
94a86be0 | 776 | |
4d4cf144 PC |
777 | static constexpr char16_t |
778 | denorm_min() noexcept { return char16_t(); } | |
94a86be0 | 779 | |
4d4cf144 PC |
780 | static constexpr bool is_iec559 = false; |
781 | static constexpr bool is_bounded = true; | |
1c830087 | 782 | static constexpr bool is_modulo = !is_signed; |
94a86be0 | 783 | |
4d4cf144 PC |
784 | static constexpr bool traps = __glibcxx_integral_traps; |
785 | static constexpr bool tinyness_before = false; | |
786 | static constexpr float_round_style round_style = round_toward_zero; | |
5fb0445d PC |
787 | }; |
788 | ||
789 | /// numeric_limits<char32_t> specialization. | |
790 | template<> | |
791 | struct numeric_limits<char32_t> | |
792 | { | |
4d4cf144 | 793 | static constexpr bool is_specialized = true; |
94a86be0 | 794 | |
4d4cf144 PC |
795 | static constexpr char32_t |
796 | min() noexcept { return __glibcxx_min (char32_t); } | |
94a86be0 | 797 | |
4d4cf144 PC |
798 | static constexpr char32_t |
799 | max() noexcept { return __glibcxx_max (char32_t); } | |
5fb0445d | 800 | |
94a86be0 | 801 | static constexpr char32_t |
4d4cf144 | 802 | lowest() noexcept { return min(); } |
5fb0445d | 803 | |
4d4cf144 PC |
804 | static constexpr int digits = __glibcxx_digits (char32_t); |
805 | static constexpr int digits10 = __glibcxx_digits10 (char32_t); | |
94a86be0 | 806 | static constexpr int max_digits10 = 0; |
4d4cf144 PC |
807 | static constexpr bool is_signed = __glibcxx_signed (char32_t); |
808 | static constexpr bool is_integer = true; | |
809 | static constexpr bool is_exact = true; | |
810 | static constexpr int radix = 2; | |
94a86be0 | 811 | |
4d4cf144 PC |
812 | static constexpr char32_t |
813 | epsilon() noexcept { return 0; } | |
94a86be0 | 814 | |
4d4cf144 PC |
815 | static constexpr char32_t |
816 | round_error() noexcept { return 0; } | |
94a86be0 | 817 | |
4d4cf144 PC |
818 | static constexpr int min_exponent = 0; |
819 | static constexpr int min_exponent10 = 0; | |
820 | static constexpr int max_exponent = 0; | |
821 | static constexpr int max_exponent10 = 0; | |
94a86be0 | 822 | |
4d4cf144 PC |
823 | static constexpr bool has_infinity = false; |
824 | static constexpr bool has_quiet_NaN = false; | |
825 | static constexpr bool has_signaling_NaN = false; | |
826 | static constexpr float_denorm_style has_denorm = denorm_absent; | |
827 | static constexpr bool has_denorm_loss = false; | |
94a86be0 | 828 | |
4d4cf144 PC |
829 | static constexpr char32_t |
830 | infinity() noexcept { return char32_t(); } | |
94a86be0 | 831 | |
4d4cf144 PC |
832 | static constexpr char32_t |
833 | quiet_NaN() noexcept { return char32_t(); } | |
94a86be0 | 834 | |
4d4cf144 PC |
835 | static constexpr char32_t |
836 | signaling_NaN() noexcept { return char32_t(); } | |
94a86be0 | 837 | |
4d4cf144 PC |
838 | static constexpr char32_t |
839 | denorm_min() noexcept { return char32_t(); } | |
94a86be0 | 840 | |
4d4cf144 PC |
841 | static constexpr bool is_iec559 = false; |
842 | static constexpr bool is_bounded = true; | |
1c830087 | 843 | static constexpr bool is_modulo = !is_signed; |
94a86be0 | 844 | |
4d4cf144 PC |
845 | static constexpr bool traps = __glibcxx_integral_traps; |
846 | static constexpr bool tinyness_before = false; | |
847 | static constexpr float_round_style round_style = round_toward_zero; | |
5fb0445d PC |
848 | }; |
849 | #endif | |
850 | ||
0aa06b18 | 851 | /// numeric_limits<short> specialization. |
54c1bf78 BK |
852 | template<> |
853 | struct numeric_limits<short> | |
854 | { | |
94a86be0 BK |
855 | static _GLIBCXX_USE_CONSTEXPR bool is_specialized = true; |
856 | ||
857 | static _GLIBCXX_CONSTEXPR short | |
4d4cf144 | 858 | min() _GLIBCXX_USE_NOEXCEPT { return -__SHRT_MAX__ - 1; } |
94a86be0 BK |
859 | |
860 | static _GLIBCXX_CONSTEXPR short | |
4d4cf144 | 861 | max() _GLIBCXX_USE_NOEXCEPT { return __SHRT_MAX__; } |
54c1bf78 | 862 | |
734f5023 | 863 | #if __cplusplus >= 201103L |
94a86be0 | 864 | static constexpr short |
4d4cf144 | 865 | lowest() noexcept { return min(); } |
018afad3 | 866 | #endif |
54c1bf78 | 867 | |
94a86be0 BK |
868 | static _GLIBCXX_USE_CONSTEXPR int digits = __glibcxx_digits (short); |
869 | static _GLIBCXX_USE_CONSTEXPR int digits10 = __glibcxx_digits10 (short); | |
734f5023 | 870 | #if __cplusplus >= 201103L |
94a86be0 | 871 | static constexpr int max_digits10 = 0; |
018afad3 | 872 | #endif |
94a86be0 BK |
873 | static _GLIBCXX_USE_CONSTEXPR bool is_signed = true; |
874 | static _GLIBCXX_USE_CONSTEXPR bool is_integer = true; | |
875 | static _GLIBCXX_USE_CONSTEXPR bool is_exact = true; | |
876 | static _GLIBCXX_USE_CONSTEXPR int radix = 2; | |
877 | ||
878 | static _GLIBCXX_CONSTEXPR short | |
4d4cf144 | 879 | epsilon() _GLIBCXX_USE_NOEXCEPT { return 0; } |
94a86be0 BK |
880 | |
881 | static _GLIBCXX_CONSTEXPR short | |
4d4cf144 | 882 | round_error() _GLIBCXX_USE_NOEXCEPT { return 0; } |
94a86be0 BK |
883 | |
884 | static _GLIBCXX_USE_CONSTEXPR int min_exponent = 0; | |
885 | static _GLIBCXX_USE_CONSTEXPR int min_exponent10 = 0; | |
886 | static _GLIBCXX_USE_CONSTEXPR int max_exponent = 0; | |
887 | static _GLIBCXX_USE_CONSTEXPR int max_exponent10 = 0; | |
888 | ||
889 | static _GLIBCXX_USE_CONSTEXPR bool has_infinity = false; | |
890 | static _GLIBCXX_USE_CONSTEXPR bool has_quiet_NaN = false; | |
891 | static _GLIBCXX_USE_CONSTEXPR bool has_signaling_NaN = false; | |
892 | static _GLIBCXX_USE_CONSTEXPR float_denorm_style has_denorm | |
893 | = denorm_absent; | |
894 | static _GLIBCXX_USE_CONSTEXPR bool has_denorm_loss = false; | |
895 | ||
896 | static _GLIBCXX_CONSTEXPR short | |
4d4cf144 | 897 | infinity() _GLIBCXX_USE_NOEXCEPT { return short(); } |
94a86be0 BK |
898 | |
899 | static _GLIBCXX_CONSTEXPR short | |
4d4cf144 | 900 | quiet_NaN() _GLIBCXX_USE_NOEXCEPT { return short(); } |
94a86be0 BK |
901 | |
902 | static _GLIBCXX_CONSTEXPR short | |
4d4cf144 | 903 | signaling_NaN() _GLIBCXX_USE_NOEXCEPT { return short(); } |
94a86be0 BK |
904 | |
905 | static _GLIBCXX_CONSTEXPR short | |
4d4cf144 | 906 | denorm_min() _GLIBCXX_USE_NOEXCEPT { return short(); } |
94a86be0 BK |
907 | |
908 | static _GLIBCXX_USE_CONSTEXPR bool is_iec559 = false; | |
909 | static _GLIBCXX_USE_CONSTEXPR bool is_bounded = true; | |
1c830087 | 910 | static _GLIBCXX_USE_CONSTEXPR bool is_modulo = false; |
94a86be0 BK |
911 | |
912 | static _GLIBCXX_USE_CONSTEXPR bool traps = __glibcxx_integral_traps; | |
913 | static _GLIBCXX_USE_CONSTEXPR bool tinyness_before = false; | |
914 | static _GLIBCXX_USE_CONSTEXPR float_round_style round_style | |
915 | = round_toward_zero; | |
54c1bf78 BK |
916 | }; |
917 | ||
0aa06b18 | 918 | /// numeric_limits<unsigned short> specialization. |
54c1bf78 BK |
919 | template<> |
920 | struct numeric_limits<unsigned short> | |
921 | { | |
94a86be0 BK |
922 | static _GLIBCXX_USE_CONSTEXPR bool is_specialized = true; |
923 | ||
924 | static _GLIBCXX_CONSTEXPR unsigned short | |
4d4cf144 | 925 | min() _GLIBCXX_USE_NOEXCEPT { return 0; } |
94a86be0 BK |
926 | |
927 | static _GLIBCXX_CONSTEXPR unsigned short | |
4d4cf144 | 928 | max() _GLIBCXX_USE_NOEXCEPT { return __SHRT_MAX__ * 2U + 1; } |
54c1bf78 | 929 | |
734f5023 | 930 | #if __cplusplus >= 201103L |
94a86be0 | 931 | static constexpr unsigned short |
4d4cf144 | 932 | lowest() noexcept { return min(); } |
018afad3 | 933 | #endif |
54c1bf78 | 934 | |
94a86be0 BK |
935 | static _GLIBCXX_USE_CONSTEXPR int digits |
936 | = __glibcxx_digits (unsigned short); | |
937 | static _GLIBCXX_USE_CONSTEXPR int digits10 | |
938 | = __glibcxx_digits10 (unsigned short); | |
734f5023 | 939 | #if __cplusplus >= 201103L |
94a86be0 | 940 | static constexpr int max_digits10 = 0; |
018afad3 | 941 | #endif |
94a86be0 BK |
942 | static _GLIBCXX_USE_CONSTEXPR bool is_signed = false; |
943 | static _GLIBCXX_USE_CONSTEXPR bool is_integer = true; | |
944 | static _GLIBCXX_USE_CONSTEXPR bool is_exact = true; | |
945 | static _GLIBCXX_USE_CONSTEXPR int radix = 2; | |
946 | ||
947 | static _GLIBCXX_CONSTEXPR unsigned short | |
4d4cf144 | 948 | epsilon() _GLIBCXX_USE_NOEXCEPT { return 0; } |
94a86be0 BK |
949 | |
950 | static _GLIBCXX_CONSTEXPR unsigned short | |
4d4cf144 | 951 | round_error() _GLIBCXX_USE_NOEXCEPT { return 0; } |
94a86be0 BK |
952 | |
953 | static _GLIBCXX_USE_CONSTEXPR int min_exponent = 0; | |
954 | static _GLIBCXX_USE_CONSTEXPR int min_exponent10 = 0; | |
955 | static _GLIBCXX_USE_CONSTEXPR int max_exponent = 0; | |
956 | static _GLIBCXX_USE_CONSTEXPR int max_exponent10 = 0; | |
957 | ||
958 | static _GLIBCXX_USE_CONSTEXPR bool has_infinity = false; | |
959 | static _GLIBCXX_USE_CONSTEXPR bool has_quiet_NaN = false; | |
960 | static _GLIBCXX_USE_CONSTEXPR bool has_signaling_NaN = false; | |
961 | static _GLIBCXX_USE_CONSTEXPR float_denorm_style has_denorm | |
962 | = denorm_absent; | |
963 | static _GLIBCXX_USE_CONSTEXPR bool has_denorm_loss = false; | |
964 | ||
965 | static _GLIBCXX_CONSTEXPR unsigned short | |
4d4cf144 PC |
966 | infinity() _GLIBCXX_USE_NOEXCEPT |
967 | { return static_cast<unsigned short>(0); } | |
94a86be0 BK |
968 | |
969 | static _GLIBCXX_CONSTEXPR unsigned short | |
4d4cf144 PC |
970 | quiet_NaN() _GLIBCXX_USE_NOEXCEPT |
971 | { return static_cast<unsigned short>(0); } | |
94a86be0 BK |
972 | |
973 | static _GLIBCXX_CONSTEXPR unsigned short | |
4d4cf144 PC |
974 | signaling_NaN() _GLIBCXX_USE_NOEXCEPT |
975 | { return static_cast<unsigned short>(0); } | |
94a86be0 BK |
976 | |
977 | static _GLIBCXX_CONSTEXPR unsigned short | |
4d4cf144 PC |
978 | denorm_min() _GLIBCXX_USE_NOEXCEPT |
979 | { return static_cast<unsigned short>(0); } | |
94a86be0 BK |
980 | |
981 | static _GLIBCXX_USE_CONSTEXPR bool is_iec559 = false; | |
982 | static _GLIBCXX_USE_CONSTEXPR bool is_bounded = true; | |
983 | static _GLIBCXX_USE_CONSTEXPR bool is_modulo = true; | |
984 | ||
985 | static _GLIBCXX_USE_CONSTEXPR bool traps = __glibcxx_integral_traps; | |
986 | static _GLIBCXX_USE_CONSTEXPR bool tinyness_before = false; | |
987 | static _GLIBCXX_USE_CONSTEXPR float_round_style round_style | |
988 | = round_toward_zero; | |
54c1bf78 BK |
989 | }; |
990 | ||
0aa06b18 | 991 | /// numeric_limits<int> specialization. |
54c1bf78 BK |
992 | template<> |
993 | struct numeric_limits<int> | |
994 | { | |
94a86be0 BK |
995 | static _GLIBCXX_USE_CONSTEXPR bool is_specialized = true; |
996 | ||
997 | static _GLIBCXX_CONSTEXPR int | |
4d4cf144 | 998 | min() _GLIBCXX_USE_NOEXCEPT { return -__INT_MAX__ - 1; } |
94a86be0 BK |
999 | |
1000 | static _GLIBCXX_CONSTEXPR int | |
4d4cf144 | 1001 | max() _GLIBCXX_USE_NOEXCEPT { return __INT_MAX__; } |
54c1bf78 | 1002 | |
734f5023 | 1003 | #if __cplusplus >= 201103L |
94a86be0 | 1004 | static constexpr int |
4d4cf144 | 1005 | lowest() noexcept { return min(); } |
018afad3 | 1006 | #endif |
54c1bf78 | 1007 | |
94a86be0 BK |
1008 | static _GLIBCXX_USE_CONSTEXPR int digits = __glibcxx_digits (int); |
1009 | static _GLIBCXX_USE_CONSTEXPR int digits10 = __glibcxx_digits10 (int); | |
734f5023 | 1010 | #if __cplusplus >= 201103L |
94a86be0 | 1011 | static constexpr int max_digits10 = 0; |
018afad3 | 1012 | #endif |
94a86be0 BK |
1013 | static _GLIBCXX_USE_CONSTEXPR bool is_signed = true; |
1014 | static _GLIBCXX_USE_CONSTEXPR bool is_integer = true; | |
1015 | static _GLIBCXX_USE_CONSTEXPR bool is_exact = true; | |
1016 | static _GLIBCXX_USE_CONSTEXPR int radix = 2; | |
1017 | ||
1018 | static _GLIBCXX_CONSTEXPR int | |
4d4cf144 | 1019 | epsilon() _GLIBCXX_USE_NOEXCEPT { return 0; } |
94a86be0 BK |
1020 | |
1021 | static _GLIBCXX_CONSTEXPR int | |
4d4cf144 | 1022 | round_error() _GLIBCXX_USE_NOEXCEPT { return 0; } |
94a86be0 BK |
1023 | |
1024 | static _GLIBCXX_USE_CONSTEXPR int min_exponent = 0; | |
1025 | static _GLIBCXX_USE_CONSTEXPR int min_exponent10 = 0; | |
1026 | static _GLIBCXX_USE_CONSTEXPR int max_exponent = 0; | |
1027 | static _GLIBCXX_USE_CONSTEXPR int max_exponent10 = 0; | |
1028 | ||
1029 | static _GLIBCXX_USE_CONSTEXPR bool has_infinity = false; | |
1030 | static _GLIBCXX_USE_CONSTEXPR bool has_quiet_NaN = false; | |
1031 | static _GLIBCXX_USE_CONSTEXPR bool has_signaling_NaN = false; | |
1032 | static _GLIBCXX_USE_CONSTEXPR float_denorm_style has_denorm | |
1033 | = denorm_absent; | |
1034 | static _GLIBCXX_USE_CONSTEXPR bool has_denorm_loss = false; | |
1035 | ||
1036 | static _GLIBCXX_CONSTEXPR int | |
4d4cf144 | 1037 | infinity() _GLIBCXX_USE_NOEXCEPT { return static_cast<int>(0); } |
94a86be0 BK |
1038 | |
1039 | static _GLIBCXX_CONSTEXPR int | |
4d4cf144 | 1040 | quiet_NaN() _GLIBCXX_USE_NOEXCEPT { return static_cast<int>(0); } |
94a86be0 BK |
1041 | |
1042 | static _GLIBCXX_CONSTEXPR int | |
4d4cf144 | 1043 | signaling_NaN() _GLIBCXX_USE_NOEXCEPT { return static_cast<int>(0); } |
94a86be0 BK |
1044 | |
1045 | static _GLIBCXX_CONSTEXPR int | |
4d4cf144 | 1046 | denorm_min() _GLIBCXX_USE_NOEXCEPT { return static_cast<int>(0); } |
94a86be0 BK |
1047 | |
1048 | static _GLIBCXX_USE_CONSTEXPR bool is_iec559 = false; | |
1049 | static _GLIBCXX_USE_CONSTEXPR bool is_bounded = true; | |
1c830087 | 1050 | static _GLIBCXX_USE_CONSTEXPR bool is_modulo = false; |
94a86be0 BK |
1051 | |
1052 | static _GLIBCXX_USE_CONSTEXPR bool traps = __glibcxx_integral_traps; | |
1053 | static _GLIBCXX_USE_CONSTEXPR bool tinyness_before = false; | |
1054 | static _GLIBCXX_USE_CONSTEXPR float_round_style round_style | |
1055 | = round_toward_zero; | |
54c1bf78 BK |
1056 | }; |
1057 | ||
0aa06b18 | 1058 | /// numeric_limits<unsigned int> specialization. |
54c1bf78 BK |
1059 | template<> |
1060 | struct numeric_limits<unsigned int> | |
1061 | { | |
94a86be0 BK |
1062 | static _GLIBCXX_USE_CONSTEXPR bool is_specialized = true; |
1063 | ||
1064 | static _GLIBCXX_CONSTEXPR unsigned int | |
4d4cf144 | 1065 | min() _GLIBCXX_USE_NOEXCEPT { return 0; } |
94a86be0 BK |
1066 | |
1067 | static _GLIBCXX_CONSTEXPR unsigned int | |
4d4cf144 | 1068 | max() _GLIBCXX_USE_NOEXCEPT { return __INT_MAX__ * 2U + 1; } |
54c1bf78 | 1069 | |
734f5023 | 1070 | #if __cplusplus >= 201103L |
94a86be0 | 1071 | static constexpr unsigned int |
4d4cf144 | 1072 | lowest() noexcept { return min(); } |
018afad3 | 1073 | #endif |
54c1bf78 | 1074 | |
94a86be0 BK |
1075 | static _GLIBCXX_USE_CONSTEXPR int digits |
1076 | = __glibcxx_digits (unsigned int); | |
1077 | static _GLIBCXX_USE_CONSTEXPR int digits10 | |
1078 | = __glibcxx_digits10 (unsigned int); | |
734f5023 | 1079 | #if __cplusplus >= 201103L |
94a86be0 | 1080 | static constexpr int max_digits10 = 0; |
018afad3 | 1081 | #endif |
94a86be0 BK |
1082 | static _GLIBCXX_USE_CONSTEXPR bool is_signed = false; |
1083 | static _GLIBCXX_USE_CONSTEXPR bool is_integer = true; | |
1084 | static _GLIBCXX_USE_CONSTEXPR bool is_exact = true; | |
1085 | static _GLIBCXX_USE_CONSTEXPR int radix = 2; | |
1086 | ||
1087 | static _GLIBCXX_CONSTEXPR unsigned int | |
4d4cf144 | 1088 | epsilon() _GLIBCXX_USE_NOEXCEPT { return 0; } |
94a86be0 BK |
1089 | |
1090 | static _GLIBCXX_CONSTEXPR unsigned int | |
4d4cf144 | 1091 | round_error() _GLIBCXX_USE_NOEXCEPT { return 0; } |
94a86be0 BK |
1092 | |
1093 | static _GLIBCXX_USE_CONSTEXPR int min_exponent = 0; | |
1094 | static _GLIBCXX_USE_CONSTEXPR int min_exponent10 = 0; | |
1095 | static _GLIBCXX_USE_CONSTEXPR int max_exponent = 0; | |
1096 | static _GLIBCXX_USE_CONSTEXPR int max_exponent10 = 0; | |
1097 | ||
1098 | static _GLIBCXX_USE_CONSTEXPR bool has_infinity = false; | |
1099 | static _GLIBCXX_USE_CONSTEXPR bool has_quiet_NaN = false; | |
1100 | static _GLIBCXX_USE_CONSTEXPR bool has_signaling_NaN = false; | |
1101 | static _GLIBCXX_USE_CONSTEXPR float_denorm_style has_denorm | |
1102 | = denorm_absent; | |
1103 | static _GLIBCXX_USE_CONSTEXPR bool has_denorm_loss = false; | |
1104 | ||
1105 | static _GLIBCXX_CONSTEXPR unsigned int | |
4d4cf144 | 1106 | infinity() _GLIBCXX_USE_NOEXCEPT { return static_cast<unsigned int>(0); } |
94a86be0 BK |
1107 | |
1108 | static _GLIBCXX_CONSTEXPR unsigned int | |
4d4cf144 PC |
1109 | quiet_NaN() _GLIBCXX_USE_NOEXCEPT |
1110 | { return static_cast<unsigned int>(0); } | |
94a86be0 BK |
1111 | |
1112 | static _GLIBCXX_CONSTEXPR unsigned int | |
4d4cf144 PC |
1113 | signaling_NaN() _GLIBCXX_USE_NOEXCEPT |
1114 | { return static_cast<unsigned int>(0); } | |
94a86be0 BK |
1115 | |
1116 | static _GLIBCXX_CONSTEXPR unsigned int | |
4d4cf144 PC |
1117 | denorm_min() _GLIBCXX_USE_NOEXCEPT |
1118 | { return static_cast<unsigned int>(0); } | |
94a86be0 BK |
1119 | |
1120 | static _GLIBCXX_USE_CONSTEXPR bool is_iec559 = false; | |
1121 | static _GLIBCXX_USE_CONSTEXPR bool is_bounded = true; | |
1122 | static _GLIBCXX_USE_CONSTEXPR bool is_modulo = true; | |
1123 | ||
1124 | static _GLIBCXX_USE_CONSTEXPR bool traps = __glibcxx_integral_traps; | |
1125 | static _GLIBCXX_USE_CONSTEXPR bool tinyness_before = false; | |
1126 | static _GLIBCXX_USE_CONSTEXPR float_round_style round_style | |
1127 | = round_toward_zero; | |
54c1bf78 BK |
1128 | }; |
1129 | ||
0aa06b18 | 1130 | /// numeric_limits<long> specialization. |
54c1bf78 BK |
1131 | template<> |
1132 | struct numeric_limits<long> | |
1133 | { | |
94a86be0 BK |
1134 | static _GLIBCXX_USE_CONSTEXPR bool is_specialized = true; |
1135 | ||
1136 | static _GLIBCXX_CONSTEXPR long | |
4d4cf144 | 1137 | min() _GLIBCXX_USE_NOEXCEPT { return -__LONG_MAX__ - 1; } |
94a86be0 BK |
1138 | |
1139 | static _GLIBCXX_CONSTEXPR long | |
4d4cf144 | 1140 | max() _GLIBCXX_USE_NOEXCEPT { return __LONG_MAX__; } |
54c1bf78 | 1141 | |
734f5023 | 1142 | #if __cplusplus >= 201103L |
94a86be0 | 1143 | static constexpr long |
4d4cf144 | 1144 | lowest() noexcept { return min(); } |
018afad3 | 1145 | #endif |
54c1bf78 | 1146 | |
94a86be0 BK |
1147 | static _GLIBCXX_USE_CONSTEXPR int digits = __glibcxx_digits (long); |
1148 | static _GLIBCXX_USE_CONSTEXPR int digits10 = __glibcxx_digits10 (long); | |
734f5023 | 1149 | #if __cplusplus >= 201103L |
94a86be0 | 1150 | static constexpr int max_digits10 = 0; |
018afad3 | 1151 | #endif |
94a86be0 BK |
1152 | static _GLIBCXX_USE_CONSTEXPR bool is_signed = true; |
1153 | static _GLIBCXX_USE_CONSTEXPR bool is_integer = true; | |
1154 | static _GLIBCXX_USE_CONSTEXPR bool is_exact = true; | |
1155 | static _GLIBCXX_USE_CONSTEXPR int radix = 2; | |
1156 | ||
1157 | static _GLIBCXX_CONSTEXPR long | |
4d4cf144 | 1158 | epsilon() _GLIBCXX_USE_NOEXCEPT { return 0; } |
94a86be0 BK |
1159 | |
1160 | static _GLIBCXX_CONSTEXPR long | |
4d4cf144 | 1161 | round_error() _GLIBCXX_USE_NOEXCEPT { return 0; } |
94a86be0 BK |
1162 | |
1163 | static _GLIBCXX_USE_CONSTEXPR int min_exponent = 0; | |
1164 | static _GLIBCXX_USE_CONSTEXPR int min_exponent10 = 0; | |
1165 | static _GLIBCXX_USE_CONSTEXPR int max_exponent = 0; | |
1166 | static _GLIBCXX_USE_CONSTEXPR int max_exponent10 = 0; | |
1167 | ||
1168 | static _GLIBCXX_USE_CONSTEXPR bool has_infinity = false; | |
1169 | static _GLIBCXX_USE_CONSTEXPR bool has_quiet_NaN = false; | |
1170 | static _GLIBCXX_USE_CONSTEXPR bool has_signaling_NaN = false; | |
1171 | static _GLIBCXX_USE_CONSTEXPR float_denorm_style has_denorm | |
1172 | = denorm_absent; | |
1173 | static _GLIBCXX_USE_CONSTEXPR bool has_denorm_loss = false; | |
1174 | ||
1175 | static _GLIBCXX_CONSTEXPR long | |
4d4cf144 | 1176 | infinity() _GLIBCXX_USE_NOEXCEPT { return static_cast<long>(0); } |
94a86be0 BK |
1177 | |
1178 | static _GLIBCXX_CONSTEXPR long | |
4d4cf144 | 1179 | quiet_NaN() _GLIBCXX_USE_NOEXCEPT { return static_cast<long>(0); } |
94a86be0 BK |
1180 | |
1181 | static _GLIBCXX_CONSTEXPR long | |
4d4cf144 | 1182 | signaling_NaN() _GLIBCXX_USE_NOEXCEPT { return static_cast<long>(0); } |
94a86be0 BK |
1183 | |
1184 | static _GLIBCXX_CONSTEXPR long | |
4d4cf144 | 1185 | denorm_min() _GLIBCXX_USE_NOEXCEPT { return static_cast<long>(0); } |
94a86be0 BK |
1186 | |
1187 | static _GLIBCXX_USE_CONSTEXPR bool is_iec559 = false; | |
1188 | static _GLIBCXX_USE_CONSTEXPR bool is_bounded = true; | |
1c830087 | 1189 | static _GLIBCXX_USE_CONSTEXPR bool is_modulo = false; |
94a86be0 BK |
1190 | |
1191 | static _GLIBCXX_USE_CONSTEXPR bool traps = __glibcxx_integral_traps; | |
1192 | static _GLIBCXX_USE_CONSTEXPR bool tinyness_before = false; | |
1193 | static _GLIBCXX_USE_CONSTEXPR float_round_style round_style | |
1194 | = round_toward_zero; | |
54c1bf78 BK |
1195 | }; |
1196 | ||
0aa06b18 | 1197 | /// numeric_limits<unsigned long> specialization. |
54c1bf78 BK |
1198 | template<> |
1199 | struct numeric_limits<unsigned long> | |
1200 | { | |
94a86be0 BK |
1201 | static _GLIBCXX_USE_CONSTEXPR bool is_specialized = true; |
1202 | ||
1203 | static _GLIBCXX_CONSTEXPR unsigned long | |
4d4cf144 | 1204 | min() _GLIBCXX_USE_NOEXCEPT { return 0; } |
94a86be0 BK |
1205 | |
1206 | static _GLIBCXX_CONSTEXPR unsigned long | |
4d4cf144 | 1207 | max() _GLIBCXX_USE_NOEXCEPT { return __LONG_MAX__ * 2UL + 1; } |
54c1bf78 | 1208 | |
734f5023 | 1209 | #if __cplusplus >= 201103L |
94a86be0 | 1210 | static constexpr unsigned long |
4d4cf144 | 1211 | lowest() noexcept { return min(); } |
018afad3 | 1212 | #endif |
54c1bf78 | 1213 | |
94a86be0 BK |
1214 | static _GLIBCXX_USE_CONSTEXPR int digits |
1215 | = __glibcxx_digits (unsigned long); | |
1216 | static _GLIBCXX_USE_CONSTEXPR int digits10 | |
1217 | = __glibcxx_digits10 (unsigned long); | |
734f5023 | 1218 | #if __cplusplus >= 201103L |
94a86be0 | 1219 | static constexpr int max_digits10 = 0; |
018afad3 | 1220 | #endif |
94a86be0 BK |
1221 | static _GLIBCXX_USE_CONSTEXPR bool is_signed = false; |
1222 | static _GLIBCXX_USE_CONSTEXPR bool is_integer = true; | |
1223 | static _GLIBCXX_USE_CONSTEXPR bool is_exact = true; | |
1224 | static _GLIBCXX_USE_CONSTEXPR int radix = 2; | |
1225 | ||
1226 | static _GLIBCXX_CONSTEXPR unsigned long | |
4d4cf144 | 1227 | epsilon() _GLIBCXX_USE_NOEXCEPT { return 0; } |
94a86be0 BK |
1228 | |
1229 | static _GLIBCXX_CONSTEXPR unsigned long | |
4d4cf144 | 1230 | round_error() _GLIBCXX_USE_NOEXCEPT { return 0; } |
94a86be0 BK |
1231 | |
1232 | static _GLIBCXX_USE_CONSTEXPR int min_exponent = 0; | |
1233 | static _GLIBCXX_USE_CONSTEXPR int min_exponent10 = 0; | |
1234 | static _GLIBCXX_USE_CONSTEXPR int max_exponent = 0; | |
1235 | static _GLIBCXX_USE_CONSTEXPR int max_exponent10 = 0; | |
1236 | ||
1237 | static _GLIBCXX_USE_CONSTEXPR bool has_infinity = false; | |
1238 | static _GLIBCXX_USE_CONSTEXPR bool has_quiet_NaN = false; | |
1239 | static _GLIBCXX_USE_CONSTEXPR bool has_signaling_NaN = false; | |
1240 | static _GLIBCXX_USE_CONSTEXPR float_denorm_style has_denorm | |
1241 | = denorm_absent; | |
1242 | static _GLIBCXX_USE_CONSTEXPR bool has_denorm_loss = false; | |
1243 | ||
1244 | static _GLIBCXX_CONSTEXPR unsigned long | |
4d4cf144 PC |
1245 | infinity() _GLIBCXX_USE_NOEXCEPT |
1246 | { return static_cast<unsigned long>(0); } | |
94a86be0 BK |
1247 | |
1248 | static _GLIBCXX_CONSTEXPR unsigned long | |
4d4cf144 PC |
1249 | quiet_NaN() _GLIBCXX_USE_NOEXCEPT |
1250 | { return static_cast<unsigned long>(0); } | |
94a86be0 BK |
1251 | |
1252 | static _GLIBCXX_CONSTEXPR unsigned long | |
4d4cf144 PC |
1253 | signaling_NaN() _GLIBCXX_USE_NOEXCEPT |
1254 | { return static_cast<unsigned long>(0); } | |
94a86be0 BK |
1255 | |
1256 | static _GLIBCXX_CONSTEXPR unsigned long | |
4d4cf144 PC |
1257 | denorm_min() _GLIBCXX_USE_NOEXCEPT |
1258 | { return static_cast<unsigned long>(0); } | |
94a86be0 BK |
1259 | |
1260 | static _GLIBCXX_USE_CONSTEXPR bool is_iec559 = false; | |
1261 | static _GLIBCXX_USE_CONSTEXPR bool is_bounded = true; | |
1262 | static _GLIBCXX_USE_CONSTEXPR bool is_modulo = true; | |
1263 | ||
1264 | static _GLIBCXX_USE_CONSTEXPR bool traps = __glibcxx_integral_traps; | |
1265 | static _GLIBCXX_USE_CONSTEXPR bool tinyness_before = false; | |
1266 | static _GLIBCXX_USE_CONSTEXPR float_round_style round_style | |
1267 | = round_toward_zero; | |
54c1bf78 BK |
1268 | }; |
1269 | ||
0aa06b18 | 1270 | /// numeric_limits<long long> specialization. |
54c1bf78 BK |
1271 | template<> |
1272 | struct numeric_limits<long long> | |
1273 | { | |
94a86be0 BK |
1274 | static _GLIBCXX_USE_CONSTEXPR bool is_specialized = true; |
1275 | ||
1276 | static _GLIBCXX_CONSTEXPR long long | |
4d4cf144 | 1277 | min() _GLIBCXX_USE_NOEXCEPT { return -__LONG_LONG_MAX__ - 1; } |
94a86be0 BK |
1278 | |
1279 | static _GLIBCXX_CONSTEXPR long long | |
4d4cf144 | 1280 | max() _GLIBCXX_USE_NOEXCEPT { return __LONG_LONG_MAX__; } |
6ad8f949 | 1281 | |
734f5023 | 1282 | #if __cplusplus >= 201103L |
94a86be0 | 1283 | static constexpr long long |
4d4cf144 | 1284 | lowest() noexcept { return min(); } |
018afad3 | 1285 | #endif |
6ad8f949 | 1286 | |
94a86be0 BK |
1287 | static _GLIBCXX_USE_CONSTEXPR int digits |
1288 | = __glibcxx_digits (long long); | |
1289 | static _GLIBCXX_USE_CONSTEXPR int digits10 | |
1290 | = __glibcxx_digits10 (long long); | |
734f5023 | 1291 | #if __cplusplus >= 201103L |
94a86be0 | 1292 | static constexpr int max_digits10 = 0; |
018afad3 | 1293 | #endif |
94a86be0 BK |
1294 | static _GLIBCXX_USE_CONSTEXPR bool is_signed = true; |
1295 | static _GLIBCXX_USE_CONSTEXPR bool is_integer = true; | |
1296 | static _GLIBCXX_USE_CONSTEXPR bool is_exact = true; | |
1297 | static _GLIBCXX_USE_CONSTEXPR int radix = 2; | |
1298 | ||
1299 | static _GLIBCXX_CONSTEXPR long long | |
4d4cf144 | 1300 | epsilon() _GLIBCXX_USE_NOEXCEPT { return 0; } |
94a86be0 BK |
1301 | |
1302 | static _GLIBCXX_CONSTEXPR long long | |
4d4cf144 | 1303 | round_error() _GLIBCXX_USE_NOEXCEPT { return 0; } |
94a86be0 BK |
1304 | |
1305 | static _GLIBCXX_USE_CONSTEXPR int min_exponent = 0; | |
1306 | static _GLIBCXX_USE_CONSTEXPR int min_exponent10 = 0; | |
1307 | static _GLIBCXX_USE_CONSTEXPR int max_exponent = 0; | |
1308 | static _GLIBCXX_USE_CONSTEXPR int max_exponent10 = 0; | |
1309 | ||
1310 | static _GLIBCXX_USE_CONSTEXPR bool has_infinity = false; | |
1311 | static _GLIBCXX_USE_CONSTEXPR bool has_quiet_NaN = false; | |
1312 | static _GLIBCXX_USE_CONSTEXPR bool has_signaling_NaN = false; | |
1313 | static _GLIBCXX_USE_CONSTEXPR float_denorm_style has_denorm | |
1314 | = denorm_absent; | |
1315 | static _GLIBCXX_USE_CONSTEXPR bool has_denorm_loss = false; | |
1316 | ||
1317 | static _GLIBCXX_CONSTEXPR long long | |
4d4cf144 | 1318 | infinity() _GLIBCXX_USE_NOEXCEPT { return static_cast<long long>(0); } |
94a86be0 BK |
1319 | |
1320 | static _GLIBCXX_CONSTEXPR long long | |
4d4cf144 | 1321 | quiet_NaN() _GLIBCXX_USE_NOEXCEPT { return static_cast<long long>(0); } |
94a86be0 BK |
1322 | |
1323 | static _GLIBCXX_CONSTEXPR long long | |
4d4cf144 PC |
1324 | signaling_NaN() _GLIBCXX_USE_NOEXCEPT |
1325 | { return static_cast<long long>(0); } | |
94a86be0 BK |
1326 | |
1327 | static _GLIBCXX_CONSTEXPR long long | |
4d4cf144 | 1328 | denorm_min() _GLIBCXX_USE_NOEXCEPT { return static_cast<long long>(0); } |
94a86be0 BK |
1329 | |
1330 | static _GLIBCXX_USE_CONSTEXPR bool is_iec559 = false; | |
1331 | static _GLIBCXX_USE_CONSTEXPR bool is_bounded = true; | |
1c830087 | 1332 | static _GLIBCXX_USE_CONSTEXPR bool is_modulo = false; |
94a86be0 BK |
1333 | |
1334 | static _GLIBCXX_USE_CONSTEXPR bool traps = __glibcxx_integral_traps; | |
1335 | static _GLIBCXX_USE_CONSTEXPR bool tinyness_before = false; | |
1336 | static _GLIBCXX_USE_CONSTEXPR float_round_style round_style | |
1337 | = round_toward_zero; | |
54c1bf78 BK |
1338 | }; |
1339 | ||
0aa06b18 | 1340 | /// numeric_limits<unsigned long long> specialization. |
54c1bf78 BK |
1341 | template<> |
1342 | struct numeric_limits<unsigned long long> | |
1343 | { | |
94a86be0 BK |
1344 | static _GLIBCXX_USE_CONSTEXPR bool is_specialized = true; |
1345 | ||
1346 | static _GLIBCXX_CONSTEXPR unsigned long long | |
4d4cf144 | 1347 | min() _GLIBCXX_USE_NOEXCEPT { return 0; } |
94a86be0 BK |
1348 | |
1349 | static _GLIBCXX_CONSTEXPR unsigned long long | |
4d4cf144 | 1350 | max() _GLIBCXX_USE_NOEXCEPT { return __LONG_LONG_MAX__ * 2ULL + 1; } |
54c1bf78 | 1351 | |
734f5023 | 1352 | #if __cplusplus >= 201103L |
94a86be0 | 1353 | static constexpr unsigned long long |
4d4cf144 | 1354 | lowest() noexcept { return min(); } |
018afad3 | 1355 | #endif |
54c1bf78 | 1356 | |
94a86be0 BK |
1357 | static _GLIBCXX_USE_CONSTEXPR int digits |
1358 | = __glibcxx_digits (unsigned long long); | |
1359 | static _GLIBCXX_USE_CONSTEXPR int digits10 | |
1360 | = __glibcxx_digits10 (unsigned long long); | |
734f5023 | 1361 | #if __cplusplus >= 201103L |
94a86be0 | 1362 | static constexpr int max_digits10 = 0; |
018afad3 | 1363 | #endif |
94a86be0 BK |
1364 | static _GLIBCXX_USE_CONSTEXPR bool is_signed = false; |
1365 | static _GLIBCXX_USE_CONSTEXPR bool is_integer = true; | |
1366 | static _GLIBCXX_USE_CONSTEXPR bool is_exact = true; | |
1367 | static _GLIBCXX_USE_CONSTEXPR int radix = 2; | |
1368 | ||
1369 | static _GLIBCXX_CONSTEXPR unsigned long long | |
4d4cf144 | 1370 | epsilon() _GLIBCXX_USE_NOEXCEPT { return 0; } |
94a86be0 BK |
1371 | |
1372 | static _GLIBCXX_CONSTEXPR unsigned long long | |
4d4cf144 | 1373 | round_error() _GLIBCXX_USE_NOEXCEPT { return 0; } |
94a86be0 BK |
1374 | |
1375 | static _GLIBCXX_USE_CONSTEXPR int min_exponent = 0; | |
1376 | static _GLIBCXX_USE_CONSTEXPR int min_exponent10 = 0; | |
1377 | static _GLIBCXX_USE_CONSTEXPR int max_exponent = 0; | |
1378 | static _GLIBCXX_USE_CONSTEXPR int max_exponent10 = 0; | |
1379 | ||
1380 | static _GLIBCXX_USE_CONSTEXPR bool has_infinity = false; | |
1381 | static _GLIBCXX_USE_CONSTEXPR bool has_quiet_NaN = false; | |
1382 | static _GLIBCXX_USE_CONSTEXPR bool has_signaling_NaN = false; | |
1383 | static _GLIBCXX_USE_CONSTEXPR float_denorm_style has_denorm | |
1384 | = denorm_absent; | |
1385 | static _GLIBCXX_USE_CONSTEXPR bool has_denorm_loss = false; | |
1386 | ||
1387 | static _GLIBCXX_CONSTEXPR unsigned long long | |
4d4cf144 PC |
1388 | infinity() _GLIBCXX_USE_NOEXCEPT |
1389 | { return static_cast<unsigned long long>(0); } | |
94a86be0 BK |
1390 | |
1391 | static _GLIBCXX_CONSTEXPR unsigned long long | |
4d4cf144 PC |
1392 | quiet_NaN() _GLIBCXX_USE_NOEXCEPT |
1393 | { return static_cast<unsigned long long>(0); } | |
94a86be0 BK |
1394 | |
1395 | static _GLIBCXX_CONSTEXPR unsigned long long | |
4d4cf144 PC |
1396 | signaling_NaN() _GLIBCXX_USE_NOEXCEPT |
1397 | { return static_cast<unsigned long long>(0); } | |
94a86be0 BK |
1398 | |
1399 | static _GLIBCXX_CONSTEXPR unsigned long long | |
4d4cf144 PC |
1400 | denorm_min() _GLIBCXX_USE_NOEXCEPT |
1401 | { return static_cast<unsigned long long>(0); } | |
94a86be0 BK |
1402 | |
1403 | static _GLIBCXX_USE_CONSTEXPR bool is_iec559 = false; | |
1404 | static _GLIBCXX_USE_CONSTEXPR bool is_bounded = true; | |
1405 | static _GLIBCXX_USE_CONSTEXPR bool is_modulo = true; | |
1406 | ||
1407 | static _GLIBCXX_USE_CONSTEXPR bool traps = __glibcxx_integral_traps; | |
1408 | static _GLIBCXX_USE_CONSTEXPR bool tinyness_before = false; | |
1409 | static _GLIBCXX_USE_CONSTEXPR float_round_style round_style | |
1410 | = round_toward_zero; | |
54c1bf78 BK |
1411 | }; |
1412 | ||
78a7c317 DD |
1413 | #if !defined(__STRICT_ANSI__) |
1414 | ||
1415 | #define __INT_N(TYPE, BITSIZE, EXT, UEXT) \ | |
1416 | template<> \ | |
1417 | struct numeric_limits<TYPE> \ | |
1418 | { \ | |
1419 | static _GLIBCXX_USE_CONSTEXPR bool is_specialized = true; \ | |
1420 | \ | |
1421 | static _GLIBCXX_CONSTEXPR TYPE \ | |
1422 | min() _GLIBCXX_USE_NOEXCEPT { return __glibcxx_min_b (TYPE, BITSIZE); } \ | |
1423 | \ | |
1424 | static _GLIBCXX_CONSTEXPR TYPE \ | |
cd9b223a | 1425 | max() _GLIBCXX_USE_NOEXCEPT { return __glibcxx_max_b (TYPE, BITSIZE); } \ |
78a7c317 DD |
1426 | \ |
1427 | static _GLIBCXX_USE_CONSTEXPR int digits \ | |
1428 | = BITSIZE - 1; \ | |
1429 | static _GLIBCXX_USE_CONSTEXPR int digits10 \ | |
1430 | = (BITSIZE - 1) * 643L / 2136; \ | |
1431 | \ | |
1432 | static _GLIBCXX_USE_CONSTEXPR bool is_signed = true; \ | |
1433 | static _GLIBCXX_USE_CONSTEXPR bool is_integer = true; \ | |
1434 | static _GLIBCXX_USE_CONSTEXPR bool is_exact = true; \ | |
1435 | static _GLIBCXX_USE_CONSTEXPR int radix = 2; \ | |
1436 | \ | |
1437 | static _GLIBCXX_CONSTEXPR TYPE \ | |
1438 | epsilon() _GLIBCXX_USE_NOEXCEPT { return 0; } \ | |
1439 | \ | |
1440 | static _GLIBCXX_CONSTEXPR TYPE \ | |
1441 | round_error() _GLIBCXX_USE_NOEXCEPT { return 0; } \ | |
1442 | \ | |
1443 | EXT \ | |
1444 | \ | |
1445 | static _GLIBCXX_USE_CONSTEXPR int min_exponent = 0; \ | |
1446 | static _GLIBCXX_USE_CONSTEXPR int min_exponent10 = 0; \ | |
1447 | static _GLIBCXX_USE_CONSTEXPR int max_exponent = 0; \ | |
1448 | static _GLIBCXX_USE_CONSTEXPR int max_exponent10 = 0; \ | |
1449 | \ | |
1450 | static _GLIBCXX_USE_CONSTEXPR bool has_infinity = false; \ | |
1451 | static _GLIBCXX_USE_CONSTEXPR bool has_quiet_NaN = false; \ | |
1452 | static _GLIBCXX_USE_CONSTEXPR bool has_signaling_NaN = false; \ | |
1453 | static _GLIBCXX_USE_CONSTEXPR float_denorm_style has_denorm \ | |
1454 | = denorm_absent; \ | |
1455 | static _GLIBCXX_USE_CONSTEXPR bool has_denorm_loss = false; \ | |
1456 | \ | |
1457 | static _GLIBCXX_CONSTEXPR TYPE \ | |
1458 | infinity() _GLIBCXX_USE_NOEXCEPT \ | |
1459 | { return static_cast<TYPE>(0); } \ | |
1460 | \ | |
1461 | static _GLIBCXX_CONSTEXPR TYPE \ | |
1462 | quiet_NaN() _GLIBCXX_USE_NOEXCEPT \ | |
1463 | { return static_cast<TYPE>(0); } \ | |
1464 | \ | |
1465 | static _GLIBCXX_CONSTEXPR TYPE \ | |
1466 | signaling_NaN() _GLIBCXX_USE_NOEXCEPT \ | |
1467 | { return static_cast<TYPE>(0); } \ | |
1468 | \ | |
1469 | static _GLIBCXX_CONSTEXPR TYPE \ | |
1470 | denorm_min() _GLIBCXX_USE_NOEXCEPT \ | |
1471 | { return static_cast<TYPE>(0); } \ | |
1472 | \ | |
1473 | static _GLIBCXX_USE_CONSTEXPR bool is_iec559 = false; \ | |
1474 | static _GLIBCXX_USE_CONSTEXPR bool is_bounded = true; \ | |
1475 | static _GLIBCXX_USE_CONSTEXPR bool is_modulo = false; \ | |
1476 | \ | |
1477 | static _GLIBCXX_USE_CONSTEXPR bool traps \ | |
1478 | = __glibcxx_integral_traps; \ | |
1479 | static _GLIBCXX_USE_CONSTEXPR bool tinyness_before = false; \ | |
1480 | static _GLIBCXX_USE_CONSTEXPR float_round_style round_style \ | |
1481 | = round_toward_zero; \ | |
1482 | }; \ | |
1483 | \ | |
1484 | template<> \ | |
1485 | struct numeric_limits<unsigned TYPE> \ | |
1486 | { \ | |
1487 | static _GLIBCXX_USE_CONSTEXPR bool is_specialized = true; \ | |
1488 | \ | |
1489 | static _GLIBCXX_CONSTEXPR unsigned TYPE \ | |
1490 | min() _GLIBCXX_USE_NOEXCEPT { return 0; } \ | |
1491 | \ | |
1492 | static _GLIBCXX_CONSTEXPR unsigned TYPE \ | |
1493 | max() _GLIBCXX_USE_NOEXCEPT { return __glibcxx_max_b (TYPE, BITSIZE); } \ | |
1494 | \ | |
1495 | UEXT \ | |
1496 | \ | |
1497 | static _GLIBCXX_USE_CONSTEXPR int digits \ | |
1498 | = BITSIZE; \ | |
1499 | static _GLIBCXX_USE_CONSTEXPR int digits10 \ | |
1500 | = BITSIZE * 643L / 2136; \ | |
1501 | static _GLIBCXX_USE_CONSTEXPR bool is_signed = false; \ | |
1502 | static _GLIBCXX_USE_CONSTEXPR bool is_integer = true; \ | |
1503 | static _GLIBCXX_USE_CONSTEXPR bool is_exact = true; \ | |
1504 | static _GLIBCXX_USE_CONSTEXPR int radix = 2; \ | |
1505 | \ | |
1506 | static _GLIBCXX_CONSTEXPR unsigned TYPE \ | |
1507 | epsilon() _GLIBCXX_USE_NOEXCEPT { return 0; } \ | |
1508 | \ | |
1509 | static _GLIBCXX_CONSTEXPR unsigned TYPE \ | |
1510 | round_error() _GLIBCXX_USE_NOEXCEPT { return 0; } \ | |
1511 | \ | |
1512 | static _GLIBCXX_USE_CONSTEXPR int min_exponent = 0; \ | |
1513 | static _GLIBCXX_USE_CONSTEXPR int min_exponent10 = 0; \ | |
1514 | static _GLIBCXX_USE_CONSTEXPR int max_exponent = 0; \ | |
1515 | static _GLIBCXX_USE_CONSTEXPR int max_exponent10 = 0; \ | |
1516 | \ | |
1517 | static _GLIBCXX_USE_CONSTEXPR bool has_infinity = false; \ | |
1518 | static _GLIBCXX_USE_CONSTEXPR bool has_quiet_NaN = false; \ | |
1519 | static _GLIBCXX_USE_CONSTEXPR bool has_signaling_NaN = false; \ | |
1520 | static _GLIBCXX_USE_CONSTEXPR float_denorm_style has_denorm \ | |
1521 | = denorm_absent; \ | |
1522 | static _GLIBCXX_USE_CONSTEXPR bool has_denorm_loss = false; \ | |
1523 | \ | |
1524 | static _GLIBCXX_CONSTEXPR unsigned TYPE \ | |
1525 | infinity() _GLIBCXX_USE_NOEXCEPT \ | |
1526 | { return static_cast<unsigned TYPE>(0); } \ | |
1527 | \ | |
1528 | static _GLIBCXX_CONSTEXPR unsigned TYPE \ | |
1529 | quiet_NaN() _GLIBCXX_USE_NOEXCEPT \ | |
1530 | { return static_cast<unsigned TYPE>(0); } \ | |
1531 | \ | |
1532 | static _GLIBCXX_CONSTEXPR unsigned TYPE \ | |
1533 | signaling_NaN() _GLIBCXX_USE_NOEXCEPT \ | |
1534 | { return static_cast<unsigned TYPE>(0); } \ | |
1535 | \ | |
1536 | static _GLIBCXX_CONSTEXPR unsigned TYPE \ | |
1537 | denorm_min() _GLIBCXX_USE_NOEXCEPT \ | |
1538 | { return static_cast<unsigned TYPE>(0); } \ | |
1539 | \ | |
1540 | static _GLIBCXX_USE_CONSTEXPR bool is_iec559 = false; \ | |
1541 | static _GLIBCXX_USE_CONSTEXPR bool is_bounded = true; \ | |
1542 | static _GLIBCXX_USE_CONSTEXPR bool is_modulo = true; \ | |
1543 | \ | |
1544 | static _GLIBCXX_USE_CONSTEXPR bool traps = __glibcxx_integral_traps; \ | |
1545 | static _GLIBCXX_USE_CONSTEXPR bool tinyness_before = false; \ | |
1546 | static _GLIBCXX_USE_CONSTEXPR float_round_style round_style \ | |
1547 | = round_toward_zero; \ | |
1548 | }; | |
12bfa8bd | 1549 | |
734f5023 | 1550 | #if __cplusplus >= 201103L |
12bfa8bd | 1551 | |
78a7c317 DD |
1552 | #define __INT_N_201103(TYPE) \ |
1553 | static constexpr TYPE \ | |
1554 | lowest() noexcept { return min(); } \ | |
12bfa8bd | 1555 | static constexpr int max_digits10 = 0; |
12bfa8bd | 1556 | |
78a7c317 DD |
1557 | #define __INT_N_U201103(TYPE) \ |
1558 | static constexpr unsigned TYPE \ | |
1559 | lowest() noexcept { return min(); } \ | |
1560 | static constexpr int max_digits10 = 0; | |
12bfa8bd | 1561 | |
78a7c317 DD |
1562 | #else |
1563 | #define __INT_N_201103(TYPE) | |
1564 | #define __INT_N_U201103(TYPE) | |
12bfa8bd PC |
1565 | #endif |
1566 | ||
78a7c317 DD |
1567 | #ifdef __GLIBCXX_TYPE_INT_N_0 |
1568 | __INT_N(__GLIBCXX_TYPE_INT_N_0, __GLIBCXX_BITSIZE_INT_N_0, | |
1569 | __INT_N_201103 (__GLIBCXX_TYPE_INT_N_0), __INT_N_U201103 (__GLIBCXX_TYPE_INT_N_0)) | |
1570 | #endif | |
1571 | #ifdef __GLIBCXX_TYPE_INT_N_1 | |
1572 | __INT_N (__GLIBCXX_TYPE_INT_N_1, __GLIBCXX_BITSIZE_INT_N_1, | |
1573 | __INT_N_201103 (__GLIBCXX_TYPE_INT_N_1), __INT_N_U201103 (__GLIBCXX_TYPE_INT_N_1)) | |
1574 | #endif | |
1575 | #ifdef __GLIBCXX_TYPE_INT_N_2 | |
1576 | __INT_N (__GLIBCXX_TYPE_INT_N_2, __GLIBCXX_BITSIZE_INT_N_2, | |
1577 | __INT_N_201103 (__GLIBCXX_TYPE_INT_N_2), __INT_N_U201103 (__GLIBCXX_TYPE_INT_N_2)) | |
1578 | #endif | |
1579 | #ifdef __GLIBCXX_TYPE_INT_N_3 | |
1580 | __INT_N (__GLIBCXX_TYPE_INT_N_3, __GLIBCXX_BITSIZE_INT_N_3, | |
1581 | __INT_N_201103 (__GLIBCXX_TYPE_INT_N_3), __INT_N_U201103 (__GLIBCXX_TYPE_INT_N_3)) | |
12bfa8bd | 1582 | #endif |
12bfa8bd | 1583 | |
78a7c317 DD |
1584 | #undef __INT_N |
1585 | #undef __INT_N_201103 | |
1586 | #undef __INT_N_U201103 | |
12bfa8bd | 1587 | |
12bfa8bd PC |
1588 | #endif |
1589 | ||
0aa06b18 | 1590 | /// numeric_limits<float> specialization. |
54c1bf78 BK |
1591 | template<> |
1592 | struct numeric_limits<float> | |
1593 | { | |
94a86be0 BK |
1594 | static _GLIBCXX_USE_CONSTEXPR bool is_specialized = true; |
1595 | ||
1596 | static _GLIBCXX_CONSTEXPR float | |
4d4cf144 | 1597 | min() _GLIBCXX_USE_NOEXCEPT { return __FLT_MIN__; } |
94a86be0 BK |
1598 | |
1599 | static _GLIBCXX_CONSTEXPR float | |
4d4cf144 | 1600 | max() _GLIBCXX_USE_NOEXCEPT { return __FLT_MAX__; } |
54c1bf78 | 1601 | |
734f5023 | 1602 | #if __cplusplus >= 201103L |
94a86be0 | 1603 | static constexpr float |
4d4cf144 | 1604 | lowest() noexcept { return -__FLT_MAX__; } |
018afad3 | 1605 | #endif |
54c1bf78 | 1606 | |
94a86be0 BK |
1607 | static _GLIBCXX_USE_CONSTEXPR int digits = __FLT_MANT_DIG__; |
1608 | static _GLIBCXX_USE_CONSTEXPR int digits10 = __FLT_DIG__; | |
734f5023 | 1609 | #if __cplusplus >= 201103L |
94a86be0 | 1610 | static constexpr int max_digits10 |
018afad3 ESR |
1611 | = __glibcxx_max_digits10 (__FLT_MANT_DIG__); |
1612 | #endif | |
94a86be0 BK |
1613 | static _GLIBCXX_USE_CONSTEXPR bool is_signed = true; |
1614 | static _GLIBCXX_USE_CONSTEXPR bool is_integer = false; | |
1615 | static _GLIBCXX_USE_CONSTEXPR bool is_exact = false; | |
1616 | static _GLIBCXX_USE_CONSTEXPR int radix = __FLT_RADIX__; | |
1617 | ||
1618 | static _GLIBCXX_CONSTEXPR float | |
4d4cf144 | 1619 | epsilon() _GLIBCXX_USE_NOEXCEPT { return __FLT_EPSILON__; } |
94a86be0 BK |
1620 | |
1621 | static _GLIBCXX_CONSTEXPR float | |
4d4cf144 | 1622 | round_error() _GLIBCXX_USE_NOEXCEPT { return 0.5F; } |
94a86be0 BK |
1623 | |
1624 | static _GLIBCXX_USE_CONSTEXPR int min_exponent = __FLT_MIN_EXP__; | |
1625 | static _GLIBCXX_USE_CONSTEXPR int min_exponent10 = __FLT_MIN_10_EXP__; | |
1626 | static _GLIBCXX_USE_CONSTEXPR int max_exponent = __FLT_MAX_EXP__; | |
1627 | static _GLIBCXX_USE_CONSTEXPR int max_exponent10 = __FLT_MAX_10_EXP__; | |
1628 | ||
1629 | static _GLIBCXX_USE_CONSTEXPR bool has_infinity = __FLT_HAS_INFINITY__; | |
1630 | static _GLIBCXX_USE_CONSTEXPR bool has_quiet_NaN = __FLT_HAS_QUIET_NAN__; | |
1631 | static _GLIBCXX_USE_CONSTEXPR bool has_signaling_NaN = has_quiet_NaN; | |
1632 | static _GLIBCXX_USE_CONSTEXPR float_denorm_style has_denorm | |
264c41ed | 1633 | = bool(__FLT_HAS_DENORM__) ? denorm_present : denorm_absent; |
94a86be0 BK |
1634 | static _GLIBCXX_USE_CONSTEXPR bool has_denorm_loss |
1635 | = __glibcxx_float_has_denorm_loss; | |
1636 | ||
1637 | static _GLIBCXX_CONSTEXPR float | |
4d4cf144 | 1638 | infinity() _GLIBCXX_USE_NOEXCEPT { return __builtin_huge_valf(); } |
54c1bf78 | 1639 | |
94a86be0 | 1640 | static _GLIBCXX_CONSTEXPR float |
4d4cf144 | 1641 | quiet_NaN() _GLIBCXX_USE_NOEXCEPT { return __builtin_nanf(""); } |
94a86be0 BK |
1642 | |
1643 | static _GLIBCXX_CONSTEXPR float | |
4d4cf144 | 1644 | signaling_NaN() _GLIBCXX_USE_NOEXCEPT { return __builtin_nansf(""); } |
94a86be0 BK |
1645 | |
1646 | static _GLIBCXX_CONSTEXPR float | |
4d4cf144 | 1647 | denorm_min() _GLIBCXX_USE_NOEXCEPT { return __FLT_DENORM_MIN__; } |
94a86be0 BK |
1648 | |
1649 | static _GLIBCXX_USE_CONSTEXPR bool is_iec559 | |
1650 | = has_infinity && has_quiet_NaN && has_denorm == denorm_present; | |
1651 | static _GLIBCXX_USE_CONSTEXPR bool is_bounded = true; | |
1652 | static _GLIBCXX_USE_CONSTEXPR bool is_modulo = false; | |
1653 | ||
1654 | static _GLIBCXX_USE_CONSTEXPR bool traps = __glibcxx_float_traps; | |
1655 | static _GLIBCXX_USE_CONSTEXPR bool tinyness_before | |
1656 | = __glibcxx_float_tinyness_before; | |
1657 | static _GLIBCXX_USE_CONSTEXPR float_round_style round_style | |
1658 | = round_to_nearest; | |
54c1bf78 BK |
1659 | }; |
1660 | ||
2778669a PE |
1661 | #undef __glibcxx_float_has_denorm_loss |
1662 | #undef __glibcxx_float_traps | |
1663 | #undef __glibcxx_float_tinyness_before | |
54c1bf78 | 1664 | |
0aa06b18 | 1665 | /// numeric_limits<double> specialization. |
54c1bf78 BK |
1666 | template<> |
1667 | struct numeric_limits<double> | |
1668 | { | |
94a86be0 BK |
1669 | static _GLIBCXX_USE_CONSTEXPR bool is_specialized = true; |
1670 | ||
1671 | static _GLIBCXX_CONSTEXPR double | |
4d4cf144 | 1672 | min() _GLIBCXX_USE_NOEXCEPT { return __DBL_MIN__; } |
94a86be0 BK |
1673 | |
1674 | static _GLIBCXX_CONSTEXPR double | |
4d4cf144 | 1675 | max() _GLIBCXX_USE_NOEXCEPT { return __DBL_MAX__; } |
54c1bf78 | 1676 | |
734f5023 | 1677 | #if __cplusplus >= 201103L |
94a86be0 | 1678 | static constexpr double |
4d4cf144 | 1679 | lowest() noexcept { return -__DBL_MAX__; } |
018afad3 | 1680 | #endif |
54c1bf78 | 1681 | |
94a86be0 BK |
1682 | static _GLIBCXX_USE_CONSTEXPR int digits = __DBL_MANT_DIG__; |
1683 | static _GLIBCXX_USE_CONSTEXPR int digits10 = __DBL_DIG__; | |
734f5023 | 1684 | #if __cplusplus >= 201103L |
94a86be0 | 1685 | static constexpr int max_digits10 |
018afad3 ESR |
1686 | = __glibcxx_max_digits10 (__DBL_MANT_DIG__); |
1687 | #endif | |
94a86be0 BK |
1688 | static _GLIBCXX_USE_CONSTEXPR bool is_signed = true; |
1689 | static _GLIBCXX_USE_CONSTEXPR bool is_integer = false; | |
1690 | static _GLIBCXX_USE_CONSTEXPR bool is_exact = false; | |
1691 | static _GLIBCXX_USE_CONSTEXPR int radix = __FLT_RADIX__; | |
1692 | ||
1693 | static _GLIBCXX_CONSTEXPR double | |
4d4cf144 | 1694 | epsilon() _GLIBCXX_USE_NOEXCEPT { return __DBL_EPSILON__; } |
94a86be0 BK |
1695 | |
1696 | static _GLIBCXX_CONSTEXPR double | |
4d4cf144 | 1697 | round_error() _GLIBCXX_USE_NOEXCEPT { return 0.5; } |
94a86be0 BK |
1698 | |
1699 | static _GLIBCXX_USE_CONSTEXPR int min_exponent = __DBL_MIN_EXP__; | |
1700 | static _GLIBCXX_USE_CONSTEXPR int min_exponent10 = __DBL_MIN_10_EXP__; | |
1701 | static _GLIBCXX_USE_CONSTEXPR int max_exponent = __DBL_MAX_EXP__; | |
1702 | static _GLIBCXX_USE_CONSTEXPR int max_exponent10 = __DBL_MAX_10_EXP__; | |
1703 | ||
1704 | static _GLIBCXX_USE_CONSTEXPR bool has_infinity = __DBL_HAS_INFINITY__; | |
1705 | static _GLIBCXX_USE_CONSTEXPR bool has_quiet_NaN = __DBL_HAS_QUIET_NAN__; | |
1706 | static _GLIBCXX_USE_CONSTEXPR bool has_signaling_NaN = has_quiet_NaN; | |
1707 | static _GLIBCXX_USE_CONSTEXPR float_denorm_style has_denorm | |
264c41ed | 1708 | = bool(__DBL_HAS_DENORM__) ? denorm_present : denorm_absent; |
94a86be0 BK |
1709 | static _GLIBCXX_USE_CONSTEXPR bool has_denorm_loss |
1710 | = __glibcxx_double_has_denorm_loss; | |
1711 | ||
1712 | static _GLIBCXX_CONSTEXPR double | |
4d4cf144 | 1713 | infinity() _GLIBCXX_USE_NOEXCEPT { return __builtin_huge_val(); } |
94a86be0 BK |
1714 | |
1715 | static _GLIBCXX_CONSTEXPR double | |
4d4cf144 | 1716 | quiet_NaN() _GLIBCXX_USE_NOEXCEPT { return __builtin_nan(""); } |
54c1bf78 | 1717 | |
94a86be0 | 1718 | static _GLIBCXX_CONSTEXPR double |
4d4cf144 | 1719 | signaling_NaN() _GLIBCXX_USE_NOEXCEPT { return __builtin_nans(""); } |
94a86be0 BK |
1720 | |
1721 | static _GLIBCXX_CONSTEXPR double | |
4d4cf144 | 1722 | denorm_min() _GLIBCXX_USE_NOEXCEPT { return __DBL_DENORM_MIN__; } |
94a86be0 BK |
1723 | |
1724 | static _GLIBCXX_USE_CONSTEXPR bool is_iec559 | |
1725 | = has_infinity && has_quiet_NaN && has_denorm == denorm_present; | |
1726 | static _GLIBCXX_USE_CONSTEXPR bool is_bounded = true; | |
1727 | static _GLIBCXX_USE_CONSTEXPR bool is_modulo = false; | |
1728 | ||
1729 | static _GLIBCXX_USE_CONSTEXPR bool traps = __glibcxx_double_traps; | |
1730 | static _GLIBCXX_USE_CONSTEXPR bool tinyness_before | |
1731 | = __glibcxx_double_tinyness_before; | |
1732 | static _GLIBCXX_USE_CONSTEXPR float_round_style round_style | |
1733 | = round_to_nearest; | |
54c1bf78 BK |
1734 | }; |
1735 | ||
2778669a PE |
1736 | #undef __glibcxx_double_has_denorm_loss |
1737 | #undef __glibcxx_double_traps | |
1738 | #undef __glibcxx_double_tinyness_before | |
6ad8f949 | 1739 | |
0aa06b18 | 1740 | /// numeric_limits<long double> specialization. |
54c1bf78 BK |
1741 | template<> |
1742 | struct numeric_limits<long double> | |
1743 | { | |
94a86be0 BK |
1744 | static _GLIBCXX_USE_CONSTEXPR bool is_specialized = true; |
1745 | ||
1746 | static _GLIBCXX_CONSTEXPR long double | |
4d4cf144 | 1747 | min() _GLIBCXX_USE_NOEXCEPT { return __LDBL_MIN__; } |
94a86be0 BK |
1748 | |
1749 | static _GLIBCXX_CONSTEXPR long double | |
4d4cf144 | 1750 | max() _GLIBCXX_USE_NOEXCEPT { return __LDBL_MAX__; } |
54c1bf78 | 1751 | |
734f5023 | 1752 | #if __cplusplus >= 201103L |
94a86be0 | 1753 | static constexpr long double |
4d4cf144 | 1754 | lowest() noexcept { return -__LDBL_MAX__; } |
018afad3 | 1755 | #endif |
54c1bf78 | 1756 | |
94a86be0 BK |
1757 | static _GLIBCXX_USE_CONSTEXPR int digits = __LDBL_MANT_DIG__; |
1758 | static _GLIBCXX_USE_CONSTEXPR int digits10 = __LDBL_DIG__; | |
734f5023 | 1759 | #if __cplusplus >= 201103L |
94a86be0 | 1760 | static _GLIBCXX_USE_CONSTEXPR int max_digits10 |
018afad3 ESR |
1761 | = __glibcxx_max_digits10 (__LDBL_MANT_DIG__); |
1762 | #endif | |
94a86be0 BK |
1763 | static _GLIBCXX_USE_CONSTEXPR bool is_signed = true; |
1764 | static _GLIBCXX_USE_CONSTEXPR bool is_integer = false; | |
1765 | static _GLIBCXX_USE_CONSTEXPR bool is_exact = false; | |
1766 | static _GLIBCXX_USE_CONSTEXPR int radix = __FLT_RADIX__; | |
1767 | ||
1768 | static _GLIBCXX_CONSTEXPR long double | |
4d4cf144 | 1769 | epsilon() _GLIBCXX_USE_NOEXCEPT { return __LDBL_EPSILON__; } |
94a86be0 BK |
1770 | |
1771 | static _GLIBCXX_CONSTEXPR long double | |
4d4cf144 | 1772 | round_error() _GLIBCXX_USE_NOEXCEPT { return 0.5L; } |
94a86be0 BK |
1773 | |
1774 | static _GLIBCXX_USE_CONSTEXPR int min_exponent = __LDBL_MIN_EXP__; | |
1775 | static _GLIBCXX_USE_CONSTEXPR int min_exponent10 = __LDBL_MIN_10_EXP__; | |
1776 | static _GLIBCXX_USE_CONSTEXPR int max_exponent = __LDBL_MAX_EXP__; | |
1777 | static _GLIBCXX_USE_CONSTEXPR int max_exponent10 = __LDBL_MAX_10_EXP__; | |
1778 | ||
1779 | static _GLIBCXX_USE_CONSTEXPR bool has_infinity = __LDBL_HAS_INFINITY__; | |
1780 | static _GLIBCXX_USE_CONSTEXPR bool has_quiet_NaN = __LDBL_HAS_QUIET_NAN__; | |
1781 | static _GLIBCXX_USE_CONSTEXPR bool has_signaling_NaN = has_quiet_NaN; | |
1782 | static _GLIBCXX_USE_CONSTEXPR float_denorm_style has_denorm | |
264c41ed | 1783 | = bool(__LDBL_HAS_DENORM__) ? denorm_present : denorm_absent; |
94a86be0 | 1784 | static _GLIBCXX_USE_CONSTEXPR bool has_denorm_loss |
2778669a | 1785 | = __glibcxx_long_double_has_denorm_loss; |
54c1bf78 | 1786 | |
94a86be0 | 1787 | static _GLIBCXX_CONSTEXPR long double |
4d4cf144 | 1788 | infinity() _GLIBCXX_USE_NOEXCEPT { return __builtin_huge_vall(); } |
54c1bf78 | 1789 | |
94a86be0 | 1790 | static _GLIBCXX_CONSTEXPR long double |
4d4cf144 | 1791 | quiet_NaN() _GLIBCXX_USE_NOEXCEPT { return __builtin_nanl(""); } |
54c1bf78 | 1792 | |
94a86be0 | 1793 | static _GLIBCXX_CONSTEXPR long double |
4d4cf144 | 1794 | signaling_NaN() _GLIBCXX_USE_NOEXCEPT { return __builtin_nansl(""); } |
94a86be0 BK |
1795 | |
1796 | static _GLIBCXX_CONSTEXPR long double | |
4d4cf144 | 1797 | denorm_min() _GLIBCXX_USE_NOEXCEPT { return __LDBL_DENORM_MIN__; } |
94a86be0 BK |
1798 | |
1799 | static _GLIBCXX_USE_CONSTEXPR bool is_iec559 | |
1800 | = has_infinity && has_quiet_NaN && has_denorm == denorm_present; | |
1801 | static _GLIBCXX_USE_CONSTEXPR bool is_bounded = true; | |
1802 | static _GLIBCXX_USE_CONSTEXPR bool is_modulo = false; | |
1803 | ||
1804 | static _GLIBCXX_USE_CONSTEXPR bool traps = __glibcxx_long_double_traps; | |
1805 | static _GLIBCXX_USE_CONSTEXPR bool tinyness_before = | |
1806 | __glibcxx_long_double_tinyness_before; | |
1807 | static _GLIBCXX_USE_CONSTEXPR float_round_style round_style = | |
1808 | round_to_nearest; | |
54c1bf78 BK |
1809 | }; |
1810 | ||
2778669a PE |
1811 | #undef __glibcxx_long_double_has_denorm_loss |
1812 | #undef __glibcxx_long_double_traps | |
1813 | #undef __glibcxx_long_double_tinyness_before | |
be71ea9d | 1814 | |
12ffa228 BK |
1815 | _GLIBCXX_END_NAMESPACE_VERSION |
1816 | } // namespace | |
54c1bf78 | 1817 | |
2778669a PE |
1818 | #undef __glibcxx_signed |
1819 | #undef __glibcxx_min | |
1820 | #undef __glibcxx_max | |
1821 | #undef __glibcxx_digits | |
1822 | #undef __glibcxx_digits10 | |
018afad3 | 1823 | #undef __glibcxx_max_digits10 |
6ad8f949 | 1824 | |
1143680e | 1825 | #endif // _GLIBCXX_NUMERIC_LIMITS |