]>
Commit | Line | Data |
---|---|---|
c0000147 | 1 | // The template and inlines for the numeric_limits classes. -*- C++ -*- |
01dd2c6c | 2 | |
f1717362 | 3 | // Copyright (C) 1999-2016 Free Software Foundation, Inc. |
01dd2c6c | 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 | |
6bc9506f | 8 | // Free Software Foundation; either version 3, or (at your option) |
01dd2c6c | 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 | ||
6bc9506f | 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/>. | |
01dd2c6c | 24 | |
5846aeac | 25 | /** @file include/limits |
b2a66747 | 26 | * This is a Standard C++ Library header. |
27 | */ | |
28 | ||
e1e0016d | 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 | ||
a438d9ac | 37 | #ifndef _GLIBCXX_NUMERIC_LIMITS |
38 | #define _GLIBCXX_NUMERIC_LIMITS 1 | |
e1e0016d | 39 | |
40 | #pragma GCC system_header | |
41 | ||
e1e0016d | 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). | |
1b672f86 | 47 | // From Standard C++ point of view, there are 14 such types: |
e1e0016d | 48 | // * integers |
c0000147 | 49 | // bool (1) |
1b672f86 | 50 | // char, signed char, unsigned char, wchar_t (4) |
e1e0016d | 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 | // | |
9fc1117c | 60 | // GNU C++ understands (where supported by the host C-library) |
e1e0016d | 61 | // * integer |
62 | // long long, unsigned long long (2) | |
63 | // | |
1b672f86 | 64 | // which brings us to 16 fundamental arithmetic data types in GNU C++. |
e1e0016d | 65 | // |
ae3df4f9 | 66 | // |
e1e0016d | 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 | ||
a487a021 | 73 | // These values can be overridden in the target configuration file. |
74 | // The default values are appropriate for many 32-bit targets. | |
e1e0016d | 75 | |
9fc1117c | 76 | // GCC only intrinsically supports modulo integral types. The only remaining |
861dd757 | 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. | |
fd80276c | 79 | #ifndef __glibcxx_integral_traps |
80 | # define __glibcxx_integral_traps true | |
e1e0016d | 81 | #endif |
82 | ||
e1e0016d | 83 | // float |
84 | // | |
85 | ||
9fc1117c | 86 | // Default values. Should be overridden in configuration files if necessary. |
e1e0016d | 87 | |
fd80276c | 88 | #ifndef __glibcxx_float_has_denorm_loss |
89 | # define __glibcxx_float_has_denorm_loss false | |
e1e0016d | 90 | #endif |
fd80276c | 91 | #ifndef __glibcxx_float_traps |
92 | # define __glibcxx_float_traps false | |
e1e0016d | 93 | #endif |
fd80276c | 94 | #ifndef __glibcxx_float_tinyness_before |
95 | # define __glibcxx_float_tinyness_before false | |
e1e0016d | 96 | #endif |
97 | ||
e1e0016d | 98 | // double |
99 | ||
9fc1117c | 100 | // Default values. Should be overridden in configuration files if necessary. |
e1e0016d | 101 | |
fd80276c | 102 | #ifndef __glibcxx_double_has_denorm_loss |
103 | # define __glibcxx_double_has_denorm_loss false | |
e1e0016d | 104 | #endif |
fd80276c | 105 | #ifndef __glibcxx_double_traps |
106 | # define __glibcxx_double_traps false | |
e1e0016d | 107 | #endif |
fd80276c | 108 | #ifndef __glibcxx_double_tinyness_before |
109 | # define __glibcxx_double_tinyness_before false | |
e1e0016d | 110 | #endif |
111 | ||
e1e0016d | 112 | // long double |
113 | ||
9fc1117c | 114 | // Default values. Should be overridden in configuration files if necessary. |
e1e0016d | 115 | |
fd80276c | 116 | #ifndef __glibcxx_long_double_has_denorm_loss |
117 | # define __glibcxx_long_double_has_denorm_loss false | |
e1e0016d | 118 | #endif |
fd80276c | 119 | #ifndef __glibcxx_long_double_traps |
120 | # define __glibcxx_long_double_traps false | |
e1e0016d | 121 | #endif |
fd80276c | 122 | #ifndef __glibcxx_long_double_tinyness_before |
123 | # define __glibcxx_long_double_tinyness_before false | |
1d487aca | 124 | #endif |
e1e0016d | 125 | |
ae3df4f9 | 126 | // You should not need to define any macros below this point. |
127 | ||
9f75f026 | 128 | #define __glibcxx_signed_b(T,B) ((T)(-1) < 0) |
ae3df4f9 | 129 | |
9f75f026 | 130 | #define __glibcxx_min_b(T,B) \ |
131 | (__glibcxx_signed_b (T,B) ? -__glibcxx_max_b (T,B) - 1 : (T)0) | |
ae3df4f9 | 132 | |
9f75f026 | 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) | |
ae3df4f9 | 136 | |
9f75f026 | 137 | #define __glibcxx_digits_b(T,B) \ |
138 | (B - __glibcxx_signed_b (T,B)) | |
ae3df4f9 | 139 | |
140 | // The fraction 643/2136 approximates log10(2) to 7 significant digits. | |
9f75f026 | 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__) | |
fd80276c | 152 | #define __glibcxx_digits10(T) \ |
9f75f026 | 153 | __glibcxx_digits10_b (T, sizeof(T) * __CHAR_BIT__) |
ae3df4f9 | 154 | |
b99d1526 | 155 | #define __glibcxx_max_digits10(T) \ |
d14ad2bf | 156 | (2 + (T) * 643L / 2136) |
e1e0016d | 157 | |
2948dd21 | 158 | namespace std _GLIBCXX_VISIBILITY(default) |
159 | { | |
160 | _GLIBCXX_BEGIN_NAMESPACE_VERSION | |
1069247d | 161 | |
cc9b5e81 | 162 | /** |
163 | * @brief Describes the rounding style for floating-point types. | |
164 | * | |
165 | * This is used in the std::numeric_limits class. | |
166 | */ | |
ae3df4f9 | 167 | enum float_round_style |
e1e0016d | 168 | { |
5846aeac | 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. | |
e1e0016d | 174 | }; |
175 | ||
cc9b5e81 | 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 | */ | |
ae3df4f9 | 182 | enum float_denorm_style |
e1e0016d | 183 | { |
cc9b5e81 | 184 | /// Indeterminate at compile time whether denormalized values are allowed. |
e1e0016d | 185 | denorm_indeterminate = -1, |
cc9b5e81 | 186 | /// The type does not allow denormalized values. |
e1e0016d | 187 | denorm_absent = 0, |
cc9b5e81 | 188 | /// The type allows denormalized values. |
e1e0016d | 189 | denorm_present = 1 |
190 | }; | |
191 | ||
cc9b5e81 | 192 | /** |
193 | * @brief Part of std::numeric_limits. | |
194 | * | |
195 | * The @c static @c const members are usable as integral constant | |
196 | * expressions. | |
197 | * | |
9fc1117c | 198 | * @note This is a separate class for purposes of efficiency; you |
cc9b5e81 | 199 | * should only access these members as part of an instantiation |
200 | * of the std::numeric_limits class. | |
201 | */ | |
66e2b7f8 | 202 | struct __numeric_limits_base |
203 | { | |
cc9b5e81 | 204 | /** This will be true for all fundamental types (which have |
c0000147 | 205 | specializations), and false for everything else. */ |
206 | static _GLIBCXX_USE_CONSTEXPR bool is_specialized = false; | |
66e2b7f8 | 207 | |
cc9b5e81 | 208 | /** The number of @c radix digits that be represented without change: for |
c0000147 | 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 | ||
cc9b5e81 | 213 | /** The number of base 10 digits that can be represented without change. */ |
c0000147 | 214 | static _GLIBCXX_USE_CONSTEXPR int digits10 = 0; |
215 | ||
0c8766b1 | 216 | #if __cplusplus >= 201103L |
b99d1526 | 217 | /** The number of base 10 digits required to ensure that values which |
218 | differ are always differentiated. */ | |
c0000147 | 219 | static constexpr int max_digits10 = 0; |
b99d1526 | 220 | #endif |
c0000147 | 221 | |
cc9b5e81 | 222 | /** True if the type is signed. */ |
c0000147 | 223 | static _GLIBCXX_USE_CONSTEXPR bool is_signed = false; |
224 | ||
8b3d154c | 225 | /** True if the type is integer. */ |
c0000147 | 226 | static _GLIBCXX_USE_CONSTEXPR bool is_integer = false; |
227 | ||
8b3d154c | 228 | /** True if the type uses an exact representation. All integer types are |
c0000147 | 229 | exact, but not all exact types are integer. For example, rational and |
8b3d154c | 230 | fixed-exponent representations are exact but not integer. */ |
c0000147 | 231 | static _GLIBCXX_USE_CONSTEXPR bool is_exact = false; |
232 | ||
cc9b5e81 | 233 | /** For integer types, specifies the base of the representation. For |
c0000147 | 234 | floating types, specifies the base of the exponent representation. */ |
235 | static _GLIBCXX_USE_CONSTEXPR int radix = 0; | |
66e2b7f8 | 236 | |
cc9b5e81 | 237 | /** The minimum negative integer such that @c radix raised to the power of |
c0000147 | 238 | (one less than that integer) is a normalized floating point number. */ |
239 | static _GLIBCXX_USE_CONSTEXPR int min_exponent = 0; | |
240 | ||
cc9b5e81 | 241 | /** The minimum negative integer such that 10 raised to that power is in |
c0000147 | 242 | the range of normalized floating point numbers. */ |
243 | static _GLIBCXX_USE_CONSTEXPR int min_exponent10 = 0; | |
244 | ||
cc9b5e81 | 245 | /** The maximum positive integer such that @c radix raised to the power of |
c0000147 | 246 | (one less than that integer) is a representable finite floating point |
cc9b5e81 | 247 | number. */ |
c0000147 | 248 | static _GLIBCXX_USE_CONSTEXPR int max_exponent = 0; |
249 | ||
cc9b5e81 | 250 | /** The maximum positive integer such that 10 raised to that power is in |
c0000147 | 251 | the range of representable finite floating point numbers. */ |
252 | static _GLIBCXX_USE_CONSTEXPR int max_exponent10 = 0; | |
ae3df4f9 | 253 | |
cc9b5e81 | 254 | /** True if the type has a representation for positive infinity. */ |
c0000147 | 255 | static _GLIBCXX_USE_CONSTEXPR bool has_infinity = false; |
256 | ||
cc9b5e81 | 257 | /** True if the type has a representation for a quiet (non-signaling) |
8b3d154c | 258 | Not a Number. */ |
c0000147 | 259 | static _GLIBCXX_USE_CONSTEXPR bool has_quiet_NaN = false; |
260 | ||
cc9b5e81 | 261 | /** True if the type has a representation for a signaling |
8b3d154c | 262 | Not a Number. */ |
c0000147 | 263 | static _GLIBCXX_USE_CONSTEXPR bool has_signaling_NaN = false; |
264 | ||
cc9b5e81 | 265 | /** See std::float_denorm_style for more information. */ |
c0000147 | 266 | static _GLIBCXX_USE_CONSTEXPR float_denorm_style has_denorm = denorm_absent; |
267 | ||
8b3d154c | 268 | /** True if loss of accuracy is detected as a denormalization loss, |
269 | rather than as an inexact result. */ | |
c0000147 | 270 | static _GLIBCXX_USE_CONSTEXPR bool has_denorm_loss = false; |
66e2b7f8 | 271 | |
cc9b5e81 | 272 | /** True if-and-only-if the type adheres to the IEC 559 standard, also |
c0000147 | 273 | known as IEEE 754. (Only makes sense for floating point types.) */ |
274 | static _GLIBCXX_USE_CONSTEXPR bool is_iec559 = false; | |
275 | ||
8b3d154c | 276 | /** True if the set of values representable by the type is |
c0000147 | 277 | finite. All built-in types are bounded, this member would be |
8b3d154c | 278 | false for arbitrary precision types. */ |
c0000147 | 279 | static _GLIBCXX_USE_CONSTEXPR bool is_bounded = false; |
280 | ||
6d021c1b | 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. */ | |
c0000147 | 288 | static _GLIBCXX_USE_CONSTEXPR bool is_modulo = false; |
66e2b7f8 | 289 | |
cc9b5e81 | 290 | /** True if trapping is implemented for this type. */ |
c0000147 | 291 | static _GLIBCXX_USE_CONSTEXPR bool traps = false; |
292 | ||
9fc1117c | 293 | /** True if tininess is detected before rounding. (see IEC 559) */ |
c0000147 | 294 | static _GLIBCXX_USE_CONSTEXPR bool tinyness_before = false; |
295 | ||
cc9b5e81 | 296 | /** See std::float_round_style for more information. This is only |
c0000147 | 297 | meaningful for floating types; integer types will all be |
cc9b5e81 | 298 | round_toward_zero. */ |
c0000147 | 299 | static _GLIBCXX_USE_CONSTEXPR float_round_style round_style = |
300 | round_toward_zero; | |
66e2b7f8 | 301 | }; |
302 | ||
cc9b5e81 | 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 | * | |
5a64d8cf | 311 | * _GLIBCXX_RESOLVE_LIB_DEFECTS: DRs 201 and 184 (hi Gaby!) are |
cc9b5e81 | 312 | * noted, but not incorporated in this documented (yet). |
cc9b5e81 | 313 | */ |
ae3df4f9 | 314 | template<typename _Tp> |
315 | struct numeric_limits : public __numeric_limits_base | |
e1e0016d | 316 | { |
cc9b5e81 | 317 | /** The minimum finite value, or for floating types with |
c0000147 | 318 | denormalization, the minimum positive normalized value. */ |
319 | static _GLIBCXX_CONSTEXPR _Tp | |
44ee2131 | 320 | min() _GLIBCXX_USE_NOEXCEPT { return _Tp(); } |
c0000147 | 321 | |
cc9b5e81 | 322 | /** The maximum finite value. */ |
c0000147 | 323 | static _GLIBCXX_CONSTEXPR _Tp |
44ee2131 | 324 | max() _GLIBCXX_USE_NOEXCEPT { return _Tp(); } |
c0000147 | 325 | |
0c8766b1 | 326 | #if __cplusplus >= 201103L |
b99d1526 | 327 | /** A finite value x such that there is no other finite value y |
328 | * where y < x. */ | |
c0000147 | 329 | static constexpr _Tp |
44ee2131 | 330 | lowest() noexcept { return _Tp(); } |
b99d1526 | 331 | #endif |
c0000147 | 332 | |
cc9b5e81 | 333 | /** The @e machine @e epsilon: the difference between 1 and the least |
c0000147 | 334 | value greater than 1 that is representable. */ |
335 | static _GLIBCXX_CONSTEXPR _Tp | |
44ee2131 | 336 | epsilon() _GLIBCXX_USE_NOEXCEPT { return _Tp(); } |
c0000147 | 337 | |
cc9b5e81 | 338 | /** The maximum rounding error measurement (see LIA-1). */ |
c0000147 | 339 | static _GLIBCXX_CONSTEXPR _Tp |
44ee2131 | 340 | round_error() _GLIBCXX_USE_NOEXCEPT { return _Tp(); } |
c0000147 | 341 | |
cc9b5e81 | 342 | /** The representation of positive infinity, if @c has_infinity. */ |
c0000147 | 343 | static _GLIBCXX_CONSTEXPR _Tp |
44ee2131 | 344 | infinity() _GLIBCXX_USE_NOEXCEPT { return _Tp(); } |
72117d76 | 345 | |
8b3d154c | 346 | /** The representation of a quiet Not a Number, |
72117d76 | 347 | if @c has_quiet_NaN. */ |
c0000147 | 348 | static _GLIBCXX_CONSTEXPR _Tp |
44ee2131 | 349 | quiet_NaN() _GLIBCXX_USE_NOEXCEPT { return _Tp(); } |
c0000147 | 350 | |
8b3d154c | 351 | /** The representation of a signaling Not a Number, if |
c0000147 | 352 | @c has_signaling_NaN. */ |
353 | static _GLIBCXX_CONSTEXPR _Tp | |
44ee2131 | 354 | signaling_NaN() _GLIBCXX_USE_NOEXCEPT { return _Tp(); } |
c0000147 | 355 | |
cc9b5e81 | 356 | /** The minimum positive denormalized value. For types where |
c0000147 | 357 | @c has_denorm is false, this is the minimum positive normalized |
cc9b5e81 | 358 | value. */ |
c0000147 | 359 | static _GLIBCXX_CONSTEXPR _Tp |
44ee2131 | 360 | denorm_min() _GLIBCXX_USE_NOEXCEPT { return _Tp(); } |
e1e0016d | 361 | }; |
362 | ||
0c8766b1 | 363 | #if __cplusplus >= 201103L |
1b672f86 | 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) | |
b2a66747 | 379 | |
380 | /// numeric_limits<bool> specialization. | |
e1e0016d | 381 | template<> |
382 | struct numeric_limits<bool> | |
383 | { | |
c0000147 | 384 | static _GLIBCXX_USE_CONSTEXPR bool is_specialized = true; |
385 | ||
386 | static _GLIBCXX_CONSTEXPR bool | |
568d055d | 387 | min() _GLIBCXX_USE_NOEXCEPT { return false; } |
c0000147 | 388 | |
389 | static _GLIBCXX_CONSTEXPR bool | |
568d055d | 390 | max() _GLIBCXX_USE_NOEXCEPT { return true; } |
e1e0016d | 391 | |
0c8766b1 | 392 | #if __cplusplus >= 201103L |
c0000147 | 393 | static constexpr bool |
568d055d | 394 | lowest() noexcept { return min(); } |
b99d1526 | 395 | #endif |
c0000147 | 396 | static _GLIBCXX_USE_CONSTEXPR int digits = 1; |
397 | static _GLIBCXX_USE_CONSTEXPR int digits10 = 0; | |
0c8766b1 | 398 | #if __cplusplus >= 201103L |
c0000147 | 399 | static constexpr int max_digits10 = 0; |
b99d1526 | 400 | #endif |
c0000147 | 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 | |
568d055d | 407 | epsilon() _GLIBCXX_USE_NOEXCEPT { return false; } |
c0000147 | 408 | |
409 | static _GLIBCXX_CONSTEXPR bool | |
568d055d | 410 | round_error() _GLIBCXX_USE_NOEXCEPT { return false; } |
c0000147 | 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 | |
568d055d | 425 | infinity() _GLIBCXX_USE_NOEXCEPT { return false; } |
c0000147 | 426 | |
427 | static _GLIBCXX_CONSTEXPR bool | |
568d055d | 428 | quiet_NaN() _GLIBCXX_USE_NOEXCEPT { return false; } |
c0000147 | 429 | |
430 | static _GLIBCXX_CONSTEXPR bool | |
568d055d | 431 | signaling_NaN() _GLIBCXX_USE_NOEXCEPT { return false; } |
c0000147 | 432 | |
433 | static _GLIBCXX_CONSTEXPR bool | |
568d055d | 434 | denorm_min() _GLIBCXX_USE_NOEXCEPT { return false; } |
c0000147 | 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; | |
e1e0016d | 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. | |
c0000147 | 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; | |
e1e0016d | 447 | }; |
448 | ||
b2a66747 | 449 | /// numeric_limits<char> specialization. |
e1e0016d | 450 | template<> |
451 | struct numeric_limits<char> | |
452 | { | |
c0000147 | 453 | static _GLIBCXX_USE_CONSTEXPR bool is_specialized = true; |
454 | ||
455 | static _GLIBCXX_CONSTEXPR char | |
568d055d | 456 | min() _GLIBCXX_USE_NOEXCEPT { return __glibcxx_min(char); } |
c0000147 | 457 | |
458 | static _GLIBCXX_CONSTEXPR char | |
568d055d | 459 | max() _GLIBCXX_USE_NOEXCEPT { return __glibcxx_max(char); } |
e1e0016d | 460 | |
0c8766b1 | 461 | #if __cplusplus >= 201103L |
c0000147 | 462 | static constexpr char |
568d055d | 463 | lowest() noexcept { return min(); } |
b99d1526 | 464 | #endif |
e1e0016d | 465 | |
c0000147 | 466 | static _GLIBCXX_USE_CONSTEXPR int digits = __glibcxx_digits (char); |
467 | static _GLIBCXX_USE_CONSTEXPR int digits10 = __glibcxx_digits10 (char); | |
0c8766b1 | 468 | #if __cplusplus >= 201103L |
c0000147 | 469 | static constexpr int max_digits10 = 0; |
b99d1526 | 470 | #endif |
c0000147 | 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 | |
568d055d | 477 | epsilon() _GLIBCXX_USE_NOEXCEPT { return 0; } |
c0000147 | 478 | |
479 | static _GLIBCXX_CONSTEXPR char | |
568d055d | 480 | round_error() _GLIBCXX_USE_NOEXCEPT { return 0; } |
c0000147 | 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 | |
568d055d | 495 | char infinity() _GLIBCXX_USE_NOEXCEPT { return char(); } |
c0000147 | 496 | |
497 | static _GLIBCXX_CONSTEXPR char | |
568d055d | 498 | quiet_NaN() _GLIBCXX_USE_NOEXCEPT { return char(); } |
c0000147 | 499 | |
500 | static _GLIBCXX_CONSTEXPR char | |
568d055d | 501 | signaling_NaN() _GLIBCXX_USE_NOEXCEPT { return char(); } |
c0000147 | 502 | |
503 | static _GLIBCXX_CONSTEXPR char | |
568d055d | 504 | denorm_min() _GLIBCXX_USE_NOEXCEPT { return static_cast<char>(0); } |
c0000147 | 505 | |
506 | static _GLIBCXX_USE_CONSTEXPR bool is_iec559 = false; | |
507 | static _GLIBCXX_USE_CONSTEXPR bool is_bounded = true; | |
6d021c1b | 508 | static _GLIBCXX_USE_CONSTEXPR bool is_modulo = !is_signed; |
c0000147 | 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; | |
e1e0016d | 514 | }; |
515 | ||
b2a66747 | 516 | /// numeric_limits<signed char> specialization. |
e1e0016d | 517 | template<> |
518 | struct numeric_limits<signed char> | |
519 | { | |
c0000147 | 520 | static _GLIBCXX_USE_CONSTEXPR bool is_specialized = true; |
521 | ||
522 | static _GLIBCXX_CONSTEXPR signed char | |
568d055d | 523 | min() _GLIBCXX_USE_NOEXCEPT { return -__SCHAR_MAX__ - 1; } |
c0000147 | 524 | |
525 | static _GLIBCXX_CONSTEXPR signed char | |
568d055d | 526 | max() _GLIBCXX_USE_NOEXCEPT { return __SCHAR_MAX__; } |
e1e0016d | 527 | |
0c8766b1 | 528 | #if __cplusplus >= 201103L |
c0000147 | 529 | static constexpr signed char |
568d055d | 530 | lowest() noexcept { return min(); } |
b99d1526 | 531 | #endif |
e1e0016d | 532 | |
c0000147 | 533 | static _GLIBCXX_USE_CONSTEXPR int digits = __glibcxx_digits (signed char); |
534 | static _GLIBCXX_USE_CONSTEXPR int digits10 | |
535 | = __glibcxx_digits10 (signed char); | |
0c8766b1 | 536 | #if __cplusplus >= 201103L |
c0000147 | 537 | static constexpr int max_digits10 = 0; |
b99d1526 | 538 | #endif |
c0000147 | 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 | |
568d055d | 545 | epsilon() _GLIBCXX_USE_NOEXCEPT { return 0; } |
c0000147 | 546 | |
547 | static _GLIBCXX_CONSTEXPR signed char | |
568d055d | 548 | round_error() _GLIBCXX_USE_NOEXCEPT { return 0; } |
c0000147 | 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 | |
568d055d | 563 | infinity() _GLIBCXX_USE_NOEXCEPT { return static_cast<signed char>(0); } |
c0000147 | 564 | |
565 | static _GLIBCXX_CONSTEXPR signed char | |
568d055d | 566 | quiet_NaN() _GLIBCXX_USE_NOEXCEPT { return static_cast<signed char>(0); } |
c0000147 | 567 | |
568 | static _GLIBCXX_CONSTEXPR signed char | |
568d055d | 569 | signaling_NaN() _GLIBCXX_USE_NOEXCEPT |
570 | { return static_cast<signed char>(0); } | |
c0000147 | 571 | |
572 | static _GLIBCXX_CONSTEXPR signed char | |
568d055d | 573 | denorm_min() _GLIBCXX_USE_NOEXCEPT |
574 | { return static_cast<signed char>(0); } | |
c0000147 | 575 | |
576 | static _GLIBCXX_USE_CONSTEXPR bool is_iec559 = false; | |
577 | static _GLIBCXX_USE_CONSTEXPR bool is_bounded = true; | |
6d021c1b | 578 | static _GLIBCXX_USE_CONSTEXPR bool is_modulo = false; |
c0000147 | 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; | |
e1e0016d | 584 | }; |
585 | ||
b2a66747 | 586 | /// numeric_limits<unsigned char> specialization. |
e1e0016d | 587 | template<> |
588 | struct numeric_limits<unsigned char> | |
589 | { | |
c0000147 | 590 | static _GLIBCXX_USE_CONSTEXPR bool is_specialized = true; |
591 | ||
592 | static _GLIBCXX_CONSTEXPR unsigned char | |
568d055d | 593 | min() _GLIBCXX_USE_NOEXCEPT { return 0; } |
c0000147 | 594 | |
595 | static _GLIBCXX_CONSTEXPR unsigned char | |
568d055d | 596 | max() _GLIBCXX_USE_NOEXCEPT { return __SCHAR_MAX__ * 2U + 1; } |
e1e0016d | 597 | |
0c8766b1 | 598 | #if __cplusplus >= 201103L |
c0000147 | 599 | static constexpr unsigned char |
568d055d | 600 | lowest() noexcept { return min(); } |
b99d1526 | 601 | #endif |
e1e0016d | 602 | |
c0000147 | 603 | static _GLIBCXX_USE_CONSTEXPR int digits |
604 | = __glibcxx_digits (unsigned char); | |
605 | static _GLIBCXX_USE_CONSTEXPR int digits10 | |
606 | = __glibcxx_digits10 (unsigned char); | |
0c8766b1 | 607 | #if __cplusplus >= 201103L |
c0000147 | 608 | static constexpr int max_digits10 = 0; |
b99d1526 | 609 | #endif |
c0000147 | 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 | |
568d055d | 616 | epsilon() _GLIBCXX_USE_NOEXCEPT { return 0; } |
c0000147 | 617 | |
618 | static _GLIBCXX_CONSTEXPR unsigned char | |
568d055d | 619 | round_error() _GLIBCXX_USE_NOEXCEPT { return 0; } |
c0000147 | 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 | |
568d055d | 634 | infinity() _GLIBCXX_USE_NOEXCEPT |
635 | { return static_cast<unsigned char>(0); } | |
c0000147 | 636 | |
637 | static _GLIBCXX_CONSTEXPR unsigned char | |
568d055d | 638 | quiet_NaN() _GLIBCXX_USE_NOEXCEPT |
639 | { return static_cast<unsigned char>(0); } | |
c0000147 | 640 | |
641 | static _GLIBCXX_CONSTEXPR unsigned char | |
568d055d | 642 | signaling_NaN() _GLIBCXX_USE_NOEXCEPT |
643 | { return static_cast<unsigned char>(0); } | |
c0000147 | 644 | |
645 | static _GLIBCXX_CONSTEXPR unsigned char | |
568d055d | 646 | denorm_min() _GLIBCXX_USE_NOEXCEPT |
647 | { return static_cast<unsigned char>(0); } | |
c0000147 | 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; | |
e1e0016d | 657 | }; |
658 | ||
b2a66747 | 659 | /// numeric_limits<wchar_t> specialization. |
e1e0016d | 660 | template<> |
661 | struct numeric_limits<wchar_t> | |
662 | { | |
c0000147 | 663 | static _GLIBCXX_USE_CONSTEXPR bool is_specialized = true; |
664 | ||
665 | static _GLIBCXX_CONSTEXPR wchar_t | |
568d055d | 666 | min() _GLIBCXX_USE_NOEXCEPT { return __glibcxx_min (wchar_t); } |
c0000147 | 667 | |
668 | static _GLIBCXX_CONSTEXPR wchar_t | |
568d055d | 669 | max() _GLIBCXX_USE_NOEXCEPT { return __glibcxx_max (wchar_t); } |
e1e0016d | 670 | |
0c8766b1 | 671 | #if __cplusplus >= 201103L |
568d055d | 672 | static constexpr wchar_t |
673 | lowest() noexcept { return min(); } | |
b99d1526 | 674 | #endif |
e1e0016d | 675 | |
c0000147 | 676 | static _GLIBCXX_USE_CONSTEXPR int digits = __glibcxx_digits (wchar_t); |
677 | static _GLIBCXX_USE_CONSTEXPR int digits10 | |
678 | = __glibcxx_digits10 (wchar_t); | |
0c8766b1 | 679 | #if __cplusplus >= 201103L |
c0000147 | 680 | static constexpr int max_digits10 = 0; |
b99d1526 | 681 | #endif |
c0000147 | 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 | |
568d055d | 688 | epsilon() _GLIBCXX_USE_NOEXCEPT { return 0; } |
c0000147 | 689 | |
690 | static _GLIBCXX_CONSTEXPR wchar_t | |
568d055d | 691 | round_error() _GLIBCXX_USE_NOEXCEPT { return 0; } |
c0000147 | 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 | |
568d055d | 706 | infinity() _GLIBCXX_USE_NOEXCEPT { return wchar_t(); } |
c0000147 | 707 | |
708 | static _GLIBCXX_CONSTEXPR wchar_t | |
568d055d | 709 | quiet_NaN() _GLIBCXX_USE_NOEXCEPT { return wchar_t(); } |
c0000147 | 710 | |
711 | static _GLIBCXX_CONSTEXPR wchar_t | |
568d055d | 712 | signaling_NaN() _GLIBCXX_USE_NOEXCEPT { return wchar_t(); } |
c0000147 | 713 | |
714 | static _GLIBCXX_CONSTEXPR wchar_t | |
568d055d | 715 | denorm_min() _GLIBCXX_USE_NOEXCEPT { return wchar_t(); } |
c0000147 | 716 | |
717 | static _GLIBCXX_USE_CONSTEXPR bool is_iec559 = false; | |
718 | static _GLIBCXX_USE_CONSTEXPR bool is_bounded = true; | |
6d021c1b | 719 | static _GLIBCXX_USE_CONSTEXPR bool is_modulo = !is_signed; |
c0000147 | 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; | |
e1e0016d | 725 | }; |
726 | ||
0c8766b1 | 727 | #if __cplusplus >= 201103L |
6ea15c6f | 728 | /// numeric_limits<char16_t> specialization. |
729 | template<> | |
730 | struct numeric_limits<char16_t> | |
731 | { | |
568d055d | 732 | static constexpr bool is_specialized = true; |
c0000147 | 733 | |
568d055d | 734 | static constexpr char16_t |
735 | min() noexcept { return __glibcxx_min (char16_t); } | |
c0000147 | 736 | |
568d055d | 737 | static constexpr char16_t |
738 | max() noexcept { return __glibcxx_max (char16_t); } | |
6ea15c6f | 739 | |
c0000147 | 740 | static constexpr char16_t |
568d055d | 741 | lowest() noexcept { return min(); } |
6ea15c6f | 742 | |
568d055d | 743 | static constexpr int digits = __glibcxx_digits (char16_t); |
744 | static constexpr int digits10 = __glibcxx_digits10 (char16_t); | |
c0000147 | 745 | static constexpr int max_digits10 = 0; |
568d055d | 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; | |
c0000147 | 750 | |
568d055d | 751 | static constexpr char16_t |
752 | epsilon() noexcept { return 0; } | |
c0000147 | 753 | |
568d055d | 754 | static constexpr char16_t |
755 | round_error() noexcept { return 0; } | |
c0000147 | 756 | |
568d055d | 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; | |
c0000147 | 761 | |
568d055d | 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; | |
c0000147 | 767 | |
568d055d | 768 | static constexpr char16_t |
769 | infinity() noexcept { return char16_t(); } | |
c0000147 | 770 | |
568d055d | 771 | static constexpr char16_t |
772 | quiet_NaN() noexcept { return char16_t(); } | |
c0000147 | 773 | |
568d055d | 774 | static constexpr char16_t |
775 | signaling_NaN() noexcept { return char16_t(); } | |
c0000147 | 776 | |
568d055d | 777 | static constexpr char16_t |
778 | denorm_min() noexcept { return char16_t(); } | |
c0000147 | 779 | |
568d055d | 780 | static constexpr bool is_iec559 = false; |
781 | static constexpr bool is_bounded = true; | |
6d021c1b | 782 | static constexpr bool is_modulo = !is_signed; |
c0000147 | 783 | |
568d055d | 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; | |
6ea15c6f | 787 | }; |
788 | ||
789 | /// numeric_limits<char32_t> specialization. | |
790 | template<> | |
791 | struct numeric_limits<char32_t> | |
792 | { | |
568d055d | 793 | static constexpr bool is_specialized = true; |
c0000147 | 794 | |
568d055d | 795 | static constexpr char32_t |
796 | min() noexcept { return __glibcxx_min (char32_t); } | |
c0000147 | 797 | |
568d055d | 798 | static constexpr char32_t |
799 | max() noexcept { return __glibcxx_max (char32_t); } | |
6ea15c6f | 800 | |
c0000147 | 801 | static constexpr char32_t |
568d055d | 802 | lowest() noexcept { return min(); } |
6ea15c6f | 803 | |
568d055d | 804 | static constexpr int digits = __glibcxx_digits (char32_t); |
805 | static constexpr int digits10 = __glibcxx_digits10 (char32_t); | |
c0000147 | 806 | static constexpr int max_digits10 = 0; |
568d055d | 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; | |
c0000147 | 811 | |
568d055d | 812 | static constexpr char32_t |
813 | epsilon() noexcept { return 0; } | |
c0000147 | 814 | |
568d055d | 815 | static constexpr char32_t |
816 | round_error() noexcept { return 0; } | |
c0000147 | 817 | |
568d055d | 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; | |
c0000147 | 822 | |
568d055d | 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; | |
c0000147 | 828 | |
568d055d | 829 | static constexpr char32_t |
830 | infinity() noexcept { return char32_t(); } | |
c0000147 | 831 | |
568d055d | 832 | static constexpr char32_t |
833 | quiet_NaN() noexcept { return char32_t(); } | |
c0000147 | 834 | |
568d055d | 835 | static constexpr char32_t |
836 | signaling_NaN() noexcept { return char32_t(); } | |
c0000147 | 837 | |
568d055d | 838 | static constexpr char32_t |
839 | denorm_min() noexcept { return char32_t(); } | |
c0000147 | 840 | |
568d055d | 841 | static constexpr bool is_iec559 = false; |
842 | static constexpr bool is_bounded = true; | |
6d021c1b | 843 | static constexpr bool is_modulo = !is_signed; |
c0000147 | 844 | |
568d055d | 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; | |
6ea15c6f | 848 | }; |
849 | #endif | |
850 | ||
b2a66747 | 851 | /// numeric_limits<short> specialization. |
e1e0016d | 852 | template<> |
853 | struct numeric_limits<short> | |
854 | { | |
c0000147 | 855 | static _GLIBCXX_USE_CONSTEXPR bool is_specialized = true; |
856 | ||
857 | static _GLIBCXX_CONSTEXPR short | |
568d055d | 858 | min() _GLIBCXX_USE_NOEXCEPT { return -__SHRT_MAX__ - 1; } |
c0000147 | 859 | |
860 | static _GLIBCXX_CONSTEXPR short | |
568d055d | 861 | max() _GLIBCXX_USE_NOEXCEPT { return __SHRT_MAX__; } |
e1e0016d | 862 | |
0c8766b1 | 863 | #if __cplusplus >= 201103L |
c0000147 | 864 | static constexpr short |
568d055d | 865 | lowest() noexcept { return min(); } |
b99d1526 | 866 | #endif |
e1e0016d | 867 | |
c0000147 | 868 | static _GLIBCXX_USE_CONSTEXPR int digits = __glibcxx_digits (short); |
869 | static _GLIBCXX_USE_CONSTEXPR int digits10 = __glibcxx_digits10 (short); | |
0c8766b1 | 870 | #if __cplusplus >= 201103L |
c0000147 | 871 | static constexpr int max_digits10 = 0; |
b99d1526 | 872 | #endif |
c0000147 | 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 | |
568d055d | 879 | epsilon() _GLIBCXX_USE_NOEXCEPT { return 0; } |
c0000147 | 880 | |
881 | static _GLIBCXX_CONSTEXPR short | |
568d055d | 882 | round_error() _GLIBCXX_USE_NOEXCEPT { return 0; } |
c0000147 | 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 | |
568d055d | 897 | infinity() _GLIBCXX_USE_NOEXCEPT { return short(); } |
c0000147 | 898 | |
899 | static _GLIBCXX_CONSTEXPR short | |
568d055d | 900 | quiet_NaN() _GLIBCXX_USE_NOEXCEPT { return short(); } |
c0000147 | 901 | |
902 | static _GLIBCXX_CONSTEXPR short | |
568d055d | 903 | signaling_NaN() _GLIBCXX_USE_NOEXCEPT { return short(); } |
c0000147 | 904 | |
905 | static _GLIBCXX_CONSTEXPR short | |
568d055d | 906 | denorm_min() _GLIBCXX_USE_NOEXCEPT { return short(); } |
c0000147 | 907 | |
908 | static _GLIBCXX_USE_CONSTEXPR bool is_iec559 = false; | |
909 | static _GLIBCXX_USE_CONSTEXPR bool is_bounded = true; | |
6d021c1b | 910 | static _GLIBCXX_USE_CONSTEXPR bool is_modulo = false; |
c0000147 | 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; | |
e1e0016d | 916 | }; |
917 | ||
b2a66747 | 918 | /// numeric_limits<unsigned short> specialization. |
e1e0016d | 919 | template<> |
920 | struct numeric_limits<unsigned short> | |
921 | { | |
c0000147 | 922 | static _GLIBCXX_USE_CONSTEXPR bool is_specialized = true; |
923 | ||
924 | static _GLIBCXX_CONSTEXPR unsigned short | |
568d055d | 925 | min() _GLIBCXX_USE_NOEXCEPT { return 0; } |
c0000147 | 926 | |
927 | static _GLIBCXX_CONSTEXPR unsigned short | |
568d055d | 928 | max() _GLIBCXX_USE_NOEXCEPT { return __SHRT_MAX__ * 2U + 1; } |
e1e0016d | 929 | |
0c8766b1 | 930 | #if __cplusplus >= 201103L |
c0000147 | 931 | static constexpr unsigned short |
568d055d | 932 | lowest() noexcept { return min(); } |
b99d1526 | 933 | #endif |
e1e0016d | 934 | |
c0000147 | 935 | static _GLIBCXX_USE_CONSTEXPR int digits |
936 | = __glibcxx_digits (unsigned short); | |
937 | static _GLIBCXX_USE_CONSTEXPR int digits10 | |
938 | = __glibcxx_digits10 (unsigned short); | |
0c8766b1 | 939 | #if __cplusplus >= 201103L |
c0000147 | 940 | static constexpr int max_digits10 = 0; |
b99d1526 | 941 | #endif |
c0000147 | 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 | |
568d055d | 948 | epsilon() _GLIBCXX_USE_NOEXCEPT { return 0; } |
c0000147 | 949 | |
950 | static _GLIBCXX_CONSTEXPR unsigned short | |
568d055d | 951 | round_error() _GLIBCXX_USE_NOEXCEPT { return 0; } |
c0000147 | 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 | |
568d055d | 966 | infinity() _GLIBCXX_USE_NOEXCEPT |
967 | { return static_cast<unsigned short>(0); } | |
c0000147 | 968 | |
969 | static _GLIBCXX_CONSTEXPR unsigned short | |
568d055d | 970 | quiet_NaN() _GLIBCXX_USE_NOEXCEPT |
971 | { return static_cast<unsigned short>(0); } | |
c0000147 | 972 | |
973 | static _GLIBCXX_CONSTEXPR unsigned short | |
568d055d | 974 | signaling_NaN() _GLIBCXX_USE_NOEXCEPT |
975 | { return static_cast<unsigned short>(0); } | |
c0000147 | 976 | |
977 | static _GLIBCXX_CONSTEXPR unsigned short | |
568d055d | 978 | denorm_min() _GLIBCXX_USE_NOEXCEPT |
979 | { return static_cast<unsigned short>(0); } | |
c0000147 | 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; | |
e1e0016d | 989 | }; |
990 | ||
b2a66747 | 991 | /// numeric_limits<int> specialization. |
e1e0016d | 992 | template<> |
993 | struct numeric_limits<int> | |
994 | { | |
c0000147 | 995 | static _GLIBCXX_USE_CONSTEXPR bool is_specialized = true; |
996 | ||
997 | static _GLIBCXX_CONSTEXPR int | |
568d055d | 998 | min() _GLIBCXX_USE_NOEXCEPT { return -__INT_MAX__ - 1; } |
c0000147 | 999 | |
1000 | static _GLIBCXX_CONSTEXPR int | |
568d055d | 1001 | max() _GLIBCXX_USE_NOEXCEPT { return __INT_MAX__; } |
e1e0016d | 1002 | |
0c8766b1 | 1003 | #if __cplusplus >= 201103L |
c0000147 | 1004 | static constexpr int |
568d055d | 1005 | lowest() noexcept { return min(); } |
b99d1526 | 1006 | #endif |
e1e0016d | 1007 | |
c0000147 | 1008 | static _GLIBCXX_USE_CONSTEXPR int digits = __glibcxx_digits (int); |
1009 | static _GLIBCXX_USE_CONSTEXPR int digits10 = __glibcxx_digits10 (int); | |
0c8766b1 | 1010 | #if __cplusplus >= 201103L |
c0000147 | 1011 | static constexpr int max_digits10 = 0; |
b99d1526 | 1012 | #endif |
c0000147 | 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 | |
568d055d | 1019 | epsilon() _GLIBCXX_USE_NOEXCEPT { return 0; } |
c0000147 | 1020 | |
1021 | static _GLIBCXX_CONSTEXPR int | |
568d055d | 1022 | round_error() _GLIBCXX_USE_NOEXCEPT { return 0; } |
c0000147 | 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 | |
568d055d | 1037 | infinity() _GLIBCXX_USE_NOEXCEPT { return static_cast<int>(0); } |
c0000147 | 1038 | |
1039 | static _GLIBCXX_CONSTEXPR int | |
568d055d | 1040 | quiet_NaN() _GLIBCXX_USE_NOEXCEPT { return static_cast<int>(0); } |
c0000147 | 1041 | |
1042 | static _GLIBCXX_CONSTEXPR int | |
568d055d | 1043 | signaling_NaN() _GLIBCXX_USE_NOEXCEPT { return static_cast<int>(0); } |
c0000147 | 1044 | |
1045 | static _GLIBCXX_CONSTEXPR int | |
568d055d | 1046 | denorm_min() _GLIBCXX_USE_NOEXCEPT { return static_cast<int>(0); } |
c0000147 | 1047 | |
1048 | static _GLIBCXX_USE_CONSTEXPR bool is_iec559 = false; | |
1049 | static _GLIBCXX_USE_CONSTEXPR bool is_bounded = true; | |
6d021c1b | 1050 | static _GLIBCXX_USE_CONSTEXPR bool is_modulo = false; |
c0000147 | 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; | |
e1e0016d | 1056 | }; |
1057 | ||
b2a66747 | 1058 | /// numeric_limits<unsigned int> specialization. |
e1e0016d | 1059 | template<> |
1060 | struct numeric_limits<unsigned int> | |
1061 | { | |
c0000147 | 1062 | static _GLIBCXX_USE_CONSTEXPR bool is_specialized = true; |
1063 | ||
1064 | static _GLIBCXX_CONSTEXPR unsigned int | |
568d055d | 1065 | min() _GLIBCXX_USE_NOEXCEPT { return 0; } |
c0000147 | 1066 | |
1067 | static _GLIBCXX_CONSTEXPR unsigned int | |
568d055d | 1068 | max() _GLIBCXX_USE_NOEXCEPT { return __INT_MAX__ * 2U + 1; } |
e1e0016d | 1069 | |
0c8766b1 | 1070 | #if __cplusplus >= 201103L |
c0000147 | 1071 | static constexpr unsigned int |
568d055d | 1072 | lowest() noexcept { return min(); } |
b99d1526 | 1073 | #endif |
e1e0016d | 1074 | |
c0000147 | 1075 | static _GLIBCXX_USE_CONSTEXPR int digits |
1076 | = __glibcxx_digits (unsigned int); | |
1077 | static _GLIBCXX_USE_CONSTEXPR int digits10 | |
1078 | = __glibcxx_digits10 (unsigned int); | |
0c8766b1 | 1079 | #if __cplusplus >= 201103L |
c0000147 | 1080 | static constexpr int max_digits10 = 0; |
b99d1526 | 1081 | #endif |
c0000147 | 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 | |
568d055d | 1088 | epsilon() _GLIBCXX_USE_NOEXCEPT { return 0; } |
c0000147 | 1089 | |
1090 | static _GLIBCXX_CONSTEXPR unsigned int | |
568d055d | 1091 | round_error() _GLIBCXX_USE_NOEXCEPT { return 0; } |
c0000147 | 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 | |
568d055d | 1106 | infinity() _GLIBCXX_USE_NOEXCEPT { return static_cast<unsigned int>(0); } |
c0000147 | 1107 | |
1108 | static _GLIBCXX_CONSTEXPR unsigned int | |
568d055d | 1109 | quiet_NaN() _GLIBCXX_USE_NOEXCEPT |
1110 | { return static_cast<unsigned int>(0); } | |
c0000147 | 1111 | |
1112 | static _GLIBCXX_CONSTEXPR unsigned int | |
568d055d | 1113 | signaling_NaN() _GLIBCXX_USE_NOEXCEPT |
1114 | { return static_cast<unsigned int>(0); } | |
c0000147 | 1115 | |
1116 | static _GLIBCXX_CONSTEXPR unsigned int | |
568d055d | 1117 | denorm_min() _GLIBCXX_USE_NOEXCEPT |
1118 | { return static_cast<unsigned int>(0); } | |
c0000147 | 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; | |
e1e0016d | 1128 | }; |
1129 | ||
b2a66747 | 1130 | /// numeric_limits<long> specialization. |
e1e0016d | 1131 | template<> |
1132 | struct numeric_limits<long> | |
1133 | { | |
c0000147 | 1134 | static _GLIBCXX_USE_CONSTEXPR bool is_specialized = true; |
1135 | ||
1136 | static _GLIBCXX_CONSTEXPR long | |
568d055d | 1137 | min() _GLIBCXX_USE_NOEXCEPT { return -__LONG_MAX__ - 1; } |
c0000147 | 1138 | |
1139 | static _GLIBCXX_CONSTEXPR long | |
568d055d | 1140 | max() _GLIBCXX_USE_NOEXCEPT { return __LONG_MAX__; } |
e1e0016d | 1141 | |
0c8766b1 | 1142 | #if __cplusplus >= 201103L |
c0000147 | 1143 | static constexpr long |
568d055d | 1144 | lowest() noexcept { return min(); } |
b99d1526 | 1145 | #endif |
e1e0016d | 1146 | |
c0000147 | 1147 | static _GLIBCXX_USE_CONSTEXPR int digits = __glibcxx_digits (long); |
1148 | static _GLIBCXX_USE_CONSTEXPR int digits10 = __glibcxx_digits10 (long); | |
0c8766b1 | 1149 | #if __cplusplus >= 201103L |
c0000147 | 1150 | static constexpr int max_digits10 = 0; |
b99d1526 | 1151 | #endif |
c0000147 | 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 | |
568d055d | 1158 | epsilon() _GLIBCXX_USE_NOEXCEPT { return 0; } |
c0000147 | 1159 | |
1160 | static _GLIBCXX_CONSTEXPR long | |
568d055d | 1161 | round_error() _GLIBCXX_USE_NOEXCEPT { return 0; } |
c0000147 | 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 | |
568d055d | 1176 | infinity() _GLIBCXX_USE_NOEXCEPT { return static_cast<long>(0); } |
c0000147 | 1177 | |
1178 | static _GLIBCXX_CONSTEXPR long | |
568d055d | 1179 | quiet_NaN() _GLIBCXX_USE_NOEXCEPT { return static_cast<long>(0); } |
c0000147 | 1180 | |
1181 | static _GLIBCXX_CONSTEXPR long | |
568d055d | 1182 | signaling_NaN() _GLIBCXX_USE_NOEXCEPT { return static_cast<long>(0); } |
c0000147 | 1183 | |
1184 | static _GLIBCXX_CONSTEXPR long | |
568d055d | 1185 | denorm_min() _GLIBCXX_USE_NOEXCEPT { return static_cast<long>(0); } |
c0000147 | 1186 | |
1187 | static _GLIBCXX_USE_CONSTEXPR bool is_iec559 = false; | |
1188 | static _GLIBCXX_USE_CONSTEXPR bool is_bounded = true; | |
6d021c1b | 1189 | static _GLIBCXX_USE_CONSTEXPR bool is_modulo = false; |
c0000147 | 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; | |
e1e0016d | 1195 | }; |
1196 | ||
b2a66747 | 1197 | /// numeric_limits<unsigned long> specialization. |
e1e0016d | 1198 | template<> |
1199 | struct numeric_limits<unsigned long> | |
1200 | { | |
c0000147 | 1201 | static _GLIBCXX_USE_CONSTEXPR bool is_specialized = true; |
1202 | ||
1203 | static _GLIBCXX_CONSTEXPR unsigned long | |
568d055d | 1204 | min() _GLIBCXX_USE_NOEXCEPT { return 0; } |
c0000147 | 1205 | |
1206 | static _GLIBCXX_CONSTEXPR unsigned long | |
568d055d | 1207 | max() _GLIBCXX_USE_NOEXCEPT { return __LONG_MAX__ * 2UL + 1; } |
e1e0016d | 1208 | |
0c8766b1 | 1209 | #if __cplusplus >= 201103L |
c0000147 | 1210 | static constexpr unsigned long |
568d055d | 1211 | lowest() noexcept { return min(); } |
b99d1526 | 1212 | #endif |
e1e0016d | 1213 | |
c0000147 | 1214 | static _GLIBCXX_USE_CONSTEXPR int digits |
1215 | = __glibcxx_digits (unsigned long); | |
1216 | static _GLIBCXX_USE_CONSTEXPR int digits10 | |
1217 | = __glibcxx_digits10 (unsigned long); | |
0c8766b1 | 1218 | #if __cplusplus >= 201103L |
c0000147 | 1219 | static constexpr int max_digits10 = 0; |
b99d1526 | 1220 | #endif |
c0000147 | 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 | |
568d055d | 1227 | epsilon() _GLIBCXX_USE_NOEXCEPT { return 0; } |
c0000147 | 1228 | |
1229 | static _GLIBCXX_CONSTEXPR unsigned long | |
568d055d | 1230 | round_error() _GLIBCXX_USE_NOEXCEPT { return 0; } |
c0000147 | 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 | |
568d055d | 1245 | infinity() _GLIBCXX_USE_NOEXCEPT |
1246 | { return static_cast<unsigned long>(0); } | |
c0000147 | 1247 | |
1248 | static _GLIBCXX_CONSTEXPR unsigned long | |
568d055d | 1249 | quiet_NaN() _GLIBCXX_USE_NOEXCEPT |
1250 | { return static_cast<unsigned long>(0); } | |
c0000147 | 1251 | |
1252 | static _GLIBCXX_CONSTEXPR unsigned long | |
568d055d | 1253 | signaling_NaN() _GLIBCXX_USE_NOEXCEPT |
1254 | { return static_cast<unsigned long>(0); } | |
c0000147 | 1255 | |
1256 | static _GLIBCXX_CONSTEXPR unsigned long | |
568d055d | 1257 | denorm_min() _GLIBCXX_USE_NOEXCEPT |
1258 | { return static_cast<unsigned long>(0); } | |
c0000147 | 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; | |
e1e0016d | 1268 | }; |
1269 | ||
b2a66747 | 1270 | /// numeric_limits<long long> specialization. |
e1e0016d | 1271 | template<> |
1272 | struct numeric_limits<long long> | |
1273 | { | |
c0000147 | 1274 | static _GLIBCXX_USE_CONSTEXPR bool is_specialized = true; |
1275 | ||
1276 | static _GLIBCXX_CONSTEXPR long long | |
568d055d | 1277 | min() _GLIBCXX_USE_NOEXCEPT { return -__LONG_LONG_MAX__ - 1; } |
c0000147 | 1278 | |
1279 | static _GLIBCXX_CONSTEXPR long long | |
568d055d | 1280 | max() _GLIBCXX_USE_NOEXCEPT { return __LONG_LONG_MAX__; } |
ae3df4f9 | 1281 | |
0c8766b1 | 1282 | #if __cplusplus >= 201103L |
c0000147 | 1283 | static constexpr long long |
568d055d | 1284 | lowest() noexcept { return min(); } |
b99d1526 | 1285 | #endif |
ae3df4f9 | 1286 | |
c0000147 | 1287 | static _GLIBCXX_USE_CONSTEXPR int digits |
1288 | = __glibcxx_digits (long long); | |
1289 | static _GLIBCXX_USE_CONSTEXPR int digits10 | |
1290 | = __glibcxx_digits10 (long long); | |
0c8766b1 | 1291 | #if __cplusplus >= 201103L |
c0000147 | 1292 | static constexpr int max_digits10 = 0; |
b99d1526 | 1293 | #endif |
c0000147 | 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 | |
568d055d | 1300 | epsilon() _GLIBCXX_USE_NOEXCEPT { return 0; } |
c0000147 | 1301 | |
1302 | static _GLIBCXX_CONSTEXPR long long | |
568d055d | 1303 | round_error() _GLIBCXX_USE_NOEXCEPT { return 0; } |
c0000147 | 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 | |
568d055d | 1318 | infinity() _GLIBCXX_USE_NOEXCEPT { return static_cast<long long>(0); } |
c0000147 | 1319 | |
1320 | static _GLIBCXX_CONSTEXPR long long | |
568d055d | 1321 | quiet_NaN() _GLIBCXX_USE_NOEXCEPT { return static_cast<long long>(0); } |
c0000147 | 1322 | |
1323 | static _GLIBCXX_CONSTEXPR long long | |
568d055d | 1324 | signaling_NaN() _GLIBCXX_USE_NOEXCEPT |
1325 | { return static_cast<long long>(0); } | |
c0000147 | 1326 | |
1327 | static _GLIBCXX_CONSTEXPR long long | |
568d055d | 1328 | denorm_min() _GLIBCXX_USE_NOEXCEPT { return static_cast<long long>(0); } |
c0000147 | 1329 | |
1330 | static _GLIBCXX_USE_CONSTEXPR bool is_iec559 = false; | |
1331 | static _GLIBCXX_USE_CONSTEXPR bool is_bounded = true; | |
6d021c1b | 1332 | static _GLIBCXX_USE_CONSTEXPR bool is_modulo = false; |
c0000147 | 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; | |
e1e0016d | 1338 | }; |
1339 | ||
b2a66747 | 1340 | /// numeric_limits<unsigned long long> specialization. |
e1e0016d | 1341 | template<> |
1342 | struct numeric_limits<unsigned long long> | |
1343 | { | |
c0000147 | 1344 | static _GLIBCXX_USE_CONSTEXPR bool is_specialized = true; |
1345 | ||
1346 | static _GLIBCXX_CONSTEXPR unsigned long long | |
568d055d | 1347 | min() _GLIBCXX_USE_NOEXCEPT { return 0; } |
c0000147 | 1348 | |
1349 | static _GLIBCXX_CONSTEXPR unsigned long long | |
568d055d | 1350 | max() _GLIBCXX_USE_NOEXCEPT { return __LONG_LONG_MAX__ * 2ULL + 1; } |
e1e0016d | 1351 | |
0c8766b1 | 1352 | #if __cplusplus >= 201103L |
c0000147 | 1353 | static constexpr unsigned long long |
568d055d | 1354 | lowest() noexcept { return min(); } |
b99d1526 | 1355 | #endif |
e1e0016d | 1356 | |
c0000147 | 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); | |
0c8766b1 | 1361 | #if __cplusplus >= 201103L |
c0000147 | 1362 | static constexpr int max_digits10 = 0; |
b99d1526 | 1363 | #endif |
c0000147 | 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 | |
568d055d | 1370 | epsilon() _GLIBCXX_USE_NOEXCEPT { return 0; } |
c0000147 | 1371 | |
1372 | static _GLIBCXX_CONSTEXPR unsigned long long | |
568d055d | 1373 | round_error() _GLIBCXX_USE_NOEXCEPT { return 0; } |
c0000147 | 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 | |
568d055d | 1388 | infinity() _GLIBCXX_USE_NOEXCEPT |
1389 | { return static_cast<unsigned long long>(0); } | |
c0000147 | 1390 | |
1391 | static _GLIBCXX_CONSTEXPR unsigned long long | |
568d055d | 1392 | quiet_NaN() _GLIBCXX_USE_NOEXCEPT |
1393 | { return static_cast<unsigned long long>(0); } | |
c0000147 | 1394 | |
1395 | static _GLIBCXX_CONSTEXPR unsigned long long | |
568d055d | 1396 | signaling_NaN() _GLIBCXX_USE_NOEXCEPT |
1397 | { return static_cast<unsigned long long>(0); } | |
c0000147 | 1398 | |
1399 | static _GLIBCXX_CONSTEXPR unsigned long long | |
568d055d | 1400 | denorm_min() _GLIBCXX_USE_NOEXCEPT |
1401 | { return static_cast<unsigned long long>(0); } | |
c0000147 | 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; | |
e1e0016d | 1411 | }; |
1412 | ||
9f75f026 | 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 \ | |
15d9538c | 1425 | max() _GLIBCXX_USE_NOEXCEPT { return __glibcxx_max_b (TYPE, BITSIZE); } \ |
9f75f026 | 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 \ | |
6115449a | 1493 | max() _GLIBCXX_USE_NOEXCEPT \ |
1494 | { return __glibcxx_max_b (unsigned TYPE, BITSIZE); } \ | |
9f75f026 | 1495 | \ |
1496 | UEXT \ | |
1497 | \ | |
1498 | static _GLIBCXX_USE_CONSTEXPR int digits \ | |
1499 | = BITSIZE; \ | |
1500 | static _GLIBCXX_USE_CONSTEXPR int digits10 \ | |
1501 | = BITSIZE * 643L / 2136; \ | |
1502 | static _GLIBCXX_USE_CONSTEXPR bool is_signed = false; \ | |
1503 | static _GLIBCXX_USE_CONSTEXPR bool is_integer = true; \ | |
1504 | static _GLIBCXX_USE_CONSTEXPR bool is_exact = true; \ | |
1505 | static _GLIBCXX_USE_CONSTEXPR int radix = 2; \ | |
1506 | \ | |
1507 | static _GLIBCXX_CONSTEXPR unsigned TYPE \ | |
1508 | epsilon() _GLIBCXX_USE_NOEXCEPT { return 0; } \ | |
1509 | \ | |
1510 | static _GLIBCXX_CONSTEXPR unsigned TYPE \ | |
1511 | round_error() _GLIBCXX_USE_NOEXCEPT { return 0; } \ | |
1512 | \ | |
1513 | static _GLIBCXX_USE_CONSTEXPR int min_exponent = 0; \ | |
1514 | static _GLIBCXX_USE_CONSTEXPR int min_exponent10 = 0; \ | |
1515 | static _GLIBCXX_USE_CONSTEXPR int max_exponent = 0; \ | |
1516 | static _GLIBCXX_USE_CONSTEXPR int max_exponent10 = 0; \ | |
1517 | \ | |
1518 | static _GLIBCXX_USE_CONSTEXPR bool has_infinity = false; \ | |
1519 | static _GLIBCXX_USE_CONSTEXPR bool has_quiet_NaN = false; \ | |
1520 | static _GLIBCXX_USE_CONSTEXPR bool has_signaling_NaN = false; \ | |
1521 | static _GLIBCXX_USE_CONSTEXPR float_denorm_style has_denorm \ | |
1522 | = denorm_absent; \ | |
1523 | static _GLIBCXX_USE_CONSTEXPR bool has_denorm_loss = false; \ | |
1524 | \ | |
1525 | static _GLIBCXX_CONSTEXPR unsigned TYPE \ | |
1526 | infinity() _GLIBCXX_USE_NOEXCEPT \ | |
1527 | { return static_cast<unsigned TYPE>(0); } \ | |
1528 | \ | |
1529 | static _GLIBCXX_CONSTEXPR unsigned TYPE \ | |
1530 | quiet_NaN() _GLIBCXX_USE_NOEXCEPT \ | |
1531 | { return static_cast<unsigned TYPE>(0); } \ | |
1532 | \ | |
1533 | static _GLIBCXX_CONSTEXPR unsigned TYPE \ | |
1534 | signaling_NaN() _GLIBCXX_USE_NOEXCEPT \ | |
1535 | { return static_cast<unsigned TYPE>(0); } \ | |
1536 | \ | |
1537 | static _GLIBCXX_CONSTEXPR unsigned TYPE \ | |
1538 | denorm_min() _GLIBCXX_USE_NOEXCEPT \ | |
1539 | { return static_cast<unsigned TYPE>(0); } \ | |
1540 | \ | |
1541 | static _GLIBCXX_USE_CONSTEXPR bool is_iec559 = false; \ | |
1542 | static _GLIBCXX_USE_CONSTEXPR bool is_bounded = true; \ | |
1543 | static _GLIBCXX_USE_CONSTEXPR bool is_modulo = true; \ | |
1544 | \ | |
1545 | static _GLIBCXX_USE_CONSTEXPR bool traps = __glibcxx_integral_traps; \ | |
1546 | static _GLIBCXX_USE_CONSTEXPR bool tinyness_before = false; \ | |
1547 | static _GLIBCXX_USE_CONSTEXPR float_round_style round_style \ | |
1548 | = round_toward_zero; \ | |
1549 | }; | |
db425506 | 1550 | |
0c8766b1 | 1551 | #if __cplusplus >= 201103L |
db425506 | 1552 | |
9f75f026 | 1553 | #define __INT_N_201103(TYPE) \ |
1554 | static constexpr TYPE \ | |
1555 | lowest() noexcept { return min(); } \ | |
db425506 | 1556 | static constexpr int max_digits10 = 0; |
db425506 | 1557 | |
9f75f026 | 1558 | #define __INT_N_U201103(TYPE) \ |
1559 | static constexpr unsigned TYPE \ | |
1560 | lowest() noexcept { return min(); } \ | |
1561 | static constexpr int max_digits10 = 0; | |
db425506 | 1562 | |
9f75f026 | 1563 | #else |
1564 | #define __INT_N_201103(TYPE) | |
1565 | #define __INT_N_U201103(TYPE) | |
db425506 | 1566 | #endif |
1567 | ||
9f75f026 | 1568 | #ifdef __GLIBCXX_TYPE_INT_N_0 |
1569 | __INT_N(__GLIBCXX_TYPE_INT_N_0, __GLIBCXX_BITSIZE_INT_N_0, | |
1570 | __INT_N_201103 (__GLIBCXX_TYPE_INT_N_0), __INT_N_U201103 (__GLIBCXX_TYPE_INT_N_0)) | |
1571 | #endif | |
1572 | #ifdef __GLIBCXX_TYPE_INT_N_1 | |
1573 | __INT_N (__GLIBCXX_TYPE_INT_N_1, __GLIBCXX_BITSIZE_INT_N_1, | |
1574 | __INT_N_201103 (__GLIBCXX_TYPE_INT_N_1), __INT_N_U201103 (__GLIBCXX_TYPE_INT_N_1)) | |
1575 | #endif | |
1576 | #ifdef __GLIBCXX_TYPE_INT_N_2 | |
1577 | __INT_N (__GLIBCXX_TYPE_INT_N_2, __GLIBCXX_BITSIZE_INT_N_2, | |
1578 | __INT_N_201103 (__GLIBCXX_TYPE_INT_N_2), __INT_N_U201103 (__GLIBCXX_TYPE_INT_N_2)) | |
1579 | #endif | |
1580 | #ifdef __GLIBCXX_TYPE_INT_N_3 | |
1581 | __INT_N (__GLIBCXX_TYPE_INT_N_3, __GLIBCXX_BITSIZE_INT_N_3, | |
1582 | __INT_N_201103 (__GLIBCXX_TYPE_INT_N_3), __INT_N_U201103 (__GLIBCXX_TYPE_INT_N_3)) | |
db425506 | 1583 | #endif |
db425506 | 1584 | |
9f75f026 | 1585 | #undef __INT_N |
1586 | #undef __INT_N_201103 | |
1587 | #undef __INT_N_U201103 | |
db425506 | 1588 | |
db425506 | 1589 | #endif |
1590 | ||
b2a66747 | 1591 | /// numeric_limits<float> specialization. |
e1e0016d | 1592 | template<> |
1593 | struct numeric_limits<float> | |
1594 | { | |
c0000147 | 1595 | static _GLIBCXX_USE_CONSTEXPR bool is_specialized = true; |
1596 | ||
1597 | static _GLIBCXX_CONSTEXPR float | |
568d055d | 1598 | min() _GLIBCXX_USE_NOEXCEPT { return __FLT_MIN__; } |
c0000147 | 1599 | |
1600 | static _GLIBCXX_CONSTEXPR float | |
568d055d | 1601 | max() _GLIBCXX_USE_NOEXCEPT { return __FLT_MAX__; } |
e1e0016d | 1602 | |
0c8766b1 | 1603 | #if __cplusplus >= 201103L |
c0000147 | 1604 | static constexpr float |
568d055d | 1605 | lowest() noexcept { return -__FLT_MAX__; } |
b99d1526 | 1606 | #endif |
e1e0016d | 1607 | |
c0000147 | 1608 | static _GLIBCXX_USE_CONSTEXPR int digits = __FLT_MANT_DIG__; |
1609 | static _GLIBCXX_USE_CONSTEXPR int digits10 = __FLT_DIG__; | |
0c8766b1 | 1610 | #if __cplusplus >= 201103L |
c0000147 | 1611 | static constexpr int max_digits10 |
b99d1526 | 1612 | = __glibcxx_max_digits10 (__FLT_MANT_DIG__); |
1613 | #endif | |
c0000147 | 1614 | static _GLIBCXX_USE_CONSTEXPR bool is_signed = true; |
1615 | static _GLIBCXX_USE_CONSTEXPR bool is_integer = false; | |
1616 | static _GLIBCXX_USE_CONSTEXPR bool is_exact = false; | |
1617 | static _GLIBCXX_USE_CONSTEXPR int radix = __FLT_RADIX__; | |
1618 | ||
1619 | static _GLIBCXX_CONSTEXPR float | |
568d055d | 1620 | epsilon() _GLIBCXX_USE_NOEXCEPT { return __FLT_EPSILON__; } |
c0000147 | 1621 | |
1622 | static _GLIBCXX_CONSTEXPR float | |
568d055d | 1623 | round_error() _GLIBCXX_USE_NOEXCEPT { return 0.5F; } |
c0000147 | 1624 | |
1625 | static _GLIBCXX_USE_CONSTEXPR int min_exponent = __FLT_MIN_EXP__; | |
1626 | static _GLIBCXX_USE_CONSTEXPR int min_exponent10 = __FLT_MIN_10_EXP__; | |
1627 | static _GLIBCXX_USE_CONSTEXPR int max_exponent = __FLT_MAX_EXP__; | |
1628 | static _GLIBCXX_USE_CONSTEXPR int max_exponent10 = __FLT_MAX_10_EXP__; | |
1629 | ||
1630 | static _GLIBCXX_USE_CONSTEXPR bool has_infinity = __FLT_HAS_INFINITY__; | |
1631 | static _GLIBCXX_USE_CONSTEXPR bool has_quiet_NaN = __FLT_HAS_QUIET_NAN__; | |
1632 | static _GLIBCXX_USE_CONSTEXPR bool has_signaling_NaN = has_quiet_NaN; | |
1633 | static _GLIBCXX_USE_CONSTEXPR float_denorm_style has_denorm | |
6e24d2a7 | 1634 | = bool(__FLT_HAS_DENORM__) ? denorm_present : denorm_absent; |
c0000147 | 1635 | static _GLIBCXX_USE_CONSTEXPR bool has_denorm_loss |
1636 | = __glibcxx_float_has_denorm_loss; | |
1637 | ||
1638 | static _GLIBCXX_CONSTEXPR float | |
568d055d | 1639 | infinity() _GLIBCXX_USE_NOEXCEPT { return __builtin_huge_valf(); } |
e1e0016d | 1640 | |
c0000147 | 1641 | static _GLIBCXX_CONSTEXPR float |
568d055d | 1642 | quiet_NaN() _GLIBCXX_USE_NOEXCEPT { return __builtin_nanf(""); } |
c0000147 | 1643 | |
1644 | static _GLIBCXX_CONSTEXPR float | |
568d055d | 1645 | signaling_NaN() _GLIBCXX_USE_NOEXCEPT { return __builtin_nansf(""); } |
c0000147 | 1646 | |
1647 | static _GLIBCXX_CONSTEXPR float | |
568d055d | 1648 | denorm_min() _GLIBCXX_USE_NOEXCEPT { return __FLT_DENORM_MIN__; } |
c0000147 | 1649 | |
1650 | static _GLIBCXX_USE_CONSTEXPR bool is_iec559 | |
1651 | = has_infinity && has_quiet_NaN && has_denorm == denorm_present; | |
1652 | static _GLIBCXX_USE_CONSTEXPR bool is_bounded = true; | |
1653 | static _GLIBCXX_USE_CONSTEXPR bool is_modulo = false; | |
1654 | ||
1655 | static _GLIBCXX_USE_CONSTEXPR bool traps = __glibcxx_float_traps; | |
1656 | static _GLIBCXX_USE_CONSTEXPR bool tinyness_before | |
1657 | = __glibcxx_float_tinyness_before; | |
1658 | static _GLIBCXX_USE_CONSTEXPR float_round_style round_style | |
1659 | = round_to_nearest; | |
e1e0016d | 1660 | }; |
1661 | ||
fd80276c | 1662 | #undef __glibcxx_float_has_denorm_loss |
1663 | #undef __glibcxx_float_traps | |
1664 | #undef __glibcxx_float_tinyness_before | |
e1e0016d | 1665 | |
b2a66747 | 1666 | /// numeric_limits<double> specialization. |
e1e0016d | 1667 | template<> |
1668 | struct numeric_limits<double> | |
1669 | { | |
c0000147 | 1670 | static _GLIBCXX_USE_CONSTEXPR bool is_specialized = true; |
1671 | ||
1672 | static _GLIBCXX_CONSTEXPR double | |
568d055d | 1673 | min() _GLIBCXX_USE_NOEXCEPT { return __DBL_MIN__; } |
c0000147 | 1674 | |
1675 | static _GLIBCXX_CONSTEXPR double | |
568d055d | 1676 | max() _GLIBCXX_USE_NOEXCEPT { return __DBL_MAX__; } |
e1e0016d | 1677 | |
0c8766b1 | 1678 | #if __cplusplus >= 201103L |
c0000147 | 1679 | static constexpr double |
568d055d | 1680 | lowest() noexcept { return -__DBL_MAX__; } |
b99d1526 | 1681 | #endif |
e1e0016d | 1682 | |
c0000147 | 1683 | static _GLIBCXX_USE_CONSTEXPR int digits = __DBL_MANT_DIG__; |
1684 | static _GLIBCXX_USE_CONSTEXPR int digits10 = __DBL_DIG__; | |
0c8766b1 | 1685 | #if __cplusplus >= 201103L |
c0000147 | 1686 | static constexpr int max_digits10 |
b99d1526 | 1687 | = __glibcxx_max_digits10 (__DBL_MANT_DIG__); |
1688 | #endif | |
c0000147 | 1689 | static _GLIBCXX_USE_CONSTEXPR bool is_signed = true; |
1690 | static _GLIBCXX_USE_CONSTEXPR bool is_integer = false; | |
1691 | static _GLIBCXX_USE_CONSTEXPR bool is_exact = false; | |
1692 | static _GLIBCXX_USE_CONSTEXPR int radix = __FLT_RADIX__; | |
1693 | ||
1694 | static _GLIBCXX_CONSTEXPR double | |
568d055d | 1695 | epsilon() _GLIBCXX_USE_NOEXCEPT { return __DBL_EPSILON__; } |
c0000147 | 1696 | |
1697 | static _GLIBCXX_CONSTEXPR double | |
568d055d | 1698 | round_error() _GLIBCXX_USE_NOEXCEPT { return 0.5; } |
c0000147 | 1699 | |
1700 | static _GLIBCXX_USE_CONSTEXPR int min_exponent = __DBL_MIN_EXP__; | |
1701 | static _GLIBCXX_USE_CONSTEXPR int min_exponent10 = __DBL_MIN_10_EXP__; | |
1702 | static _GLIBCXX_USE_CONSTEXPR int max_exponent = __DBL_MAX_EXP__; | |
1703 | static _GLIBCXX_USE_CONSTEXPR int max_exponent10 = __DBL_MAX_10_EXP__; | |
1704 | ||
1705 | static _GLIBCXX_USE_CONSTEXPR bool has_infinity = __DBL_HAS_INFINITY__; | |
1706 | static _GLIBCXX_USE_CONSTEXPR bool has_quiet_NaN = __DBL_HAS_QUIET_NAN__; | |
1707 | static _GLIBCXX_USE_CONSTEXPR bool has_signaling_NaN = has_quiet_NaN; | |
1708 | static _GLIBCXX_USE_CONSTEXPR float_denorm_style has_denorm | |
6e24d2a7 | 1709 | = bool(__DBL_HAS_DENORM__) ? denorm_present : denorm_absent; |
c0000147 | 1710 | static _GLIBCXX_USE_CONSTEXPR bool has_denorm_loss |
1711 | = __glibcxx_double_has_denorm_loss; | |
1712 | ||
1713 | static _GLIBCXX_CONSTEXPR double | |
568d055d | 1714 | infinity() _GLIBCXX_USE_NOEXCEPT { return __builtin_huge_val(); } |
c0000147 | 1715 | |
1716 | static _GLIBCXX_CONSTEXPR double | |
568d055d | 1717 | quiet_NaN() _GLIBCXX_USE_NOEXCEPT { return __builtin_nan(""); } |
e1e0016d | 1718 | |
c0000147 | 1719 | static _GLIBCXX_CONSTEXPR double |
568d055d | 1720 | signaling_NaN() _GLIBCXX_USE_NOEXCEPT { return __builtin_nans(""); } |
c0000147 | 1721 | |
1722 | static _GLIBCXX_CONSTEXPR double | |
568d055d | 1723 | denorm_min() _GLIBCXX_USE_NOEXCEPT { return __DBL_DENORM_MIN__; } |
c0000147 | 1724 | |
1725 | static _GLIBCXX_USE_CONSTEXPR bool is_iec559 | |
1726 | = has_infinity && has_quiet_NaN && has_denorm == denorm_present; | |
1727 | static _GLIBCXX_USE_CONSTEXPR bool is_bounded = true; | |
1728 | static _GLIBCXX_USE_CONSTEXPR bool is_modulo = false; | |
1729 | ||
1730 | static _GLIBCXX_USE_CONSTEXPR bool traps = __glibcxx_double_traps; | |
1731 | static _GLIBCXX_USE_CONSTEXPR bool tinyness_before | |
1732 | = __glibcxx_double_tinyness_before; | |
1733 | static _GLIBCXX_USE_CONSTEXPR float_round_style round_style | |
1734 | = round_to_nearest; | |
e1e0016d | 1735 | }; |
1736 | ||
fd80276c | 1737 | #undef __glibcxx_double_has_denorm_loss |
1738 | #undef __glibcxx_double_traps | |
1739 | #undef __glibcxx_double_tinyness_before | |
ae3df4f9 | 1740 | |
b2a66747 | 1741 | /// numeric_limits<long double> specialization. |
e1e0016d | 1742 | template<> |
1743 | struct numeric_limits<long double> | |
1744 | { | |
c0000147 | 1745 | static _GLIBCXX_USE_CONSTEXPR bool is_specialized = true; |
1746 | ||
1747 | static _GLIBCXX_CONSTEXPR long double | |
568d055d | 1748 | min() _GLIBCXX_USE_NOEXCEPT { return __LDBL_MIN__; } |
c0000147 | 1749 | |
1750 | static _GLIBCXX_CONSTEXPR long double | |
568d055d | 1751 | max() _GLIBCXX_USE_NOEXCEPT { return __LDBL_MAX__; } |
e1e0016d | 1752 | |
0c8766b1 | 1753 | #if __cplusplus >= 201103L |
c0000147 | 1754 | static constexpr long double |
568d055d | 1755 | lowest() noexcept { return -__LDBL_MAX__; } |
b99d1526 | 1756 | #endif |
e1e0016d | 1757 | |
c0000147 | 1758 | static _GLIBCXX_USE_CONSTEXPR int digits = __LDBL_MANT_DIG__; |
1759 | static _GLIBCXX_USE_CONSTEXPR int digits10 = __LDBL_DIG__; | |
0c8766b1 | 1760 | #if __cplusplus >= 201103L |
c0000147 | 1761 | static _GLIBCXX_USE_CONSTEXPR int max_digits10 |
b99d1526 | 1762 | = __glibcxx_max_digits10 (__LDBL_MANT_DIG__); |
1763 | #endif | |
c0000147 | 1764 | static _GLIBCXX_USE_CONSTEXPR bool is_signed = true; |
1765 | static _GLIBCXX_USE_CONSTEXPR bool is_integer = false; | |
1766 | static _GLIBCXX_USE_CONSTEXPR bool is_exact = false; | |
1767 | static _GLIBCXX_USE_CONSTEXPR int radix = __FLT_RADIX__; | |
1768 | ||
1769 | static _GLIBCXX_CONSTEXPR long double | |
568d055d | 1770 | epsilon() _GLIBCXX_USE_NOEXCEPT { return __LDBL_EPSILON__; } |
c0000147 | 1771 | |
1772 | static _GLIBCXX_CONSTEXPR long double | |
568d055d | 1773 | round_error() _GLIBCXX_USE_NOEXCEPT { return 0.5L; } |
c0000147 | 1774 | |
1775 | static _GLIBCXX_USE_CONSTEXPR int min_exponent = __LDBL_MIN_EXP__; | |
1776 | static _GLIBCXX_USE_CONSTEXPR int min_exponent10 = __LDBL_MIN_10_EXP__; | |
1777 | static _GLIBCXX_USE_CONSTEXPR int max_exponent = __LDBL_MAX_EXP__; | |
1778 | static _GLIBCXX_USE_CONSTEXPR int max_exponent10 = __LDBL_MAX_10_EXP__; | |
1779 | ||
1780 | static _GLIBCXX_USE_CONSTEXPR bool has_infinity = __LDBL_HAS_INFINITY__; | |
1781 | static _GLIBCXX_USE_CONSTEXPR bool has_quiet_NaN = __LDBL_HAS_QUIET_NAN__; | |
1782 | static _GLIBCXX_USE_CONSTEXPR bool has_signaling_NaN = has_quiet_NaN; | |
1783 | static _GLIBCXX_USE_CONSTEXPR float_denorm_style has_denorm | |
6e24d2a7 | 1784 | = bool(__LDBL_HAS_DENORM__) ? denorm_present : denorm_absent; |
c0000147 | 1785 | static _GLIBCXX_USE_CONSTEXPR bool has_denorm_loss |
fd80276c | 1786 | = __glibcxx_long_double_has_denorm_loss; |
e1e0016d | 1787 | |
c0000147 | 1788 | static _GLIBCXX_CONSTEXPR long double |
568d055d | 1789 | infinity() _GLIBCXX_USE_NOEXCEPT { return __builtin_huge_vall(); } |
e1e0016d | 1790 | |
c0000147 | 1791 | static _GLIBCXX_CONSTEXPR long double |
568d055d | 1792 | quiet_NaN() _GLIBCXX_USE_NOEXCEPT { return __builtin_nanl(""); } |
e1e0016d | 1793 | |
c0000147 | 1794 | static _GLIBCXX_CONSTEXPR long double |
568d055d | 1795 | signaling_NaN() _GLIBCXX_USE_NOEXCEPT { return __builtin_nansl(""); } |
c0000147 | 1796 | |
1797 | static _GLIBCXX_CONSTEXPR long double | |
568d055d | 1798 | denorm_min() _GLIBCXX_USE_NOEXCEPT { return __LDBL_DENORM_MIN__; } |
c0000147 | 1799 | |
1800 | static _GLIBCXX_USE_CONSTEXPR bool is_iec559 | |
1801 | = has_infinity && has_quiet_NaN && has_denorm == denorm_present; | |
1802 | static _GLIBCXX_USE_CONSTEXPR bool is_bounded = true; | |
1803 | static _GLIBCXX_USE_CONSTEXPR bool is_modulo = false; | |
1804 | ||
1805 | static _GLIBCXX_USE_CONSTEXPR bool traps = __glibcxx_long_double_traps; | |
1806 | static _GLIBCXX_USE_CONSTEXPR bool tinyness_before = | |
1807 | __glibcxx_long_double_tinyness_before; | |
1808 | static _GLIBCXX_USE_CONSTEXPR float_round_style round_style = | |
1809 | round_to_nearest; | |
e1e0016d | 1810 | }; |
1811 | ||
fd80276c | 1812 | #undef __glibcxx_long_double_has_denorm_loss |
1813 | #undef __glibcxx_long_double_traps | |
1814 | #undef __glibcxx_long_double_tinyness_before | |
fe28a50b | 1815 | |
2948dd21 | 1816 | _GLIBCXX_END_NAMESPACE_VERSION |
1817 | } // namespace | |
e1e0016d | 1818 | |
fd80276c | 1819 | #undef __glibcxx_signed |
1820 | #undef __glibcxx_min | |
1821 | #undef __glibcxx_max | |
1822 | #undef __glibcxx_digits | |
1823 | #undef __glibcxx_digits10 | |
b99d1526 | 1824 | #undef __glibcxx_max_digits10 |
ae3df4f9 | 1825 | |
a438d9ac | 1826 | #endif // _GLIBCXX_NUMERIC_LIMITS |