Where Online Learning is simpler!
The C and C++ Include Header Files
cat -n /usr/include/c++/15/limits
1 // The template and inlines for the numeric_limits classes. -*- C++ -*- 2 3 // Copyright (C) 1999-2025 Free Software Foundation, Inc. 4 // 5 // This file is part of the GNU ISO C++ Library. This library is free 6 // software; you can redistribute it and/or modify it under the 7 // terms of the GNU General Public License as published by the 8 // Free Software Foundation; either version 3, or (at your option) 9 // any later version. 10 11 // This library is distributed in the hope that it will be useful, 12 // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 // GNU General Public License for more details. 15 16 // Under Section 7 of GPL version 3, you are granted additional 17 // permissions described in the GCC Runtime Library Exception, version 18 // 3.1, as published by the Free Software Foundation. 19 20 // You should have received a copy of the GNU General Public License and 21 // a copy of the GCC Runtime Library Exception along with this program; 22 // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see 23 // <http://www.gnu.org/licenses/>. 24 25 /** @file include/limits 26 * This is a Standard C++ Library header. 27 */ 28 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 37 #ifndef _GLIBCXX_NUMERIC_LIMITS 38 #define _GLIBCXX_NUMERIC_LIMITS 1 39 40 #ifdef _GLIBCXX_SYSHDR 41 #pragma GCC system_header 42 #endif 43 44 #pragma GCC diagnostic push 45 #pragma GCC diagnostic ignored "-Wpedantic" // Q suffix 46 #pragma GCC diagnostic ignored "-Wlong-long" 47 #pragma GCC diagnostic ignored "-Wc++23-extensions" 48 49 #include <bits/c++config.h> 50 51 // 52 // The numeric_limits<> traits document implementation-defined aspects 53 // of fundamental arithmetic data types (integers and floating points). 54 // From Standard C++ point of view, there are 14 such types: 55 // * integers 56 // bool (1) 57 // char, signed char, unsigned char, wchar_t (4) 58 // short, unsigned short (2) 59 // int, unsigned (2) 60 // long, unsigned long (2) 61 // 62 // * floating points 63 // float (1) 64 // double (1) 65 // long double (1) 66 // 67 // GNU C++ understands (where supported by the host C-library) 68 // * integer 69 // long long, unsigned long long (2) 70 // 71 // which brings us to 16 fundamental arithmetic data types in GNU C++. 72 // 73 // 74 // Since a numeric_limits<> is a bit tricky to get right, we rely on 75 // an interface composed of macros which should be defined in config/os 76 // or config/cpu when they differ from the generic (read arbitrary) 77 // definitions given here. 78 // 79 80 // These values can be overridden in the target configuration file. 81 // The default values are appropriate for many 32-bit targets. 82 83 // GCC only intrinsically supports modulo integral types. The only remaining 84 // integral exceptional values is division by zero. Only targets that do not 85 // signal division by zero in some "hard to ignore" way should use false. 86 #ifndef __glibcxx_integral_traps 87 # define __glibcxx_integral_traps true 88 #endif 89 90 // float 91 // 92 93 // Default values. Should be overridden in configuration files if necessary. 94 95 #ifndef __glibcxx_float_has_denorm_loss 96 # define __glibcxx_float_has_denorm_loss false 97 #endif 98 #ifndef __glibcxx_float_traps 99 # define __glibcxx_float_traps false 100 #endif 101 #ifndef __glibcxx_float_tinyness_before 102 # define __glibcxx_float_tinyness_before false 103 #endif 104 105 // double 106 107 // Default values. Should be overridden in configuration files if necessary. 108 109 #ifndef __glibcxx_double_has_denorm_loss 110 # define __glibcxx_double_has_denorm_loss false 111 #endif 112 #ifndef __glibcxx_double_traps 113 # define __glibcxx_double_traps false 114 #endif 115 #ifndef __glibcxx_double_tinyness_before 116 # define __glibcxx_double_tinyness_before false 117 #endif 118 119 // long double 120 121 // Default values. Should be overridden in configuration files if necessary. 122 123 #ifndef __glibcxx_long_double_has_denorm_loss 124 # define __glibcxx_long_double_has_denorm_loss false 125 #endif 126 #ifndef __glibcxx_long_double_traps 127 # define __glibcxx_long_double_traps false 128 #endif 129 #ifndef __glibcxx_long_double_tinyness_before 130 # define __glibcxx_long_double_tinyness_before false 131 #endif 132 133 // You should not need to define any macros below this point. 134 135 #define __glibcxx_signed_b(T,B) ((T)(-1) < 0) 136 137 #define __glibcxx_min_b(T,B) \ 138 (__glibcxx_signed_b (T,B) ? -__glibcxx_max_b (T,B) - 1 : (T)0) 139 140 #define __glibcxx_max_b(T,B) \ 141 (__glibcxx_signed_b (T,B) ? \ 142 (((((T)1 << (__glibcxx_digits_b (T,B) - 1)) - 1) << 1) + 1) : ~(T)0) 143 144 #define __glibcxx_digits_b(T,B) \ 145 (B - __glibcxx_signed_b (T,B)) 146 147 // The fraction 643/2136 approximates log10(2) to 7 significant digits. 148 #define __glibcxx_digits10_b(T,B) \ 149 (__glibcxx_digits_b (T,B) * 643L / 2136) 150 151 #define __glibcxx_signed(T) \ 152 __glibcxx_signed_b (T, sizeof(T) * __CHAR_BIT__) 153 #define __glibcxx_min(T) \ 154 __glibcxx_min_b (T, sizeof(T) * __CHAR_BIT__) 155 #define __glibcxx_max(T) \ 156 __glibcxx_max_b (T, sizeof(T) * __CHAR_BIT__) 157 #define __glibcxx_digits(T) \ 158 __glibcxx_digits_b (T, sizeof(T) * __CHAR_BIT__) 159 #define __glibcxx_digits10(T) \ 160 __glibcxx_digits10_b (T, sizeof(T) * __CHAR_BIT__) 161 162 #define __glibcxx_max_digits10(T) \ 163 (2 + (T) * 643L / 2136) 164 165 namespace std _GLIBCXX_VISIBILITY(default) 166 { 167 _GLIBCXX_BEGIN_NAMESPACE_VERSION 168 169 /** 170 * @brief Describes the rounding style for floating-point types. 171 * 172 * This is used in the std::numeric_limits class. 173 */ 174 enum float_round_style 175 { 176 round_indeterminate = -1, ///< Intermediate. 177 round_toward_zero = 0, ///< To zero. 178 round_to_nearest = 1, ///< To the nearest representable value. 179 round_toward_infinity = 2, ///< To infinity. 180 round_toward_neg_infinity = 3 ///< To negative infinity. 181 }; 182 183 /** 184 * @brief Describes the denormalization for floating-point types. 185 * 186 * These values represent the presence or absence of a variable number 187 * of exponent bits. This type is used in the std::numeric_limits class. 188 */ 189 enum float_denorm_style 190 { 191 /// Indeterminate at compile time whether denormalized values are allowed. 192 denorm_indeterminate = -1, 193 /// The type does not allow denormalized values. 194 denorm_absent = 0, 195 /// The type allows denormalized values. 196 denorm_present = 1 197 }; 198 199 /** 200 * @brief Part of std::numeric_limits. 201 * 202 * The @c static @c const members are usable as integral constant 203 * expressions. 204 * 205 * @note This is a separate class for purposes of efficiency; you 206 * should only access these members as part of an instantiation 207 * of the std::numeric_limits class. 208 */ 209 struct __numeric_limits_base 210 { 211 /** This will be true for all fundamental types (which have 212 specializations), and false for everything else. */ 213 static _GLIBCXX_USE_CONSTEXPR bool is_specialized = false; 214 215 /** The number of @c radix digits that be represented without change: for 216 integer types, the number of non-sign bits in the mantissa; for 217 floating types, the number of @c radix digits in the mantissa. */ 218 static _GLIBCXX_USE_CONSTEXPR int digits = 0; 219 220 /** The number of base 10 digits that can be represented without change. */ 221 static _GLIBCXX_USE_CONSTEXPR int digits10 = 0; 222 223 #if __cplusplus >= 201103L 224 /** The number of base 10 digits required to ensure that values which 225 differ are always differentiated. */ 226 static constexpr int max_digits10 = 0; 227 #endif 228 229 /** True if the type is signed. */ 230 static _GLIBCXX_USE_CONSTEXPR bool is_signed = false; 231 232 /** True if the type is integer. */ 233 static _GLIBCXX_USE_CONSTEXPR bool is_integer = false; 234 235 /** True if the type uses an exact representation. All integer types are 236 exact, but not all exact types are integer. For example, rational and 237 fixed-exponent representations are exact but not integer. */ 238 static _GLIBCXX_USE_CONSTEXPR bool is_exact = false; 239 240 /** For integer types, specifies the base of the representation. For 241 floating types, specifies the base of the exponent representation. */ 242 static _GLIBCXX_USE_CONSTEXPR int radix = 0; 243 244 /** The minimum negative integer such that @c radix raised to the power of 245 (one less than that integer) is a normalized floating point number. */ 246 static _GLIBCXX_USE_CONSTEXPR int min_exponent = 0; 247 248 /** The minimum negative integer such that 10 raised to that power is in 249 the range of normalized floating point numbers. */ 250 static _GLIBCXX_USE_CONSTEXPR int min_exponent10 = 0; 251 252 /** The maximum positive integer such that @c radix raised to the power of 253 (one less than that integer) is a representable finite floating point 254 number. */ 255 static _GLIBCXX_USE_CONSTEXPR int max_exponent = 0; 256 257 /** The maximum positive integer such that 10 raised to that power is in 258 the range of representable finite floating point numbers. */ 259 static _GLIBCXX_USE_CONSTEXPR int max_exponent10 = 0; 260 261 /** True if the type has a representation for positive infinity. */ 262 static _GLIBCXX_USE_CONSTEXPR bool has_infinity = false; 263 264 /** True if the type has a representation for a quiet (non-signaling) 265 Not a Number. */ 266 static _GLIBCXX_USE_CONSTEXPR bool has_quiet_NaN = false; 267 268 /** True if the type has a representation for a signaling 269 Not a Number. */ 270 static _GLIBCXX_USE_CONSTEXPR bool has_signaling_NaN = false; 271 272 /** See std::float_denorm_style for more information. */ 273 static _GLIBCXX_USE_CONSTEXPR float_denorm_style has_denorm = denorm_absent; 274 275 /** True if loss of accuracy is detected as a denormalization loss, 276 rather than as an inexact result. */ 277 static _GLIBCXX_USE_CONSTEXPR bool has_denorm_loss = false; 278 279 /** True if-and-only-if the type adheres to the IEC 559 standard, also 280 known as IEEE 754. (Only makes sense for floating point types.) */ 281 static _GLIBCXX_USE_CONSTEXPR bool is_iec559 = false; 282 283 /** True if the set of values representable by the type is 284 finite. All built-in types are bounded, this member would be 285 false for arbitrary precision types. */ 286 static _GLIBCXX_USE_CONSTEXPR bool is_bounded = false; 287 288 /** True if the type is @e modulo. A type is modulo if, for any 289 operation involving +, -, or * on values of that type whose 290 result would fall outside the range [min(),max()], the value 291 returned differs from the true value by an integer multiple of 292 max() - min() + 1. On most machines, this is false for floating 293 types, true for unsigned integers, and true for signed integers. 294 See PR22200 about signed integers. */ 295 static _GLIBCXX_USE_CONSTEXPR bool is_modulo = false; 296 297 /** True if trapping is implemented for this type. */ 298 static _GLIBCXX_USE_CONSTEXPR bool traps = false; 299 300 /** True if tininess is detected before rounding. (see IEC 559) */ 301 static _GLIBCXX_USE_CONSTEXPR bool tinyness_before = false; 302 303 /** See std::float_round_style for more information. This is only 304 meaningful for floating types; integer types will all be 305 round_toward_zero. */ 306 static _GLIBCXX_USE_CONSTEXPR float_round_style round_style = 307 round_toward_zero; 308 }; 309 310 /** 311 * @brief Properties of fundamental types. 312 * 313 * This class allows a program to obtain information about the 314 * representation of a fundamental type on a given platform. For 315 * non-fundamental types, the functions will return 0 and the data 316 * members will all be @c false. 317 */ 318 template<typename _Tp> 319 struct numeric_limits : public __numeric_limits_base 320 { 321 /** The minimum finite value, or for floating types with 322 denormalization, the minimum positive normalized value. */ 323 static _GLIBCXX_CONSTEXPR _Tp 324 min() _GLIBCXX_USE_NOEXCEPT { return _Tp(); } 325 326 /** The maximum finite value. */ 327 static _GLIBCXX_CONSTEXPR _Tp 328 max() _GLIBCXX_USE_NOEXCEPT { return _Tp(); } 329 330 #if __cplusplus >= 201103L 331 /** A finite value x such that there is no other finite value y 332 * where y < x. */ 333 static constexpr _Tp 334 lowest() noexcept { return _Tp(); } 335 #endif 336 337 /** The @e machine @e epsilon: the difference between 1 and the least 338 value greater than 1 that is representable. */ 339 static _GLIBCXX_CONSTEXPR _Tp 340 epsilon() _GLIBCXX_USE_NOEXCEPT { return _Tp(); } 341 342 /** The maximum rounding error measurement (see LIA-1). */ 343 static _GLIBCXX_CONSTEXPR _Tp 344 round_error() _GLIBCXX_USE_NOEXCEPT { return _Tp(); } 345 346 /** The representation of positive infinity, if @c has_infinity. */ 347 static _GLIBCXX_CONSTEXPR _Tp 348 infinity() _GLIBCXX_USE_NOEXCEPT { return _Tp(); } 349 350 /** The representation of a quiet Not a Number, 351 if @c has_quiet_NaN. */ 352 static _GLIBCXX_CONSTEXPR _Tp 353 quiet_NaN() _GLIBCXX_USE_NOEXCEPT { return _Tp(); } 354 355 /** The representation of a signaling Not a Number, if 356 @c has_signaling_NaN. */ 357 static _GLIBCXX_CONSTEXPR _Tp 358 signaling_NaN() _GLIBCXX_USE_NOEXCEPT { return _Tp(); } 359 360 /** The minimum positive denormalized value. For types where 361 @c has_denorm is false, this is the minimum positive normalized 362 value. */ 363 static _GLIBCXX_CONSTEXPR _Tp 364 denorm_min() _GLIBCXX_USE_NOEXCEPT { return _Tp(); } 365 }; 366 367 // _GLIBCXX_RESOLVE_LIB_DEFECTS 368 // 559. numeric_limits<const T> 369 370 template<typename _Tp> 371 struct numeric_limits<const _Tp> 372 : public numeric_limits<_Tp> { }; 373 374 template<typename _Tp> 375 struct numeric_limits<volatile _Tp> 376 : public numeric_limits<_Tp> { }; 377 378 template<typename _Tp> 379 struct numeric_limits<const volatile _Tp> 380 : public numeric_limits<_Tp> { }; 381 382 // Now there follow 16 explicit specializations. Yes, 16. Make sure 383 // you get the count right. (18 in C++11 mode, with char16_t and char32_t.) 384 // (+1 if char8_t is enabled.) 385 386 // _GLIBCXX_RESOLVE_LIB_DEFECTS 387 // 184. numeric_limits<bool> wording problems 388 389 /// numeric_limits<bool> specialization. 390 template<> 391 struct numeric_limits<bool> 392 { 393 static _GLIBCXX_USE_CONSTEXPR bool is_specialized = true; 394 395 static _GLIBCXX_CONSTEXPR bool 396 min() _GLIBCXX_USE_NOEXCEPT { return false; } 397 398 static _GLIBCXX_CONSTEXPR bool 399 max() _GLIBCXX_USE_NOEXCEPT { return true; } 400 401 #if __cplusplus >= 201103L 402 static constexpr bool 403 lowest() noexcept { return min(); } 404 #endif 405 static _GLIBCXX_USE_CONSTEXPR int digits = 1; 406 static _GLIBCXX_USE_CONSTEXPR int digits10 = 0; 407 #if __cplusplus >= 201103L 408 static constexpr int max_digits10 = 0; 409 #endif 410 static _GLIBCXX_USE_CONSTEXPR bool is_signed = false; 411 static _GLIBCXX_USE_CONSTEXPR bool is_integer = true; 412 static _GLIBCXX_USE_CONSTEXPR bool is_exact = true; 413 static _GLIBCXX_USE_CONSTEXPR int radix = 2; 414 415 static _GLIBCXX_CONSTEXPR bool 416 epsilon() _GLIBCXX_USE_NOEXCEPT { return false; } 417 418 static _GLIBCXX_CONSTEXPR bool 419 round_error() _GLIBCXX_USE_NOEXCEPT { return false; } 420 421 static _GLIBCXX_USE_CONSTEXPR int min_exponent = 0; 422 static _GLIBCXX_USE_CONSTEXPR int min_exponent10 = 0; 423 static _GLIBCXX_USE_CONSTEXPR int max_exponent = 0; 424 static _GLIBCXX_USE_CONSTEXPR int max_exponent10 = 0; 425 426 static _GLIBCXX_USE_CONSTEXPR bool has_infinity = false; 427 static _GLIBCXX_USE_CONSTEXPR bool has_quiet_NaN = false; 428 static _GLIBCXX_USE_CONSTEXPR bool has_signaling_NaN = false; 429 static _GLIBCXX_USE_CONSTEXPR float_denorm_style has_denorm 430 = denorm_absent; 431 static _GLIBCXX_USE_CONSTEXPR bool has_denorm_loss = false; 432 433 static _GLIBCXX_CONSTEXPR bool 434 infinity() _GLIBCXX_USE_NOEXCEPT { return false; } 435 436 static _GLIBCXX_CONSTEXPR bool 437 quiet_NaN() _GLIBCXX_USE_NOEXCEPT { return false; } 438 439 static _GLIBCXX_CONSTEXPR bool 440 signaling_NaN() _GLIBCXX_USE_NOEXCEPT { return false; } 441 442 static _GLIBCXX_CONSTEXPR bool 443 denorm_min() _GLIBCXX_USE_NOEXCEPT { return false; } 444 445 static _GLIBCXX_USE_CONSTEXPR bool is_iec559 = false; 446 static _GLIBCXX_USE_CONSTEXPR bool is_bounded = true; 447 static _GLIBCXX_USE_CONSTEXPR bool is_modulo = false; 448 449 // It is not clear what it means for a boolean type to trap. 450 // This is a DR on the LWG issue list. Here, I use integer 451 // promotion semantics. 452 static _GLIBCXX_USE_CONSTEXPR bool traps = __glibcxx_integral_traps; 453 static _GLIBCXX_USE_CONSTEXPR bool tinyness_before = false; 454 static _GLIBCXX_USE_CONSTEXPR float_round_style round_style 455 = round_toward_zero; 456 }; 457 458 /// numeric_limits<char> specialization. 459 template<> 460 struct numeric_limits<char> 461 { 462 static _GLIBCXX_USE_CONSTEXPR bool is_specialized = true; 463 464 static _GLIBCXX_CONSTEXPR char 465 min() _GLIBCXX_USE_NOEXCEPT { return __glibcxx_min(char); } 466 467 static _GLIBCXX_CONSTEXPR char 468 max() _GLIBCXX_USE_NOEXCEPT { return __glibcxx_max(char); } 469 470 #if __cplusplus >= 201103L 471 static constexpr char 472 lowest() noexcept { return min(); } 473 #endif 474 475 static _GLIBCXX_USE_CONSTEXPR int digits = __glibcxx_digits (char); 476 static _GLIBCXX_USE_CONSTEXPR int digits10 = __glibcxx_digits10 (char); 477 #if __cplusplus >= 201103L 478 static constexpr int max_digits10 = 0; 479 #endif 480 static _GLIBCXX_USE_CONSTEXPR bool is_signed = __glibcxx_signed (char); 481 static _GLIBCXX_USE_CONSTEXPR bool is_integer = true; 482 static _GLIBCXX_USE_CONSTEXPR bool is_exact = true; 483 static _GLIBCXX_USE_CONSTEXPR int radix = 2; 484 485 static _GLIBCXX_CONSTEXPR char 486 epsilon() _GLIBCXX_USE_NOEXCEPT { return 0; } 487 488 static _GLIBCXX_CONSTEXPR char 489 round_error() _GLIBCXX_USE_NOEXCEPT { return 0; } 490 491 static _GLIBCXX_USE_CONSTEXPR int min_exponent = 0; 492 static _GLIBCXX_USE_CONSTEXPR int min_exponent10 = 0; 493 static _GLIBCXX_USE_CONSTEXPR int max_exponent = 0; 494 static _GLIBCXX_USE_CONSTEXPR int max_exponent10 = 0; 495 496 static _GLIBCXX_USE_CONSTEXPR bool has_infinity = false; 497 static _GLIBCXX_USE_CONSTEXPR bool has_quiet_NaN = false; 498 static _GLIBCXX_USE_CONSTEXPR bool has_signaling_NaN = false; 499 static _GLIBCXX_USE_CONSTEXPR float_denorm_style has_denorm 500 = denorm_absent; 501 static _GLIBCXX_USE_CONSTEXPR bool has_denorm_loss = false; 502 503 static _GLIBCXX_CONSTEXPR 504 char infinity() _GLIBCXX_USE_NOEXCEPT { return char(); } 505 506 static _GLIBCXX_CONSTEXPR char 507 quiet_NaN() _GLIBCXX_USE_NOEXCEPT { return char(); } 508 509 static _GLIBCXX_CONSTEXPR char 510 signaling_NaN() _GLIBCXX_USE_NOEXCEPT { return char(); } 511 512 static _GLIBCXX_CONSTEXPR char 513 denorm_min() _GLIBCXX_USE_NOEXCEPT { return static_cast<char>(0); } 514 515 static _GLIBCXX_USE_CONSTEXPR bool is_iec559 = false; 516 static _GLIBCXX_USE_CONSTEXPR bool is_bounded = true; 517 static _GLIBCXX_USE_CONSTEXPR bool is_modulo = !is_signed; 518 519 static _GLIBCXX_USE_CONSTEXPR bool traps = __glibcxx_integral_traps; 520 static _GLIBCXX_USE_CONSTEXPR bool tinyness_before = false; 521 static _GLIBCXX_USE_CONSTEXPR float_round_style round_style 522 = round_toward_zero; 523 }; 524 525 /// numeric_limits<signed char> specialization. 526 template<> 527 struct numeric_limits<signed char> 528 { 529 static _GLIBCXX_USE_CONSTEXPR bool is_specialized = true; 530 531 static _GLIBCXX_CONSTEXPR signed char 532 min() _GLIBCXX_USE_NOEXCEPT { return -__SCHAR_MAX__ - 1; } 533 534 static _GLIBCXX_CONSTEXPR signed char 535 max() _GLIBCXX_USE_NOEXCEPT { return __SCHAR_MAX__; } 536 537 #if __cplusplus >= 201103L 538 static constexpr signed char 539 lowest() noexcept { return min(); } 540 #endif 541 542 static _GLIBCXX_USE_CONSTEXPR int digits = __glibcxx_digits (signed char); 543 static _GLIBCXX_USE_CONSTEXPR int digits10 544 = __glibcxx_digits10 (signed char); 545 #if __cplusplus >= 201103L 546 static constexpr int max_digits10 = 0; 547 #endif 548 static _GLIBCXX_USE_CONSTEXPR bool is_signed = true; 549 static _GLIBCXX_USE_CONSTEXPR bool is_integer = true; 550 static _GLIBCXX_USE_CONSTEXPR bool is_exact = true; 551 static _GLIBCXX_USE_CONSTEXPR int radix = 2; 552 553 static _GLIBCXX_CONSTEXPR signed char 554 epsilon() _GLIBCXX_USE_NOEXCEPT { return 0; } 555 556 static _GLIBCXX_CONSTEXPR signed char 557 round_error() _GLIBCXX_USE_NOEXCEPT { return 0; } 558 559 static _GLIBCXX_USE_CONSTEXPR int min_exponent = 0; 560 static _GLIBCXX_USE_CONSTEXPR int min_exponent10 = 0; 561 static _GLIBCXX_USE_CONSTEXPR int max_exponent = 0; 562 static _GLIBCXX_USE_CONSTEXPR int max_exponent10 = 0; 563 564 static _GLIBCXX_USE_CONSTEXPR bool has_infinity = false; 565 static _GLIBCXX_USE_CONSTEXPR bool has_quiet_NaN = false; 566 static _GLIBCXX_USE_CONSTEXPR bool has_signaling_NaN = false; 567 static _GLIBCXX_USE_CONSTEXPR float_denorm_style has_denorm 568 = denorm_absent; 569 static _GLIBCXX_USE_CONSTEXPR bool has_denorm_loss = false; 570 571 static _GLIBCXX_CONSTEXPR signed char 572 infinity() _GLIBCXX_USE_NOEXCEPT { return static_cast<signed char>(0); } 573 574 static _GLIBCXX_CONSTEXPR signed char 575 quiet_NaN() _GLIBCXX_USE_NOEXCEPT { return static_cast<signed char>(0); } 576 577 static _GLIBCXX_CONSTEXPR signed char 578 signaling_NaN() _GLIBCXX_USE_NOEXCEPT 579 { return static_cast<signed char>(0); } 580 581 static _GLIBCXX_CONSTEXPR signed char 582 denorm_min() _GLIBCXX_USE_NOEXCEPT 583 { return static_cast<signed char>(0); } 584 585 static _GLIBCXX_USE_CONSTEXPR bool is_iec559 = false; 586 static _GLIBCXX_USE_CONSTEXPR bool is_bounded = true; 587 static _GLIBCXX_USE_CONSTEXPR bool is_modulo = false; 588 589 static _GLIBCXX_USE_CONSTEXPR bool traps = __glibcxx_integral_traps; 590 static _GLIBCXX_USE_CONSTEXPR bool tinyness_before = false; 591 static _GLIBCXX_USE_CONSTEXPR float_round_style round_style 592 = round_toward_zero; 593 }; 594 595 /// numeric_limits<unsigned char> specialization. 596 template<> 597 struct numeric_limits<unsigned char> 598 { 599 static _GLIBCXX_USE_CONSTEXPR bool is_specialized = true; 600 601 static _GLIBCXX_CONSTEXPR unsigned char 602 min() _GLIBCXX_USE_NOEXCEPT { return 0; } 603 604 static _GLIBCXX_CONSTEXPR unsigned char 605 max() _GLIBCXX_USE_NOEXCEPT { return __SCHAR_MAX__ * 2U + 1; } 606 607 #if __cplusplus >= 201103L 608 static constexpr unsigned char 609 lowest() noexcept { return min(); } 610 #endif 611 612 static _GLIBCXX_USE_CONSTEXPR int digits 613 = __glibcxx_digits (unsigned char); 614 static _GLIBCXX_USE_CONSTEXPR int digits10 615 = __glibcxx_digits10 (unsigned char); 616 #if __cplusplus >= 201103L 617 static constexpr int max_digits10 = 0; 618 #endif 619 static _GLIBCXX_USE_CONSTEXPR bool is_signed = false; 620 static _GLIBCXX_USE_CONSTEXPR bool is_integer = true; 621 static _GLIBCXX_USE_CONSTEXPR bool is_exact = true; 622 static _GLIBCXX_USE_CONSTEXPR int radix = 2; 623 624 static _GLIBCXX_CONSTEXPR unsigned char 625 epsilon() _GLIBCXX_USE_NOEXCEPT { return 0; } 626 627 static _GLIBCXX_CONSTEXPR unsigned char 628 round_error() _GLIBCXX_USE_NOEXCEPT { return 0; } 629 630 static _GLIBCXX_USE_CONSTEXPR int min_exponent = 0; 631 static _GLIBCXX_USE_CONSTEXPR int min_exponent10 = 0; 632 static _GLIBCXX_USE_CONSTEXPR int max_exponent = 0; 633 static _GLIBCXX_USE_CONSTEXPR int max_exponent10 = 0; 634 635 static _GLIBCXX_USE_CONSTEXPR bool has_infinity = false; 636 static _GLIBCXX_USE_CONSTEXPR bool has_quiet_NaN = false; 637 static _GLIBCXX_USE_CONSTEXPR bool has_signaling_NaN = false; 638 static _GLIBCXX_USE_CONSTEXPR float_denorm_style has_denorm 639 = denorm_absent; 640 static _GLIBCXX_USE_CONSTEXPR bool has_denorm_loss = false; 641 642 static _GLIBCXX_CONSTEXPR unsigned char 643 infinity() _GLIBCXX_USE_NOEXCEPT 644 { return static_cast<unsigned char>(0); } 645 646 static _GLIBCXX_CONSTEXPR unsigned char 647 quiet_NaN() _GLIBCXX_USE_NOEXCEPT 648 { return static_cast<unsigned char>(0); } 649 650 static _GLIBCXX_CONSTEXPR unsigned char 651 signaling_NaN() _GLIBCXX_USE_NOEXCEPT 652 { return static_cast<unsigned char>(0); } 653 654 static _GLIBCXX_CONSTEXPR unsigned char 655 denorm_min() _GLIBCXX_USE_NOEXCEPT 656 { return static_cast<unsigned char>(0); } 657 658 static _GLIBCXX_USE_CONSTEXPR bool is_iec559 = false; 659 static _GLIBCXX_USE_CONSTEXPR bool is_bounded = true; 660 static _GLIBCXX_USE_CONSTEXPR bool is_modulo = true; 661 662 static _GLIBCXX_USE_CONSTEXPR bool traps = __glibcxx_integral_traps; 663 static _GLIBCXX_USE_CONSTEXPR bool tinyness_before = false; 664 static _GLIBCXX_USE_CONSTEXPR float_round_style round_style 665 = round_toward_zero; 666 }; 667 668 /// numeric_limits<wchar_t> specialization. 669 template<> 670 struct numeric_limits<wchar_t> 671 { 672 static _GLIBCXX_USE_CONSTEXPR bool is_specialized = true; 673 674 static _GLIBCXX_CONSTEXPR wchar_t 675 min() _GLIBCXX_USE_NOEXCEPT { return __glibcxx_min (wchar_t); } 676 677 static _GLIBCXX_CONSTEXPR wchar_t 678 max() _GLIBCXX_USE_NOEXCEPT { return __glibcxx_max (wchar_t); } 679 680 #if __cplusplus >= 201103L 681 static constexpr wchar_t 682 lowest() noexcept { return min(); } 683 #endif 684 685 static _GLIBCXX_USE_CONSTEXPR int digits = __glibcxx_digits (wchar_t); 686 static _GLIBCXX_USE_CONSTEXPR int digits10 687 = __glibcxx_digits10 (wchar_t); 688 #if __cplusplus >= 201103L 689 static constexpr int max_digits10 = 0; 690 #endif 691 static _GLIBCXX_USE_CONSTEXPR bool is_signed = __glibcxx_signed (wchar_t); 692 static _GLIBCXX_USE_CONSTEXPR bool is_integer = true; 693 static _GLIBCXX_USE_CONSTEXPR bool is_exact = true; 694 static _GLIBCXX_USE_CONSTEXPR int radix = 2; 695 696 static _GLIBCXX_CONSTEXPR wchar_t 697 epsilon() _GLIBCXX_USE_NOEXCEPT { return 0; } 698 699 static _GLIBCXX_CONSTEXPR wchar_t 700 round_error() _GLIBCXX_USE_NOEXCEPT { return 0; } 701 702 static _GLIBCXX_USE_CONSTEXPR int min_exponent = 0; 703 static _GLIBCXX_USE_CONSTEXPR int min_exponent10 = 0; 704 static _GLIBCXX_USE_CONSTEXPR int max_exponent = 0; 705 static _GLIBCXX_USE_CONSTEXPR int max_exponent10 = 0; 706 707 static _GLIBCXX_USE_CONSTEXPR bool has_infinity = false; 708 static _GLIBCXX_USE_CONSTEXPR bool has_quiet_NaN = false; 709 static _GLIBCXX_USE_CONSTEXPR bool has_signaling_NaN = false; 710 static _GLIBCXX_USE_CONSTEXPR float_denorm_style has_denorm 711 = denorm_absent; 712 static _GLIBCXX_USE_CONSTEXPR bool has_denorm_loss = false; 713 714 static _GLIBCXX_CONSTEXPR wchar_t 715 infinity() _GLIBCXX_USE_NOEXCEPT { return wchar_t(); } 716 717 static _GLIBCXX_CONSTEXPR wchar_t 718 quiet_NaN() _GLIBCXX_USE_NOEXCEPT { return wchar_t(); } 719 720 static _GLIBCXX_CONSTEXPR wchar_t 721 signaling_NaN() _GLIBCXX_USE_NOEXCEPT { return wchar_t(); } 722 723 static _GLIBCXX_CONSTEXPR wchar_t 724 denorm_min() _GLIBCXX_USE_NOEXCEPT { return wchar_t(); } 725 726 static _GLIBCXX_USE_CONSTEXPR bool is_iec559 = false; 727 static _GLIBCXX_USE_CONSTEXPR bool is_bounded = true; 728 static _GLIBCXX_USE_CONSTEXPR bool is_modulo = !is_signed; 729 730 static _GLIBCXX_USE_CONSTEXPR bool traps = __glibcxx_integral_traps; 731 static _GLIBCXX_USE_CONSTEXPR bool tinyness_before = false; 732 static _GLIBCXX_USE_CONSTEXPR float_round_style round_style 733 = round_toward_zero; 734 }; 735 736 #if _GLIBCXX_USE_CHAR8_T 737 /// numeric_limits<char8_t> specialization. 738 template<> 739 struct numeric_limits<char8_t> 740 { 741 static _GLIBCXX_USE_CONSTEXPR bool is_specialized = true; 742 743 static _GLIBCXX_CONSTEXPR char8_t 744 min() _GLIBCXX_USE_NOEXCEPT { return __glibcxx_min (char8_t); } 745 746 static _GLIBCXX_CONSTEXPR char8_t 747 max() _GLIBCXX_USE_NOEXCEPT { return __glibcxx_max (char8_t); } 748 749 static _GLIBCXX_CONSTEXPR char8_t 750 lowest() _GLIBCXX_USE_NOEXCEPT { return min(); } 751 752 static _GLIBCXX_USE_CONSTEXPR int digits = __glibcxx_digits (char8_t); 753 static _GLIBCXX_USE_CONSTEXPR int digits10 = __glibcxx_digits10 (char8_t); 754 static _GLIBCXX_USE_CONSTEXPR int max_digits10 = 0; 755 static _GLIBCXX_USE_CONSTEXPR bool is_signed = __glibcxx_signed (char8_t); 756 static _GLIBCXX_USE_CONSTEXPR bool is_integer = true; 757 static _GLIBCXX_USE_CONSTEXPR bool is_exact = true; 758 static _GLIBCXX_USE_CONSTEXPR int radix = 2; 759 760 static _GLIBCXX_CONSTEXPR char8_t 761 epsilon() _GLIBCXX_USE_NOEXCEPT { return 0; } 762 763 static _GLIBCXX_CONSTEXPR char8_t 764 round_error() _GLIBCXX_USE_NOEXCEPT { return 0; } 765 766 static _GLIBCXX_USE_CONSTEXPR int min_exponent = 0; 767 static _GLIBCXX_USE_CONSTEXPR int min_exponent10 = 0; 768 static _GLIBCXX_USE_CONSTEXPR int max_exponent = 0; 769 static _GLIBCXX_USE_CONSTEXPR int max_exponent10 = 0; 770 771 static _GLIBCXX_USE_CONSTEXPR bool has_infinity = false; 772 static _GLIBCXX_USE_CONSTEXPR bool has_quiet_NaN = false; 773 static _GLIBCXX_USE_CONSTEXPR bool has_signaling_NaN = false; 774 static _GLIBCXX_USE_CONSTEXPR float_denorm_style has_denorm 775 = denorm_absent; 776 static _GLIBCXX_USE_CONSTEXPR bool has_denorm_loss = false; 777 778 static _GLIBCXX_CONSTEXPR char8_t 779 infinity() _GLIBCXX_USE_NOEXCEPT { return char8_t(); } 780 781 static _GLIBCXX_CONSTEXPR char8_t 782 quiet_NaN() _GLIBCXX_USE_NOEXCEPT { return char8_t(); } 783 784 static _GLIBCXX_CONSTEXPR char8_t 785 signaling_NaN() _GLIBCXX_USE_NOEXCEPT { return char8_t(); } 786 787 static _GLIBCXX_CONSTEXPR char8_t 788 denorm_min() _GLIBCXX_USE_NOEXCEPT { return char8_t(); } 789 790 static _GLIBCXX_USE_CONSTEXPR bool is_iec559 = false; 791 static _GLIBCXX_USE_CONSTEXPR bool is_bounded = true; 792 static _GLIBCXX_USE_CONSTEXPR bool is_modulo = !is_signed; 793 794 static _GLIBCXX_USE_CONSTEXPR bool traps = __glibcxx_integral_traps; 795 static _GLIBCXX_USE_CONSTEXPR bool tinyness_before = false; 796 static _GLIBCXX_USE_CONSTEXPR float_round_style round_style 797 = round_toward_zero; 798 }; 799 #endif 800 801 #if __cplusplus >= 201103L 802 /// numeric_limits<char16_t> specialization. 803 template<> 804 struct numeric_limits<char16_t> 805 { 806 static constexpr bool is_specialized = true; 807 808 static constexpr char16_t 809 min() noexcept { return __glibcxx_min (char16_t); } 810 811 static constexpr char16_t 812 max() noexcept { return __glibcxx_max (char16_t); } 813 814 static constexpr char16_t 815 lowest() noexcept { return min(); } 816 817 static constexpr int digits = __glibcxx_digits (char16_t); 818 static constexpr int digits10 = __glibcxx_digits10 (char16_t); 819 static constexpr int max_digits10 = 0; 820 static constexpr bool is_signed = __glibcxx_signed (char16_t); 821 static constexpr bool is_integer = true; 822 static constexpr bool is_exact = true; 823 static constexpr int radix = 2; 824 825 static constexpr char16_t 826 epsilon() noexcept { return 0; } 827 828 static constexpr char16_t 829 round_error() noexcept { return 0; } 830 831 static constexpr int min_exponent = 0; 832 static constexpr int min_exponent10 = 0; 833 static constexpr int max_exponent = 0; 834 static constexpr int max_exponent10 = 0; 835 836 static constexpr bool has_infinity = false; 837 static constexpr bool has_quiet_NaN = false; 838 static constexpr bool has_signaling_NaN = false; 839 static constexpr float_denorm_style has_denorm = denorm_absent; 840 static constexpr bool has_denorm_loss = false; 841 842 static constexpr char16_t 843 infinity() noexcept { return char16_t(); } 844 845 static constexpr char16_t 846 quiet_NaN() noexcept { return char16_t(); } 847 848 static constexpr char16_t 849 signaling_NaN() noexcept { return char16_t(); } 850 851 static constexpr char16_t 852 denorm_min() noexcept { return char16_t(); } 853 854 static constexpr bool is_iec559 = false; 855 static constexpr bool is_bounded = true; 856 static constexpr bool is_modulo = !is_signed; 857 858 static constexpr bool traps = __glibcxx_integral_traps; 859 static constexpr bool tinyness_before = false; 860 static constexpr float_round_style round_style = round_toward_zero; 861 }; 862 863 /// numeric_limits<char32_t> specialization. 864 template<> 865 struct numeric_limits<char32_t> 866 { 867 static constexpr bool is_specialized = true; 868 869 static constexpr char32_t 870 min() noexcept { return __glibcxx_min (char32_t); } 871 872 static constexpr char32_t 873 max() noexcept { return __glibcxx_max (char32_t); } 874 875 static constexpr char32_t 876 lowest() noexcept { return min(); } 877 878 static constexpr int digits = __glibcxx_digits (char32_t); 879 static constexpr int digits10 = __glibcxx_digits10 (char32_t); 880 static constexpr int max_digits10 = 0; 881 static constexpr bool is_signed = __glibcxx_signed (char32_t); 882 static constexpr bool is_integer = true; 883 static constexpr bool is_exact = true; 884 static constexpr int radix = 2; 885 886 static constexpr char32_t 887 epsilon() noexcept { return 0; } 888 889 static constexpr char32_t 890 round_error() noexcept { return 0; } 891 892 static constexpr int min_exponent = 0; 893 static constexpr int min_exponent10 = 0; 894 static constexpr int max_exponent = 0; 895 static constexpr int max_exponent10 = 0; 896 897 static constexpr bool has_infinity = false; 898 static constexpr bool has_quiet_NaN = false; 899 static constexpr bool has_signaling_NaN = false; 900 static constexpr float_denorm_style has_denorm = denorm_absent; 901 static constexpr bool has_denorm_loss = false; 902 903 static constexpr char32_t 904 infinity() noexcept { return char32_t(); } 905 906 static constexpr char32_t 907 quiet_NaN() noexcept { return char32_t(); } 908 909 static constexpr char32_t 910 signaling_NaN() noexcept { return char32_t(); } 911 912 static constexpr char32_t 913 denorm_min() noexcept { return char32_t(); } 914 915 static constexpr bool is_iec559 = false; 916 static constexpr bool is_bounded = true; 917 static constexpr bool is_modulo = !is_signed; 918 919 static constexpr bool traps = __glibcxx_integral_traps; 920 static constexpr bool tinyness_before = false; 921 static constexpr float_round_style round_style = round_toward_zero; 922 }; 923 #endif 924 925 /// numeric_limits<short> specialization. 926 template<> 927 struct numeric_limits<short> 928 { 929 static _GLIBCXX_USE_CONSTEXPR bool is_specialized = true; 930 931 static _GLIBCXX_CONSTEXPR short 932 min() _GLIBCXX_USE_NOEXCEPT { return -__SHRT_MAX__ - 1; } 933 934 static _GLIBCXX_CONSTEXPR short 935 max() _GLIBCXX_USE_NOEXCEPT { return __SHRT_MAX__; } 936 937 #if __cplusplus >= 201103L 938 static constexpr short 939 lowest() noexcept { return min(); } 940 #endif 941 942 static _GLIBCXX_USE_CONSTEXPR int digits = __glibcxx_digits (short); 943 static _GLIBCXX_USE_CONSTEXPR int digits10 = __glibcxx_digits10 (short); 944 #if __cplusplus >= 201103L 945 static constexpr int max_digits10 = 0; 946 #endif 947 static _GLIBCXX_USE_CONSTEXPR bool is_signed = true; 948 static _GLIBCXX_USE_CONSTEXPR bool is_integer = true; 949 static _GLIBCXX_USE_CONSTEXPR bool is_exact = true; 950 static _GLIBCXX_USE_CONSTEXPR int radix = 2; 951 952 static _GLIBCXX_CONSTEXPR short 953 epsilon() _GLIBCXX_USE_NOEXCEPT { return 0; } 954 955 static _GLIBCXX_CONSTEXPR short 956 round_error() _GLIBCXX_USE_NOEXCEPT { return 0; } 957 958 static _GLIBCXX_USE_CONSTEXPR int min_exponent = 0; 959 static _GLIBCXX_USE_CONSTEXPR int min_exponent10 = 0; 960 static _GLIBCXX_USE_CONSTEXPR int max_exponent = 0; 961 static _GLIBCXX_USE_CONSTEXPR int max_exponent10 = 0; 962 963 static _GLIBCXX_USE_CONSTEXPR bool has_infinity = false; 964 static _GLIBCXX_USE_CONSTEXPR bool has_quiet_NaN = false; 965 static _GLIBCXX_USE_CONSTEXPR bool has_signaling_NaN = false; 966 static _GLIBCXX_USE_CONSTEXPR float_denorm_style has_denorm 967 = denorm_absent; 968 static _GLIBCXX_USE_CONSTEXPR bool has_denorm_loss = false; 969 970 static _GLIBCXX_CONSTEXPR short 971 infinity() _GLIBCXX_USE_NOEXCEPT { return short(); } 972 973 static _GLIBCXX_CONSTEXPR short 974 quiet_NaN() _GLIBCXX_USE_NOEXCEPT { return short(); } 975 976 static _GLIBCXX_CONSTEXPR short 977 signaling_NaN() _GLIBCXX_USE_NOEXCEPT { return short(); } 978 979 static _GLIBCXX_CONSTEXPR short 980 denorm_min() _GLIBCXX_USE_NOEXCEPT { return short(); } 981 982 static _GLIBCXX_USE_CONSTEXPR bool is_iec559 = false; 983 static _GLIBCXX_USE_CONSTEXPR bool is_bounded = true; 984 static _GLIBCXX_USE_CONSTEXPR bool is_modulo = false; 985 986 static _GLIBCXX_USE_CONSTEXPR bool traps = __glibcxx_integral_traps; 987 static _GLIBCXX_USE_CONSTEXPR bool tinyness_before = false; 988 static _GLIBCXX_USE_CONSTEXPR float_round_style round_style 989 = round_toward_zero; 990 }; 991 992 /// numeric_limits<unsigned short> specialization. 993 template<> 994 struct numeric_limits<unsigned short> 995 { 996 static _GLIBCXX_USE_CONSTEXPR bool is_specialized = true; 997 998 static _GLIBCXX_CONSTEXPR unsigned short 999 min() _GLIBCXX_USE_NOEXCEPT { return 0; } 1000 1001 static _GLIBCXX_CONSTEXPR unsigned short 1002 max() _GLIBCXX_USE_NOEXCEPT { return __SHRT_MAX__ * 2U + 1; } 1003 1004 #if __cplusplus >= 201103L 1005 static constexpr unsigned short 1006 lowest() noexcept { return min(); } 1007 #endif 1008 1009 static _GLIBCXX_USE_CONSTEXPR int digits 1010 = __glibcxx_digits (unsigned short); 1011 static _GLIBCXX_USE_CONSTEXPR int digits10 1012 = __glibcxx_digits10 (unsigned short); 1013 #if __cplusplus >= 201103L 1014 static constexpr int max_digits10 = 0; 1015 #endif 1016 static _GLIBCXX_USE_CONSTEXPR bool is_signed = false; 1017 static _GLIBCXX_USE_CONSTEXPR bool is_integer = true; 1018 static _GLIBCXX_USE_CONSTEXPR bool is_exact = true; 1019 static _GLIBCXX_USE_CONSTEXPR int radix = 2; 1020 1021 static _GLIBCXX_CONSTEXPR unsigned short 1022 epsilon() _GLIBCXX_USE_NOEXCEPT { return 0; } 1023 1024 static _GLIBCXX_CONSTEXPR unsigned short 1025 round_error() _GLIBCXX_USE_NOEXCEPT { return 0; } 1026 1027 static _GLIBCXX_USE_CONSTEXPR int min_exponent = 0; 1028 static _GLIBCXX_USE_CONSTEXPR int min_exponent10 = 0; 1029 static _GLIBCXX_USE_CONSTEXPR int max_exponent = 0; 1030 static _GLIBCXX_USE_CONSTEXPR int max_exponent10 = 0; 1031 1032 static _GLIBCXX_USE_CONSTEXPR bool has_infinity = false; 1033 static _GLIBCXX_USE_CONSTEXPR bool has_quiet_NaN = false; 1034 static _GLIBCXX_USE_CONSTEXPR bool has_signaling_NaN = false; 1035 static _GLIBCXX_USE_CONSTEXPR float_denorm_style has_denorm 1036 = denorm_absent; 1037 static _GLIBCXX_USE_CONSTEXPR bool has_denorm_loss = false; 1038 1039 static _GLIBCXX_CONSTEXPR unsigned short 1040 infinity() _GLIBCXX_USE_NOEXCEPT 1041 { return static_cast<unsigned short>(0); } 1042 1043 static _GLIBCXX_CONSTEXPR unsigned short 1044 quiet_NaN() _GLIBCXX_USE_NOEXCEPT 1045 { return static_cast<unsigned short>(0); } 1046 1047 static _GLIBCXX_CONSTEXPR unsigned short 1048 signaling_NaN() _GLIBCXX_USE_NOEXCEPT 1049 { return static_cast<unsigned short>(0); } 1050 1051 static _GLIBCXX_CONSTEXPR unsigned short 1052 denorm_min() _GLIBCXX_USE_NOEXCEPT 1053 { return static_cast<unsigned short>(0); } 1054 1055 static _GLIBCXX_USE_CONSTEXPR bool is_iec559 = false; 1056 static _GLIBCXX_USE_CONSTEXPR bool is_bounded = true; 1057 static _GLIBCXX_USE_CONSTEXPR bool is_modulo = true; 1058 1059 static _GLIBCXX_USE_CONSTEXPR bool traps = __glibcxx_integral_traps; 1060 static _GLIBCXX_USE_CONSTEXPR bool tinyness_before = false; 1061 static _GLIBCXX_USE_CONSTEXPR float_round_style round_style 1062 = round_toward_zero; 1063 }; 1064 1065 /// numeric_limits<int> specialization. 1066 template<> 1067 struct numeric_limits<int> 1068 { 1069 static _GLIBCXX_USE_CONSTEXPR bool is_specialized = true; 1070 1071 static _GLIBCXX_CONSTEXPR int 1072 min() _GLIBCXX_USE_NOEXCEPT { return -__INT_MAX__ - 1; } 1073 1074 static _GLIBCXX_CONSTEXPR int 1075 max() _GLIBCXX_USE_NOEXCEPT { return __INT_MAX__; } 1076 1077 #if __cplusplus >= 201103L 1078 static constexpr int 1079 lowest() noexcept { return min(); } 1080 #endif 1081 1082 static _GLIBCXX_USE_CONSTEXPR int digits = __glibcxx_digits (int); 1083 static _GLIBCXX_USE_CONSTEXPR int digits10 = __glibcxx_digits10 (int); 1084 #if __cplusplus >= 201103L 1085 static constexpr int max_digits10 = 0; 1086 #endif 1087 static _GLIBCXX_USE_CONSTEXPR bool is_signed = true; 1088 static _GLIBCXX_USE_CONSTEXPR bool is_integer = true; 1089 static _GLIBCXX_USE_CONSTEXPR bool is_exact = true; 1090 static _GLIBCXX_USE_CONSTEXPR int radix = 2; 1091 1092 static _GLIBCXX_CONSTEXPR int 1093 epsilon() _GLIBCXX_USE_NOEXCEPT { return 0; } 1094 1095 static _GLIBCXX_CONSTEXPR int 1096 round_error() _GLIBCXX_USE_NOEXCEPT { return 0; } 1097 1098 static _GLIBCXX_USE_CONSTEXPR int min_exponent = 0; 1099 static _GLIBCXX_USE_CONSTEXPR int min_exponent10 = 0; 1100 static _GLIBCXX_USE_CONSTEXPR int max_exponent = 0; 1101 static _GLIBCXX_USE_CONSTEXPR int max_exponent10 = 0; 1102 1103 static _GLIBCXX_USE_CONSTEXPR bool has_infinity = false; 1104 static _GLIBCXX_USE_CONSTEXPR bool has_quiet_NaN = false; 1105 static _GLIBCXX_USE_CONSTEXPR bool has_signaling_NaN = false; 1106 static _GLIBCXX_USE_CONSTEXPR float_denorm_style has_denorm 1107 = denorm_absent; 1108 static _GLIBCXX_USE_CONSTEXPR bool has_denorm_loss = false; 1109 1110 static _GLIBCXX_CONSTEXPR int 1111 infinity() _GLIBCXX_USE_NOEXCEPT { return static_cast<int>(0); } 1112 1113 static _GLIBCXX_CONSTEXPR int 1114 quiet_NaN() _GLIBCXX_USE_NOEXCEPT { return static_cast<int>(0); } 1115 1116 static _GLIBCXX_CONSTEXPR int 1117 signaling_NaN() _GLIBCXX_USE_NOEXCEPT { return static_cast<int>(0); } 1118 1119 static _GLIBCXX_CONSTEXPR int 1120 denorm_min() _GLIBCXX_USE_NOEXCEPT { return static_cast<int>(0); } 1121 1122 static _GLIBCXX_USE_CONSTEXPR bool is_iec559 = false; 1123 static _GLIBCXX_USE_CONSTEXPR bool is_bounded = true; 1124 static _GLIBCXX_USE_CONSTEXPR bool is_modulo = false; 1125 1126 static _GLIBCXX_USE_CONSTEXPR bool traps = __glibcxx_integral_traps; 1127 static _GLIBCXX_USE_CONSTEXPR bool tinyness_before = false; 1128 static _GLIBCXX_USE_CONSTEXPR float_round_style round_style 1129 = round_toward_zero; 1130 }; 1131 1132 /// numeric_limits<unsigned int> specialization. 1133 template<> 1134 struct numeric_limits<unsigned int> 1135 { 1136 static _GLIBCXX_USE_CONSTEXPR bool is_specialized = true; 1137 1138 static _GLIBCXX_CONSTEXPR unsigned int 1139 min() _GLIBCXX_USE_NOEXCEPT { return 0; } 1140 1141 static _GLIBCXX_CONSTEXPR unsigned int 1142 max() _GLIBCXX_USE_NOEXCEPT { return __INT_MAX__ * 2U + 1; } 1143 1144 #if __cplusplus >= 201103L 1145 static constexpr unsigned int 1146 lowest() noexcept { return min(); } 1147 #endif 1148 1149 static _GLIBCXX_USE_CONSTEXPR int digits 1150 = __glibcxx_digits (unsigned int); 1151 static _GLIBCXX_USE_CONSTEXPR int digits10 1152 = __glibcxx_digits10 (unsigned int); 1153 #if __cplusplus >= 201103L 1154 static constexpr int max_digits10 = 0; 1155 #endif 1156 static _GLIBCXX_USE_CONSTEXPR bool is_signed = false; 1157 static _GLIBCXX_USE_CONSTEXPR bool is_integer = true; 1158 static _GLIBCXX_USE_CONSTEXPR bool is_exact = true; 1159 static _GLIBCXX_USE_CONSTEXPR int radix = 2; 1160 1161 static _GLIBCXX_CONSTEXPR unsigned int 1162 epsilon() _GLIBCXX_USE_NOEXCEPT { return 0; } 1163 1164 static _GLIBCXX_CONSTEXPR unsigned int 1165 round_error() _GLIBCXX_USE_NOEXCEPT { return 0; } 1166 1167 static _GLIBCXX_USE_CONSTEXPR int min_exponent = 0; 1168 static _GLIBCXX_USE_CONSTEXPR int min_exponent10 = 0; 1169 static _GLIBCXX_USE_CONSTEXPR int max_exponent = 0; 1170 static _GLIBCXX_USE_CONSTEXPR int max_exponent10 = 0; 1171 1172 static _GLIBCXX_USE_CONSTEXPR bool has_infinity = false; 1173 static _GLIBCXX_USE_CONSTEXPR bool has_quiet_NaN = false; 1174 static _GLIBCXX_USE_CONSTEXPR bool has_signaling_NaN = false; 1175 static _GLIBCXX_USE_CONSTEXPR float_denorm_style has_denorm 1176 = denorm_absent; 1177 static _GLIBCXX_USE_CONSTEXPR bool has_denorm_loss = false; 1178 1179 static _GLIBCXX_CONSTEXPR unsigned int 1180 infinity() _GLIBCXX_USE_NOEXCEPT { return static_cast<unsigned int>(0); } 1181 1182 static _GLIBCXX_CONSTEXPR unsigned int 1183 quiet_NaN() _GLIBCXX_USE_NOEXCEPT 1184 { return static_cast<unsigned int>(0); } 1185 1186 static _GLIBCXX_CONSTEXPR unsigned int 1187 signaling_NaN() _GLIBCXX_USE_NOEXCEPT 1188 { return static_cast<unsigned int>(0); } 1189 1190 static _GLIBCXX_CONSTEXPR unsigned int 1191 denorm_min() _GLIBCXX_USE_NOEXCEPT 1192 { return static_cast<unsigned int>(0); } 1193 1194 static _GLIBCXX_USE_CONSTEXPR bool is_iec559 = false; 1195 static _GLIBCXX_USE_CONSTEXPR bool is_bounded = true; 1196 static _GLIBCXX_USE_CONSTEXPR bool is_modulo = true; 1197 1198 static _GLIBCXX_USE_CONSTEXPR bool traps = __glibcxx_integral_traps; 1199 static _GLIBCXX_USE_CONSTEXPR bool tinyness_before = false; 1200 static _GLIBCXX_USE_CONSTEXPR float_round_style round_style 1201 = round_toward_zero; 1202 }; 1203 1204 /// numeric_limits<long> specialization. 1205 template<> 1206 struct numeric_limits<long> 1207 { 1208 static _GLIBCXX_USE_CONSTEXPR bool is_specialized = true; 1209 1210 static _GLIBCXX_CONSTEXPR long 1211 min() _GLIBCXX_USE_NOEXCEPT { return -__LONG_MAX__ - 1; } 1212 1213 static _GLIBCXX_CONSTEXPR long 1214 max() _GLIBCXX_USE_NOEXCEPT { return __LONG_MAX__; } 1215 1216 #if __cplusplus >= 201103L 1217 static constexpr long 1218 lowest() noexcept { return min(); } 1219 #endif 1220 1221 static _GLIBCXX_USE_CONSTEXPR int digits = __glibcxx_digits (long); 1222 static _GLIBCXX_USE_CONSTEXPR int digits10 = __glibcxx_digits10 (long); 1223 #if __cplusplus >= 201103L 1224 static constexpr int max_digits10 = 0; 1225 #endif 1226 static _GLIBCXX_USE_CONSTEXPR bool is_signed = true; 1227 static _GLIBCXX_USE_CONSTEXPR bool is_integer = true; 1228 static _GLIBCXX_USE_CONSTEXPR bool is_exact = true; 1229 static _GLIBCXX_USE_CONSTEXPR int radix = 2; 1230 1231 static _GLIBCXX_CONSTEXPR long 1232 epsilon() _GLIBCXX_USE_NOEXCEPT { return 0; } 1233 1234 static _GLIBCXX_CONSTEXPR long 1235 round_error() _GLIBCXX_USE_NOEXCEPT { return 0; } 1236 1237 static _GLIBCXX_USE_CONSTEXPR int min_exponent = 0; 1238 static _GLIBCXX_USE_CONSTEXPR int min_exponent10 = 0; 1239 static _GLIBCXX_USE_CONSTEXPR int max_exponent = 0; 1240 static _GLIBCXX_USE_CONSTEXPR int max_exponent10 = 0; 1241 1242 static _GLIBCXX_USE_CONSTEXPR bool has_infinity = false; 1243 static _GLIBCXX_USE_CONSTEXPR bool has_quiet_NaN = false; 1244 static _GLIBCXX_USE_CONSTEXPR bool has_signaling_NaN = false; 1245 static _GLIBCXX_USE_CONSTEXPR float_denorm_style has_denorm 1246 = denorm_absent; 1247 static _GLIBCXX_USE_CONSTEXPR bool has_denorm_loss = false; 1248 1249 static _GLIBCXX_CONSTEXPR long 1250 infinity() _GLIBCXX_USE_NOEXCEPT { return static_cast<long>(0); } 1251 1252 static _GLIBCXX_CONSTEXPR long 1253 quiet_NaN() _GLIBCXX_USE_NOEXCEPT { return static_cast<long>(0); } 1254 1255 static _GLIBCXX_CONSTEXPR long 1256 signaling_NaN() _GLIBCXX_USE_NOEXCEPT { return static_cast<long>(0); } 1257 1258 static _GLIBCXX_CONSTEXPR long 1259 denorm_min() _GLIBCXX_USE_NOEXCEPT { return static_cast<long>(0); } 1260 1261 static _GLIBCXX_USE_CONSTEXPR bool is_iec559 = false; 1262 static _GLIBCXX_USE_CONSTEXPR bool is_bounded = true; 1263 static _GLIBCXX_USE_CONSTEXPR bool is_modulo = false; 1264 1265 static _GLIBCXX_USE_CONSTEXPR bool traps = __glibcxx_integral_traps; 1266 static _GLIBCXX_USE_CONSTEXPR bool tinyness_before = false; 1267 static _GLIBCXX_USE_CONSTEXPR float_round_style round_style 1268 = round_toward_zero; 1269 }; 1270 1271 /// numeric_limits<unsigned long> specialization. 1272 template<> 1273 struct numeric_limits<unsigned long> 1274 { 1275 static _GLIBCXX_USE_CONSTEXPR bool is_specialized = true; 1276 1277 static _GLIBCXX_CONSTEXPR unsigned long 1278 min() _GLIBCXX_USE_NOEXCEPT { return 0; } 1279 1280 static _GLIBCXX_CONSTEXPR unsigned long 1281 max() _GLIBCXX_USE_NOEXCEPT { return __LONG_MAX__ * 2UL + 1; } 1282 1283 #if __cplusplus >= 201103L 1284 static constexpr unsigned long 1285 lowest() noexcept { return min(); } 1286 #endif 1287 1288 static _GLIBCXX_USE_CONSTEXPR int digits 1289 = __glibcxx_digits (unsigned long); 1290 static _GLIBCXX_USE_CONSTEXPR int digits10 1291 = __glibcxx_digits10 (unsigned long); 1292 #if __cplusplus >= 201103L 1293 static constexpr int max_digits10 = 0; 1294 #endif 1295 static _GLIBCXX_USE_CONSTEXPR bool is_signed = false; 1296 static _GLIBCXX_USE_CONSTEXPR bool is_integer = true; 1297 static _GLIBCXX_USE_CONSTEXPR bool is_exact = true; 1298 static _GLIBCXX_USE_CONSTEXPR int radix = 2; 1299 1300 static _GLIBCXX_CONSTEXPR unsigned long 1301 epsilon() _GLIBCXX_USE_NOEXCEPT { return 0; } 1302 1303 static _GLIBCXX_CONSTEXPR unsigned long 1304 round_error() _GLIBCXX_USE_NOEXCEPT { return 0; } 1305 1306 static _GLIBCXX_USE_CONSTEXPR int min_exponent = 0; 1307 static _GLIBCXX_USE_CONSTEXPR int min_exponent10 = 0; 1308 static _GLIBCXX_USE_CONSTEXPR int max_exponent = 0; 1309 static _GLIBCXX_USE_CONSTEXPR int max_exponent10 = 0; 1310 1311 static _GLIBCXX_USE_CONSTEXPR bool has_infinity = false; 1312 static _GLIBCXX_USE_CONSTEXPR bool has_quiet_NaN = false; 1313 static _GLIBCXX_USE_CONSTEXPR bool has_signaling_NaN = false; 1314 static _GLIBCXX_USE_CONSTEXPR float_denorm_style has_denorm 1315 = denorm_absent; 1316 static _GLIBCXX_USE_CONSTEXPR bool has_denorm_loss = false; 1317 1318 static _GLIBCXX_CONSTEXPR unsigned long 1319 infinity() _GLIBCXX_USE_NOEXCEPT 1320 { return static_cast<unsigned long>(0); } 1321 1322 static _GLIBCXX_CONSTEXPR unsigned long 1323 quiet_NaN() _GLIBCXX_USE_NOEXCEPT 1324 { return static_cast<unsigned long>(0); } 1325 1326 static _GLIBCXX_CONSTEXPR unsigned long 1327 signaling_NaN() _GLIBCXX_USE_NOEXCEPT 1328 { return static_cast<unsigned long>(0); } 1329 1330 static _GLIBCXX_CONSTEXPR unsigned long 1331 denorm_min() _GLIBCXX_USE_NOEXCEPT 1332 { return static_cast<unsigned long>(0); } 1333 1334 static _GLIBCXX_USE_CONSTEXPR bool is_iec559 = false; 1335 static _GLIBCXX_USE_CONSTEXPR bool is_bounded = true; 1336 static _GLIBCXX_USE_CONSTEXPR bool is_modulo = true; 1337 1338 static _GLIBCXX_USE_CONSTEXPR bool traps = __glibcxx_integral_traps; 1339 static _GLIBCXX_USE_CONSTEXPR bool tinyness_before = false; 1340 static _GLIBCXX_USE_CONSTEXPR float_round_style round_style 1341 = round_toward_zero; 1342 }; 1343 1344 /// numeric_limits<long long> specialization. 1345 template<> 1346 struct numeric_limits<long long> 1347 { 1348 static _GLIBCXX_USE_CONSTEXPR bool is_specialized = true; 1349 1350 static _GLIBCXX_CONSTEXPR long long 1351 min() _GLIBCXX_USE_NOEXCEPT { return -__LONG_LONG_MAX__ - 1; } 1352 1353 static _GLIBCXX_CONSTEXPR long long 1354 max() _GLIBCXX_USE_NOEXCEPT { return __LONG_LONG_MAX__; } 1355 1356 #if __cplusplus >= 201103L 1357 static constexpr long long 1358 lowest() noexcept { return min(); } 1359 #endif 1360 1361 static _GLIBCXX_USE_CONSTEXPR int digits 1362 = __glibcxx_digits (long long); 1363 static _GLIBCXX_USE_CONSTEXPR int digits10 1364 = __glibcxx_digits10 (long long); 1365 #if __cplusplus >= 201103L 1366 static constexpr int max_digits10 = 0; 1367 #endif 1368 static _GLIBCXX_USE_CONSTEXPR bool is_signed = true; 1369 static _GLIBCXX_USE_CONSTEXPR bool is_integer = true; 1370 static _GLIBCXX_USE_CONSTEXPR bool is_exact = true; 1371 static _GLIBCXX_USE_CONSTEXPR int radix = 2; 1372 1373 static _GLIBCXX_CONSTEXPR long long 1374 epsilon() _GLIBCXX_USE_NOEXCEPT { return 0; } 1375 1376 static _GLIBCXX_CONSTEXPR long long 1377 round_error() _GLIBCXX_USE_NOEXCEPT { return 0; } 1378 1379 static _GLIBCXX_USE_CONSTEXPR int min_exponent = 0; 1380 static _GLIBCXX_USE_CONSTEXPR int min_exponent10 = 0; 1381 static _GLIBCXX_USE_CONSTEXPR int max_exponent = 0; 1382 static _GLIBCXX_USE_CONSTEXPR int max_exponent10 = 0; 1383 1384 static _GLIBCXX_USE_CONSTEXPR bool has_infinity = false; 1385 static _GLIBCXX_USE_CONSTEXPR bool has_quiet_NaN = false; 1386 static _GLIBCXX_USE_CONSTEXPR bool has_signaling_NaN = false; 1387 static _GLIBCXX_USE_CONSTEXPR float_denorm_style has_denorm 1388 = denorm_absent; 1389 static _GLIBCXX_USE_CONSTEXPR bool has_denorm_loss = false; 1390 1391 static _GLIBCXX_CONSTEXPR long long 1392 infinity() _GLIBCXX_USE_NOEXCEPT { return static_cast<long long>(0); } 1393 1394 static _GLIBCXX_CONSTEXPR long long 1395 quiet_NaN() _GLIBCXX_USE_NOEXCEPT { return static_cast<long long>(0); } 1396 1397 static _GLIBCXX_CONSTEXPR long long 1398 signaling_NaN() _GLIBCXX_USE_NOEXCEPT 1399 { return static_cast<long long>(0); } 1400 1401 static _GLIBCXX_CONSTEXPR long long 1402 denorm_min() _GLIBCXX_USE_NOEXCEPT { return static_cast<long long>(0); } 1403 1404 static _GLIBCXX_USE_CONSTEXPR bool is_iec559 = false; 1405 static _GLIBCXX_USE_CONSTEXPR bool is_bounded = true; 1406 static _GLIBCXX_USE_CONSTEXPR bool is_modulo = false; 1407 1408 static _GLIBCXX_USE_CONSTEXPR bool traps = __glibcxx_integral_traps; 1409 static _GLIBCXX_USE_CONSTEXPR bool tinyness_before = false; 1410 static _GLIBCXX_USE_CONSTEXPR float_round_style round_style 1411 = round_toward_zero; 1412 }; 1413 1414 /// numeric_limits<unsigned long long> specialization. 1415 template<> 1416 struct numeric_limits<unsigned long long> 1417 { 1418 static _GLIBCXX_USE_CONSTEXPR bool is_specialized = true; 1419 1420 static _GLIBCXX_CONSTEXPR unsigned long long 1421 min() _GLIBCXX_USE_NOEXCEPT { return 0; } 1422 1423 static _GLIBCXX_CONSTEXPR unsigned long long 1424 max() _GLIBCXX_USE_NOEXCEPT { return __LONG_LONG_MAX__ * 2ULL + 1; } 1425 1426 #if __cplusplus >= 201103L 1427 static constexpr unsigned long long 1428 lowest() noexcept { return min(); } 1429 #endif 1430 1431 static _GLIBCXX_USE_CONSTEXPR int digits 1432 = __glibcxx_digits (unsigned long long); 1433 static _GLIBCXX_USE_CONSTEXPR int digits10 1434 = __glibcxx_digits10 (unsigned long long); 1435 #if __cplusplus >= 201103L 1436 static constexpr int max_digits10 = 0; 1437 #endif 1438 static _GLIBCXX_USE_CONSTEXPR bool is_signed = false; 1439 static _GLIBCXX_USE_CONSTEXPR bool is_integer = true; 1440 static _GLIBCXX_USE_CONSTEXPR bool is_exact = true; 1441 static _GLIBCXX_USE_CONSTEXPR int radix = 2; 1442 1443 static _GLIBCXX_CONSTEXPR unsigned long long 1444 epsilon() _GLIBCXX_USE_NOEXCEPT { return 0; } 1445 1446 static _GLIBCXX_CONSTEXPR unsigned long long 1447 round_error() _GLIBCXX_USE_NOEXCEPT { return 0; } 1448 1449 static _GLIBCXX_USE_CONSTEXPR int min_exponent = 0; 1450 static _GLIBCXX_USE_CONSTEXPR int min_exponent10 = 0; 1451 static _GLIBCXX_USE_CONSTEXPR int max_exponent = 0; 1452 static _GLIBCXX_USE_CONSTEXPR int max_exponent10 = 0; 1453 1454 static _GLIBCXX_USE_CONSTEXPR bool has_infinity = false; 1455 static _GLIBCXX_USE_CONSTEXPR bool has_quiet_NaN = false; 1456 static _GLIBCXX_USE_CONSTEXPR bool has_signaling_NaN = false; 1457 static _GLIBCXX_USE_CONSTEXPR float_denorm_style has_denorm 1458 = denorm_absent; 1459 static _GLIBCXX_USE_CONSTEXPR bool has_denorm_loss = false; 1460 1461 static _GLIBCXX_CONSTEXPR unsigned long long 1462 infinity() _GLIBCXX_USE_NOEXCEPT 1463 { return static_cast<unsigned long long>(0); } 1464 1465 static _GLIBCXX_CONSTEXPR unsigned long long 1466 quiet_NaN() _GLIBCXX_USE_NOEXCEPT 1467 { return static_cast<unsigned long long>(0); } 1468 1469 static _GLIBCXX_CONSTEXPR unsigned long long 1470 signaling_NaN() _GLIBCXX_USE_NOEXCEPT 1471 { return static_cast<unsigned long long>(0); } 1472 1473 static _GLIBCXX_CONSTEXPR unsigned long long 1474 denorm_min() _GLIBCXX_USE_NOEXCEPT 1475 { return static_cast<unsigned long long>(0); } 1476 1477 static _GLIBCXX_USE_CONSTEXPR bool is_iec559 = false; 1478 static _GLIBCXX_USE_CONSTEXPR bool is_bounded = true; 1479 static _GLIBCXX_USE_CONSTEXPR bool is_modulo = true; 1480 1481 static _GLIBCXX_USE_CONSTEXPR bool traps = __glibcxx_integral_traps; 1482 static _GLIBCXX_USE_CONSTEXPR bool tinyness_before = false; 1483 static _GLIBCXX_USE_CONSTEXPR float_round_style round_style 1484 = round_toward_zero; 1485 }; 1486 1487 #define __INT_N(TYPE, BITSIZE, EXT, UEXT) \ 1488 __extension__ \ 1489 template<> \ 1490 struct numeric_limits<TYPE> \ 1491 { \ 1492 static _GLIBCXX_USE_CONSTEXPR bool is_specialized = true; \ 1493 \ 1494 static _GLIBCXX_CONSTEXPR TYPE \ 1495 min() _GLIBCXX_USE_NOEXCEPT { return __glibcxx_min_b (TYPE, BITSIZE); } \ 1496 \ 1497 static _GLIBCXX_CONSTEXPR TYPE \ 1498 max() _GLIBCXX_USE_NOEXCEPT { return __glibcxx_max_b (TYPE, BITSIZE); } \ 1499 \ 1500 static _GLIBCXX_USE_CONSTEXPR int digits \ 1501 = BITSIZE - 1; \ 1502 static _GLIBCXX_USE_CONSTEXPR int digits10 \ 1503 = (BITSIZE - 1) * 643L / 2136; \ 1504 \ 1505 static _GLIBCXX_USE_CONSTEXPR bool is_signed = true; \ 1506 static _GLIBCXX_USE_CONSTEXPR bool is_integer = true; \ 1507 static _GLIBCXX_USE_CONSTEXPR bool is_exact = true; \ 1508 static _GLIBCXX_USE_CONSTEXPR int radix = 2; \ 1509 \ 1510 static _GLIBCXX_CONSTEXPR TYPE \ 1511 epsilon() _GLIBCXX_USE_NOEXCEPT { return 0; } \ 1512 \ 1513 static _GLIBCXX_CONSTEXPR TYPE \ 1514 round_error() _GLIBCXX_USE_NOEXCEPT { return 0; } \ 1515 \ 1516 EXT \ 1517 \ 1518 static _GLIBCXX_USE_CONSTEXPR int min_exponent = 0; \ 1519 static _GLIBCXX_USE_CONSTEXPR int min_exponent10 = 0; \ 1520 static _GLIBCXX_USE_CONSTEXPR int max_exponent = 0; \ 1521 static _GLIBCXX_USE_CONSTEXPR int max_exponent10 = 0; \ 1522 \ 1523 static _GLIBCXX_USE_CONSTEXPR bool has_infinity = false; \ 1524 static _GLIBCXX_USE_CONSTEXPR bool has_quiet_NaN = false; \ 1525 static _GLIBCXX_USE_CONSTEXPR bool has_signaling_NaN = false; \ 1526 static _GLIBCXX_USE_CONSTEXPR float_denorm_style has_denorm \ 1527 = denorm_absent; \ 1528 static _GLIBCXX_USE_CONSTEXPR bool has_denorm_loss = false; \ 1529 \ 1530 static _GLIBCXX_CONSTEXPR TYPE \ 1531 infinity() _GLIBCXX_USE_NOEXCEPT \ 1532 { return static_cast<TYPE>(0); } \ 1533 \ 1534 static _GLIBCXX_CONSTEXPR TYPE \ 1535 quiet_NaN() _GLIBCXX_USE_NOEXCEPT \ 1536 { return static_cast<TYPE>(0); } \ 1537 \ 1538 static _GLIBCXX_CONSTEXPR TYPE \ 1539 signaling_NaN() _GLIBCXX_USE_NOEXCEPT \ 1540 { return static_cast<TYPE>(0); } \ 1541 \ 1542 static _GLIBCXX_CONSTEXPR TYPE \ 1543 denorm_min() _GLIBCXX_USE_NOEXCEPT \ 1544 { return static_cast<TYPE>(0); } \ 1545 \ 1546 static _GLIBCXX_USE_CONSTEXPR bool is_iec559 = false; \ 1547 static _GLIBCXX_USE_CONSTEXPR bool is_bounded = true; \ 1548 static _GLIBCXX_USE_CONSTEXPR bool is_modulo = false; \ 1549 \ 1550 static _GLIBCXX_USE_CONSTEXPR bool traps \ 1551 = __glibcxx_integral_traps; \ 1552 static _GLIBCXX_USE_CONSTEXPR bool tinyness_before = false; \ 1553 static _GLIBCXX_USE_CONSTEXPR float_round_style round_style \ 1554 = round_toward_zero; \ 1555 }; \ 1556 \ 1557 __extension__ \ 1558 template<> \ 1559 struct numeric_limits<unsigned TYPE> \ 1560 { \ 1561 static _GLIBCXX_USE_CONSTEXPR bool is_specialized = true; \ 1562 \ 1563 static _GLIBCXX_CONSTEXPR unsigned TYPE \ 1564 min() _GLIBCXX_USE_NOEXCEPT { return 0; } \ 1565 \ 1566 static _GLIBCXX_CONSTEXPR unsigned TYPE \ 1567 max() _GLIBCXX_USE_NOEXCEPT \ 1568 { return __glibcxx_max_b (unsigned TYPE, BITSIZE); } \ 1569 \ 1570 UEXT \ 1571 \ 1572 static _GLIBCXX_USE_CONSTEXPR int digits \ 1573 = BITSIZE; \ 1574 static _GLIBCXX_USE_CONSTEXPR int digits10 \ 1575 = BITSIZE * 643L / 2136; \ 1576 static _GLIBCXX_USE_CONSTEXPR bool is_signed = false; \ 1577 static _GLIBCXX_USE_CONSTEXPR bool is_integer = true; \ 1578 static _GLIBCXX_USE_CONSTEXPR bool is_exact = true; \ 1579 static _GLIBCXX_USE_CONSTEXPR int radix = 2; \ 1580 \ 1581 static _GLIBCXX_CONSTEXPR unsigned TYPE \ 1582 epsilon() _GLIBCXX_USE_NOEXCEPT { return 0; } \ 1583 \ 1584 static _GLIBCXX_CONSTEXPR unsigned TYPE \ 1585 round_error() _GLIBCXX_USE_NOEXCEPT { return 0; } \ 1586 \ 1587 static _GLIBCXX_USE_CONSTEXPR int min_exponent = 0; \ 1588 static _GLIBCXX_USE_CONSTEXPR int min_exponent10 = 0; \ 1589 static _GLIBCXX_USE_CONSTEXPR int max_exponent = 0; \ 1590 static _GLIBCXX_USE_CONSTEXPR int max_exponent10 = 0; \ 1591 \ 1592 static _GLIBCXX_USE_CONSTEXPR bool has_infinity = false; \ 1593 static _GLIBCXX_USE_CONSTEXPR bool has_quiet_NaN = false; \ 1594 static _GLIBCXX_USE_CONSTEXPR bool has_signaling_NaN = false; \ 1595 static _GLIBCXX_USE_CONSTEXPR float_denorm_style has_denorm \ 1596 = denorm_absent; \ 1597 static _GLIBCXX_USE_CONSTEXPR bool has_denorm_loss = false; \ 1598 \ 1599 static _GLIBCXX_CONSTEXPR unsigned TYPE \ 1600 infinity() _GLIBCXX_USE_NOEXCEPT \ 1601 { return static_cast<unsigned TYPE>(0); } \ 1602 \ 1603 static _GLIBCXX_CONSTEXPR unsigned TYPE \ 1604 quiet_NaN() _GLIBCXX_USE_NOEXCEPT \ 1605 { return static_cast<unsigned TYPE>(0); } \ 1606 \ 1607 static _GLIBCXX_CONSTEXPR unsigned TYPE \ 1608 signaling_NaN() _GLIBCXX_USE_NOEXCEPT \ 1609 { return static_cast<unsigned TYPE>(0); } \ 1610 \ 1611 static _GLIBCXX_CONSTEXPR unsigned TYPE \ 1612 denorm_min() _GLIBCXX_USE_NOEXCEPT \ 1613 { return static_cast<unsigned TYPE>(0); } \ 1614 \ 1615 static _GLIBCXX_USE_CONSTEXPR bool is_iec559 = false; \ 1616 static _GLIBCXX_USE_CONSTEXPR bool is_bounded = true; \ 1617 static _GLIBCXX_USE_CONSTEXPR bool is_modulo = true; \ 1618 \ 1619 static _GLIBCXX_USE_CONSTEXPR bool traps = __glibcxx_integral_traps; \ 1620 static _GLIBCXX_USE_CONSTEXPR bool tinyness_before = false; \ 1621 static _GLIBCXX_USE_CONSTEXPR float_round_style round_style \ 1622 = round_toward_zero; \ 1623 }; 1624 1625 #if __cplusplus >= 201103L 1626 1627 #define __INT_N_201103(TYPE) \ 1628 static constexpr TYPE \ 1629 lowest() noexcept { return min(); } \ 1630 static constexpr int max_digits10 = 0; 1631 1632 #define __INT_N_U201103(TYPE) \ 1633 static constexpr unsigned TYPE \ 1634 lowest() noexcept { return min(); } \ 1635 static constexpr int max_digits10 = 0; 1636 1637 #else 1638 #define __INT_N_201103(TYPE) 1639 #define __INT_N_U201103(TYPE) 1640 #endif 1641 1642 #if !defined(__STRICT_ANSI__) 1643 #ifdef __GLIBCXX_TYPE_INT_N_0 1644 __INT_N(__GLIBCXX_TYPE_INT_N_0, __GLIBCXX_BITSIZE_INT_N_0, 1645 __INT_N_201103 (__GLIBCXX_TYPE_INT_N_0), 1646 __INT_N_U201103 (__GLIBCXX_TYPE_INT_N_0)) 1647 #endif 1648 #ifdef __GLIBCXX_TYPE_INT_N_1 1649 __INT_N (__GLIBCXX_TYPE_INT_N_1, __GLIBCXX_BITSIZE_INT_N_1, 1650 __INT_N_201103 (__GLIBCXX_TYPE_INT_N_1), 1651 __INT_N_U201103 (__GLIBCXX_TYPE_INT_N_1)) 1652 #endif 1653 #ifdef __GLIBCXX_TYPE_INT_N_2 1654 __INT_N (__GLIBCXX_TYPE_INT_N_2, __GLIBCXX_BITSIZE_INT_N_2, 1655 __INT_N_201103 (__GLIBCXX_TYPE_INT_N_2), 1656 __INT_N_U201103 (__GLIBCXX_TYPE_INT_N_2)) 1657 #endif 1658 #ifdef __GLIBCXX_TYPE_INT_N_3 1659 __INT_N (__GLIBCXX_TYPE_INT_N_3, __GLIBCXX_BITSIZE_INT_N_3, 1660 __INT_N_201103 (__GLIBCXX_TYPE_INT_N_3), 1661 __INT_N_U201103 (__GLIBCXX_TYPE_INT_N_3)) 1662 #endif 1663 1664 #elif defined __STRICT_ANSI__ && defined __SIZEOF_INT128__ 1665 __INT_N(__int128, 128, 1666 __INT_N_201103 (__int128), 1667 __INT_N_U201103 (__int128)) 1668 #endif 1669 1670 #undef __INT_N 1671 #undef __INT_N_201103 1672 #undef __INT_N_U201103 1673 1674 1675 /// numeric_limits<float> specialization. 1676 template<> 1677 struct numeric_limits<float> 1678 { 1679 static _GLIBCXX_USE_CONSTEXPR bool is_specialized = true; 1680 1681 static _GLIBCXX_CONSTEXPR float 1682 min() _GLIBCXX_USE_NOEXCEPT { return __FLT_MIN__; } 1683 1684 static _GLIBCXX_CONSTEXPR float 1685 max() _GLIBCXX_USE_NOEXCEPT { return __FLT_MAX__; } 1686 1687 #if __cplusplus >= 201103L 1688 static constexpr float 1689 lowest() noexcept { return -__FLT_MAX__; } 1690 #endif 1691 1692 static _GLIBCXX_USE_CONSTEXPR int digits = __FLT_MANT_DIG__; 1693 static _GLIBCXX_USE_CONSTEXPR int digits10 = __FLT_DIG__; 1694 #if __cplusplus >= 201103L 1695 static constexpr int max_digits10 1696 = __glibcxx_max_digits10 (__FLT_MANT_DIG__); 1697 #endif 1698 static _GLIBCXX_USE_CONSTEXPR bool is_signed = true; 1699 static _GLIBCXX_USE_CONSTEXPR bool is_integer = false; 1700 static _GLIBCXX_USE_CONSTEXPR bool is_exact = false; 1701 static _GLIBCXX_USE_CONSTEXPR int radix = __FLT_RADIX__; 1702 1703 static _GLIBCXX_CONSTEXPR float 1704 epsilon() _GLIBCXX_USE_NOEXCEPT { return __FLT_EPSILON__; } 1705 1706 static _GLIBCXX_CONSTEXPR float 1707 round_error() _GLIBCXX_USE_NOEXCEPT { return 0.5F; } 1708 1709 static _GLIBCXX_USE_CONSTEXPR int min_exponent = __FLT_MIN_EXP__; 1710 static _GLIBCXX_USE_CONSTEXPR int min_exponent10 = __FLT_MIN_10_EXP__; 1711 static _GLIBCXX_USE_CONSTEXPR int max_exponent = __FLT_MAX_EXP__; 1712 static _GLIBCXX_USE_CONSTEXPR int max_exponent10 = __FLT_MAX_10_EXP__; 1713 1714 static _GLIBCXX_USE_CONSTEXPR bool has_infinity = __FLT_HAS_INFINITY__; 1715 static _GLIBCXX_USE_CONSTEXPR bool has_quiet_NaN = __FLT_HAS_QUIET_NAN__; 1716 static _GLIBCXX_USE_CONSTEXPR bool has_signaling_NaN = has_quiet_NaN; 1717 static _GLIBCXX_USE_CONSTEXPR float_denorm_style has_denorm 1718 = bool(__FLT_HAS_DENORM__) ? denorm_present : denorm_absent; 1719 static _GLIBCXX_USE_CONSTEXPR bool has_denorm_loss 1720 = __glibcxx_float_has_denorm_loss; 1721 1722 static _GLIBCXX_CONSTEXPR float 1723 infinity() _GLIBCXX_USE_NOEXCEPT { return __builtin_huge_valf(); } 1724 1725 static _GLIBCXX_CONSTEXPR float 1726 quiet_NaN() _GLIBCXX_USE_NOEXCEPT { return __builtin_nanf(""); } 1727 1728 static _GLIBCXX_CONSTEXPR float 1729 signaling_NaN() _GLIBCXX_USE_NOEXCEPT { return __builtin_nansf(""); } 1730 1731 static _GLIBCXX_CONSTEXPR float 1732 denorm_min() _GLIBCXX_USE_NOEXCEPT { return __FLT_DENORM_MIN__; } 1733 1734 static _GLIBCXX_USE_CONSTEXPR bool is_iec559 1735 = has_infinity && has_quiet_NaN && has_denorm == denorm_present; 1736 static _GLIBCXX_USE_CONSTEXPR bool is_bounded = true; 1737 static _GLIBCXX_USE_CONSTEXPR bool is_modulo = false; 1738 1739 static _GLIBCXX_USE_CONSTEXPR bool traps = __glibcxx_float_traps; 1740 static _GLIBCXX_USE_CONSTEXPR bool tinyness_before 1741 = __glibcxx_float_tinyness_before; 1742 static _GLIBCXX_USE_CONSTEXPR float_round_style round_style 1743 = round_to_nearest; 1744 }; 1745 1746 #undef __glibcxx_float_has_denorm_loss 1747 #undef __glibcxx_float_traps 1748 #undef __glibcxx_float_tinyness_before 1749 1750 /// numeric_limits<double> specialization. 1751 template<> 1752 struct numeric_limits<double> 1753 { 1754 static _GLIBCXX_USE_CONSTEXPR bool is_specialized = true; 1755 1756 static _GLIBCXX_CONSTEXPR double 1757 min() _GLIBCXX_USE_NOEXCEPT { return __DBL_MIN__; } 1758 1759 static _GLIBCXX_CONSTEXPR double 1760 max() _GLIBCXX_USE_NOEXCEPT { return __DBL_MAX__; } 1761 1762 #if __cplusplus >= 201103L 1763 static constexpr double 1764 lowest() noexcept { return -__DBL_MAX__; } 1765 #endif 1766 1767 static _GLIBCXX_USE_CONSTEXPR int digits = __DBL_MANT_DIG__; 1768 static _GLIBCXX_USE_CONSTEXPR int digits10 = __DBL_DIG__; 1769 #if __cplusplus >= 201103L 1770 static constexpr int max_digits10 1771 = __glibcxx_max_digits10 (__DBL_MANT_DIG__); 1772 #endif 1773 static _GLIBCXX_USE_CONSTEXPR bool is_signed = true; 1774 static _GLIBCXX_USE_CONSTEXPR bool is_integer = false; 1775 static _GLIBCXX_USE_CONSTEXPR bool is_exact = false; 1776 static _GLIBCXX_USE_CONSTEXPR int radix = __FLT_RADIX__; 1777 1778 static _GLIBCXX_CONSTEXPR double 1779 epsilon() _GLIBCXX_USE_NOEXCEPT { return __DBL_EPSILON__; } 1780 1781 static _GLIBCXX_CONSTEXPR double 1782 round_error() _GLIBCXX_USE_NOEXCEPT { return 0.5; } 1783 1784 static _GLIBCXX_USE_CONSTEXPR int min_exponent = __DBL_MIN_EXP__; 1785 static _GLIBCXX_USE_CONSTEXPR int min_exponent10 = __DBL_MIN_10_EXP__; 1786 static _GLIBCXX_USE_CONSTEXPR int max_exponent = __DBL_MAX_EXP__; 1787 static _GLIBCXX_USE_CONSTEXPR int max_exponent10 = __DBL_MAX_10_EXP__; 1788 1789 static _GLIBCXX_USE_CONSTEXPR bool has_infinity = __DBL_HAS_INFINITY__; 1790 static _GLIBCXX_USE_CONSTEXPR bool has_quiet_NaN = __DBL_HAS_QUIET_NAN__; 1791 static _GLIBCXX_USE_CONSTEXPR bool has_signaling_NaN = has_quiet_NaN; 1792 static _GLIBCXX_USE_CONSTEXPR float_denorm_style has_denorm 1793 = bool(__DBL_HAS_DENORM__) ? denorm_present : denorm_absent; 1794 static _GLIBCXX_USE_CONSTEXPR bool has_denorm_loss 1795 = __glibcxx_double_has_denorm_loss; 1796 1797 static _GLIBCXX_CONSTEXPR double 1798 infinity() _GLIBCXX_USE_NOEXCEPT { return __builtin_huge_val(); } 1799 1800 static _GLIBCXX_CONSTEXPR double 1801 quiet_NaN() _GLIBCXX_USE_NOEXCEPT { return __builtin_nan(""); } 1802 1803 static _GLIBCXX_CONSTEXPR double 1804 signaling_NaN() _GLIBCXX_USE_NOEXCEPT { return __builtin_nans(""); } 1805 1806 static _GLIBCXX_CONSTEXPR double 1807 denorm_min() _GLIBCXX_USE_NOEXCEPT { return __DBL_DENORM_MIN__; } 1808 1809 static _GLIBCXX_USE_CONSTEXPR bool is_iec559 1810 = has_infinity && has_quiet_NaN && has_denorm == denorm_present; 1811 static _GLIBCXX_USE_CONSTEXPR bool is_bounded = true; 1812 static _GLIBCXX_USE_CONSTEXPR bool is_modulo = false; 1813 1814 static _GLIBCXX_USE_CONSTEXPR bool traps = __glibcxx_double_traps; 1815 static _GLIBCXX_USE_CONSTEXPR bool tinyness_before 1816 = __glibcxx_double_tinyness_before; 1817 static _GLIBCXX_USE_CONSTEXPR float_round_style round_style 1818 = round_to_nearest; 1819 }; 1820 1821 #undef __glibcxx_double_has_denorm_loss 1822 #undef __glibcxx_double_traps 1823 #undef __glibcxx_double_tinyness_before 1824 1825 /// numeric_limits<long double> specialization. 1826 template<> 1827 struct numeric_limits<long double> 1828 { 1829 static _GLIBCXX_USE_CONSTEXPR bool is_specialized = true; 1830 1831 static _GLIBCXX_CONSTEXPR long double 1832 min() _GLIBCXX_USE_NOEXCEPT { return __LDBL_MIN__; } 1833 1834 static _GLIBCXX_CONSTEXPR long double 1835 max() _GLIBCXX_USE_NOEXCEPT { return __LDBL_MAX__; } 1836 1837 #if __cplusplus >= 201103L 1838 static constexpr long double 1839 lowest() noexcept { return -__LDBL_MAX__; } 1840 #endif 1841 1842 static _GLIBCXX_USE_CONSTEXPR int digits = __LDBL_MANT_DIG__; 1843 static _GLIBCXX_USE_CONSTEXPR int digits10 = __LDBL_DIG__; 1844 #if __cplusplus >= 201103L 1845 static _GLIBCXX_USE_CONSTEXPR int max_digits10 1846 = __glibcxx_max_digits10 (__LDBL_MANT_DIG__); 1847 #endif 1848 static _GLIBCXX_USE_CONSTEXPR bool is_signed = true; 1849 static _GLIBCXX_USE_CONSTEXPR bool is_integer = false; 1850 static _GLIBCXX_USE_CONSTEXPR bool is_exact = false; 1851 static _GLIBCXX_USE_CONSTEXPR int radix = __FLT_RADIX__; 1852 1853 static _GLIBCXX_CONSTEXPR long double 1854 epsilon() _GLIBCXX_USE_NOEXCEPT { return __LDBL_EPSILON__; } 1855 1856 static _GLIBCXX_CONSTEXPR long double 1857 round_error() _GLIBCXX_USE_NOEXCEPT { return 0.5L; } 1858 1859 static _GLIBCXX_USE_CONSTEXPR int min_exponent = __LDBL_MIN_EXP__; 1860 static _GLIBCXX_USE_CONSTEXPR int min_exponent10 = __LDBL_MIN_10_EXP__; 1861 static _GLIBCXX_USE_CONSTEXPR int max_exponent = __LDBL_MAX_EXP__; 1862 static _GLIBCXX_USE_CONSTEXPR int max_exponent10 = __LDBL_MAX_10_EXP__; 1863 1864 static _GLIBCXX_USE_CONSTEXPR bool has_infinity = __LDBL_HAS_INFINITY__; 1865 static _GLIBCXX_USE_CONSTEXPR bool has_quiet_NaN = __LDBL_HAS_QUIET_NAN__; 1866 static _GLIBCXX_USE_CONSTEXPR bool has_signaling_NaN = has_quiet_NaN; 1867 static _GLIBCXX_USE_CONSTEXPR float_denorm_style has_denorm 1868 = bool(__LDBL_HAS_DENORM__) ? denorm_present : denorm_absent; 1869 static _GLIBCXX_USE_CONSTEXPR bool has_denorm_loss 1870 = __glibcxx_long_double_has_denorm_loss; 1871 1872 static _GLIBCXX_CONSTEXPR long double 1873 infinity() _GLIBCXX_USE_NOEXCEPT { return __builtin_huge_vall(); } 1874 1875 static _GLIBCXX_CONSTEXPR long double 1876 quiet_NaN() _GLIBCXX_USE_NOEXCEPT { return __builtin_nanl(""); } 1877 1878 static _GLIBCXX_CONSTEXPR long double 1879 signaling_NaN() _GLIBCXX_USE_NOEXCEPT { return __builtin_nansl(""); } 1880 1881 static _GLIBCXX_CONSTEXPR long double 1882 denorm_min() _GLIBCXX_USE_NOEXCEPT { return __LDBL_DENORM_MIN__; } 1883 1884 static _GLIBCXX_USE_CONSTEXPR bool is_iec559 1885 = has_infinity && has_quiet_NaN && has_denorm == denorm_present; 1886 static _GLIBCXX_USE_CONSTEXPR bool is_bounded = true; 1887 static _GLIBCXX_USE_CONSTEXPR bool is_modulo = false; 1888 1889 static _GLIBCXX_USE_CONSTEXPR bool traps = __glibcxx_long_double_traps; 1890 static _GLIBCXX_USE_CONSTEXPR bool tinyness_before = 1891 __glibcxx_long_double_tinyness_before; 1892 static _GLIBCXX_USE_CONSTEXPR float_round_style round_style = 1893 round_to_nearest; 1894 }; 1895 1896 #undef __glibcxx_long_double_has_denorm_loss 1897 #undef __glibcxx_long_double_traps 1898 #undef __glibcxx_long_double_tinyness_before 1899 1900 #define __glibcxx_concat3_(P,M,S) P ## M ## S 1901 #define __glibcxx_concat3(P,M,S) __glibcxx_concat3_ (P,M,S) 1902 1903 #if __cplusplus >= 201103L 1904 # define __max_digits10 max_digits10 1905 #endif 1906 1907 #define __glibcxx_float_n(BITSIZE) \ 1908 __extension__ \ 1909 template<> \ 1910 struct numeric_limits<_Float##BITSIZE> \ 1911 { \ 1912 static _GLIBCXX_USE_CONSTEXPR bool is_specialized = true; \ 1913 \ 1914 static _GLIBCXX_CONSTEXPR _Float##BITSIZE \ 1915 min() _GLIBCXX_USE_NOEXCEPT \ 1916 { return __glibcxx_concat3 (__FLT, BITSIZE, _MIN__); } \ 1917 \ 1918 static _GLIBCXX_CONSTEXPR _Float##BITSIZE \ 1919 max() _GLIBCXX_USE_NOEXCEPT \ 1920 { return __glibcxx_concat3 (__FLT, BITSIZE, _MAX__); } \ 1921 \ 1922 static _GLIBCXX_CONSTEXPR _Float##BITSIZE \ 1923 lowest() _GLIBCXX_USE_NOEXCEPT \ 1924 { return -__glibcxx_concat3 (__FLT, BITSIZE, _MAX__); } \ 1925 \ 1926 static _GLIBCXX_USE_CONSTEXPR int digits \ 1927 = __glibcxx_concat3 (__FLT, BITSIZE, _MANT_DIG__); \ 1928 static _GLIBCXX_USE_CONSTEXPR int digits10 \ 1929 = __glibcxx_concat3 (__FLT, BITSIZE, _DIG__); \ 1930 static _GLIBCXX_USE_CONSTEXPR int __max_digits10 \ 1931 = __glibcxx_max_digits10 (__glibcxx_concat3 (__FLT, BITSIZE, \ 1932 _MANT_DIG__)); \ 1933 static _GLIBCXX_USE_CONSTEXPR bool is_signed = true; \ 1934 static _GLIBCXX_USE_CONSTEXPR bool is_integer = false; \ 1935 static _GLIBCXX_USE_CONSTEXPR bool is_exact = false; \ 1936 static _GLIBCXX_USE_CONSTEXPR int radix = __FLT_RADIX__; \ 1937 \ 1938 static _GLIBCXX_CONSTEXPR _Float##BITSIZE \ 1939 epsilon() _GLIBCXX_USE_NOEXCEPT \ 1940 { return __glibcxx_concat3 (__FLT, BITSIZE, _EPSILON__); } \ 1941 \ 1942 static _GLIBCXX_CONSTEXPR _Float##BITSIZE \ 1943 round_error() _GLIBCXX_USE_NOEXCEPT { return 0.5F##BITSIZE; } \ 1944 \ 1945 static _GLIBCXX_USE_CONSTEXPR int min_exponent \ 1946 = __glibcxx_concat3 (__FLT, BITSIZE, _MIN_EXP__); \ 1947 static _GLIBCXX_USE_CONSTEXPR int min_exponent10 \ 1948 = __glibcxx_concat3 (__FLT, BITSIZE, _MIN_10_EXP__); \ 1949 static _GLIBCXX_USE_CONSTEXPR int max_exponent \ 1950 = __glibcxx_concat3 (__FLT, BITSIZE, _MAX_EXP__); \ 1951 static _GLIBCXX_USE_CONSTEXPR int max_exponent10 \ 1952 = __glibcxx_concat3 (__FLT, BITSIZE, _MAX_10_EXP__); \ 1953 \ 1954 static _GLIBCXX_USE_CONSTEXPR bool has_infinity \ 1955 = __glibcxx_concat3 (__FLT, BITSIZE, _HAS_INFINITY__); \ 1956 static _GLIBCXX_USE_CONSTEXPR bool has_quiet_NaN \ 1957 = __glibcxx_concat3 (__FLT, BITSIZE, _HAS_QUIET_NAN__); \ 1958 static _GLIBCXX_USE_CONSTEXPR bool has_signaling_NaN \ 1959 = has_quiet_NaN; \ 1960 static _GLIBCXX_USE_CONSTEXPR float_denorm_style has_denorm \ 1961 = bool(__glibcxx_concat3 (__FLT, BITSIZE, _HAS_DENORM__)) \ 1962 ? denorm_present : denorm_absent; \ 1963 static _GLIBCXX_USE_CONSTEXPR bool has_denorm_loss = false; \ 1964 \ 1965 static _GLIBCXX_CONSTEXPR _Float##BITSIZE \ 1966 infinity() _GLIBCXX_USE_NOEXCEPT \ 1967 { return __builtin_huge_valf##BITSIZE(); } \ 1968 \ 1969 static _GLIBCXX_CONSTEXPR _Float##BITSIZE \ 1970 quiet_NaN() _GLIBCXX_USE_NOEXCEPT \ 1971 { return __builtin_nanf##BITSIZE(""); } \ 1972 \ 1973 static _GLIBCXX_CONSTEXPR _Float##BITSIZE \ 1974 signaling_NaN() _GLIBCXX_USE_NOEXCEPT \ 1975 { return __builtin_nansf##BITSIZE(""); } \ 1976 \ 1977 static _GLIBCXX_CONSTEXPR _Float##BITSIZE \ 1978 denorm_min() _GLIBCXX_USE_NOEXCEPT \ 1979 { return __glibcxx_concat3 (__FLT, BITSIZE, _DENORM_MIN__); } \ 1980 \ 1981 static _GLIBCXX_USE_CONSTEXPR bool is_iec559 \ 1982 = has_infinity && has_quiet_NaN && has_denorm == denorm_present;\ 1983 static _GLIBCXX_USE_CONSTEXPR bool is_bounded = true; \ 1984 static _GLIBCXX_USE_CONSTEXPR bool is_modulo = false; \ 1985 \ 1986 static _GLIBCXX_USE_CONSTEXPR bool traps = false; \ 1987 static _GLIBCXX_USE_CONSTEXPR bool tinyness_before = false; \ 1988 static _GLIBCXX_USE_CONSTEXPR float_round_style round_style \ 1989 = round_to_nearest; \ 1990 }; \ 1991 1992 #ifdef __STDCPP_FLOAT16_T__ 1993 __glibcxx_float_n(16) 1994 #endif 1995 #ifdef __FLT32_DIG__ 1996 __glibcxx_float_n(32) 1997 #endif 1998 #ifdef __FLT64_DIG__ 1999 __glibcxx_float_n(64) 2000 #endif 2001 #ifdef __FLT128_DIG__ 2002 __glibcxx_float_n(128) 2003 #endif 2004 #undef __glibcxx_float_n 2005 #undef __glibcxx_concat3 2006 #undef __glibcxx_concat3_ 2007 2008 #if __cplusplus >= 201103L 2009 # undef __max_digits10 2010 #endif 2011 2012 #ifdef __STDCPP_BFLOAT16_T__ 2013 __extension__ 2014 template<> 2015 struct numeric_limits<__gnu_cxx::__bfloat16_t> 2016 { 2017 static _GLIBCXX_USE_CONSTEXPR bool is_specialized = true; 2018 2019 static _GLIBCXX_CONSTEXPR __gnu_cxx::__bfloat16_t 2020 min() _GLIBCXX_USE_NOEXCEPT 2021 { return __BFLT16_MIN__; } 2022 2023 static _GLIBCXX_CONSTEXPR __gnu_cxx::__bfloat16_t 2024 max() _GLIBCXX_USE_NOEXCEPT 2025 { return __BFLT16_MAX__; } 2026 2027 static _GLIBCXX_CONSTEXPR __gnu_cxx::__bfloat16_t 2028 lowest() _GLIBCXX_USE_NOEXCEPT 2029 { return -__BFLT16_MAX__; } 2030 2031 static _GLIBCXX_USE_CONSTEXPR int digits = __BFLT16_MANT_DIG__; 2032 static _GLIBCXX_USE_CONSTEXPR int digits10 = __BFLT16_DIG__; 2033 #if __cplusplus >= 201103L 2034 static _GLIBCXX_USE_CONSTEXPR int max_digits10 2035 = __glibcxx_max_digits10 (__BFLT16_MANT_DIG__); 2036 #endif 2037 static _GLIBCXX_USE_CONSTEXPR bool is_signed = true; 2038 static _GLIBCXX_USE_CONSTEXPR bool is_integer = false; 2039 static _GLIBCXX_USE_CONSTEXPR bool is_exact = false; 2040 static _GLIBCXX_USE_CONSTEXPR int radix = __FLT_RADIX__; 2041 2042 static _GLIBCXX_CONSTEXPR __gnu_cxx::__bfloat16_t 2043 epsilon() _GLIBCXX_USE_NOEXCEPT 2044 { return __BFLT16_EPSILON__; } 2045 2046 static _GLIBCXX_CONSTEXPR __gnu_cxx::__bfloat16_t 2047 round_error() _GLIBCXX_USE_NOEXCEPT { return 0.5BF16; } 2048 2049 static _GLIBCXX_USE_CONSTEXPR int min_exponent = __BFLT16_MIN_EXP__; 2050 static _GLIBCXX_USE_CONSTEXPR int min_exponent10 = __BFLT16_MIN_10_EXP__; 2051 static _GLIBCXX_USE_CONSTEXPR int max_exponent = __BFLT16_MAX_EXP__; 2052 static _GLIBCXX_USE_CONSTEXPR int max_exponent10 = __BFLT16_MAX_10_EXP__; 2053 2054 static _GLIBCXX_USE_CONSTEXPR bool has_infinity 2055 = __BFLT16_HAS_INFINITY__; 2056 static _GLIBCXX_USE_CONSTEXPR bool has_quiet_NaN 2057 = __BFLT16_HAS_QUIET_NAN__; 2058 static _GLIBCXX_USE_CONSTEXPR bool has_signaling_NaN = has_quiet_NaN; 2059 static _GLIBCXX_USE_CONSTEXPR float_denorm_style has_denorm 2060 = bool(__BFLT16_HAS_DENORM__) ? denorm_present : denorm_absent; 2061 static _GLIBCXX_USE_CONSTEXPR bool has_denorm_loss = false; 2062 2063 static _GLIBCXX_CONSTEXPR __gnu_cxx::__bfloat16_t 2064 infinity() _GLIBCXX_USE_NOEXCEPT 2065 { return __gnu_cxx::__bfloat16_t(__builtin_huge_valf()); } 2066 2067 static _GLIBCXX_CONSTEXPR __gnu_cxx::__bfloat16_t 2068 quiet_NaN() _GLIBCXX_USE_NOEXCEPT 2069 { return __gnu_cxx::__bfloat16_t(__builtin_nanf("")); } 2070 2071 static _GLIBCXX_CONSTEXPR __gnu_cxx::__bfloat16_t 2072 signaling_NaN() _GLIBCXX_USE_NOEXCEPT 2073 { return __builtin_nansf16b(""); } 2074 2075 static _GLIBCXX_CONSTEXPR __gnu_cxx::__bfloat16_t 2076 denorm_min() _GLIBCXX_USE_NOEXCEPT 2077 { return __BFLT16_DENORM_MIN__; } 2078 2079 static _GLIBCXX_USE_CONSTEXPR bool is_iec559 2080 = has_infinity && has_quiet_NaN && has_denorm == denorm_present; 2081 static _GLIBCXX_USE_CONSTEXPR bool is_bounded = true; 2082 static _GLIBCXX_USE_CONSTEXPR bool is_modulo = false; 2083 2084 static _GLIBCXX_USE_CONSTEXPR bool traps = false; 2085 static _GLIBCXX_USE_CONSTEXPR bool tinyness_before = false; 2086 static _GLIBCXX_USE_CONSTEXPR float_round_style round_style 2087 = round_to_nearest; 2088 }; 2089 #endif // __STDCPP_BFLOAT16_T__ 2090 2091 #if defined(_GLIBCXX_USE_FLOAT128) 2092 // We either need Q literal suffixes, or IEEE double. 2093 #if ! defined(__STRICT_ANSI__) || defined(_GLIBCXX_DOUBLE_IS_IEEE_BINARY64) 2094 __extension__ 2095 template<> 2096 struct numeric_limits<__float128> 2097 { 2098 static _GLIBCXX_USE_CONSTEXPR bool is_specialized = true; 2099 2100 static _GLIBCXX_CONSTEXPR __float128 2101 min() _GLIBCXX_USE_NOEXCEPT 2102 { 2103 #ifdef __STRICT_ANSI__ 2104 // 0x1.0p-30 * 0x1.0p-16352 2105 return double(9.3132257461547852e-10) * _S_1pm16352(); 2106 #else 2107 return __extension__ 0x1.0p-16382Q; 2108 #endif 2109 } 2110 2111 static _GLIBCXX_CONSTEXPR __float128 2112 max() _GLIBCXX_USE_NOEXCEPT 2113 { 2114 #ifdef __STRICT_ANSI__ 2115 // (0x1.fffffffffffffp+127 + 0x0.fffffffffffffp+75 + 0x0.ffp+23) 2116 // * 0x1.0p16256 2117 return (__float128(double(3.4028236692093843e+38)) 2118 + double(3.7778931862957153e+22) + double(8.35584e+6)) 2119 * _S_1p16256(); 2120 #else 2121 return __extension__ 0x1.ffffffffffffffffffffffffffffp+16383Q; 2122 #endif 2123 } 2124 2125 static _GLIBCXX_CONSTEXPR __float128 2126 lowest() _GLIBCXX_USE_NOEXCEPT 2127 { return -max(); } 2128 2129 static _GLIBCXX_USE_CONSTEXPR int digits = 113; 2130 static _GLIBCXX_USE_CONSTEXPR int digits10 = 33; 2131 #if __cplusplus >= 201103L 2132 static constexpr int max_digits10 = 36; 2133 #endif 2134 static _GLIBCXX_USE_CONSTEXPR bool is_signed = true; 2135 static _GLIBCXX_USE_CONSTEXPR bool is_integer = false; 2136 static _GLIBCXX_USE_CONSTEXPR bool is_exact = false; 2137 static _GLIBCXX_USE_CONSTEXPR int radix = __FLT_RADIX__; 2138 2139 static _GLIBCXX_CONSTEXPR __float128 2140 epsilon() _GLIBCXX_USE_NOEXCEPT 2141 { return double(1.9259299443872359e-34); } 2142 2143 static _GLIBCXX_CONSTEXPR __float128 2144 round_error() _GLIBCXX_USE_NOEXCEPT { return 0.5; } 2145 2146 static _GLIBCXX_USE_CONSTEXPR int min_exponent = -16381; 2147 static _GLIBCXX_USE_CONSTEXPR int min_exponent10 = -4931; 2148 static _GLIBCXX_USE_CONSTEXPR int max_exponent = 16384; 2149 static _GLIBCXX_USE_CONSTEXPR int max_exponent10 = 4932; 2150 2151 static _GLIBCXX_USE_CONSTEXPR bool has_infinity = 1; 2152 static _GLIBCXX_USE_CONSTEXPR bool has_quiet_NaN = 1; 2153 #if __has_builtin(__builtin_nansq) \ 2154 || (__has_builtin(__builtin_bit_cast) && __has_builtin(__builtin_nansf128)) 2155 static _GLIBCXX_USE_CONSTEXPR bool has_signaling_NaN = true; 2156 #else 2157 static _GLIBCXX_USE_CONSTEXPR bool has_signaling_NaN = false; 2158 #endif 2159 static _GLIBCXX_USE_CONSTEXPR float_denorm_style has_denorm 2160 = denorm_present; 2161 static _GLIBCXX_USE_CONSTEXPR bool has_denorm_loss = false; 2162 2163 static _GLIBCXX_CONSTEXPR __float128 2164 infinity() _GLIBCXX_USE_NOEXCEPT 2165 { return __builtin_huge_val(); } 2166 2167 static _GLIBCXX_CONSTEXPR __float128 2168 quiet_NaN() _GLIBCXX_USE_NOEXCEPT 2169 { return __builtin_nan(""); } 2170 2171 static _GLIBCXX_CONSTEXPR __float128 2172 signaling_NaN() _GLIBCXX_USE_NOEXCEPT 2173 { 2174 #if __has_builtin(__builtin_nansq) 2175 return __builtin_nansq(""); 2176 #elif __has_builtin(__builtin_bit_cast) && __has_builtin(__builtin_nansf128) 2177 return __builtin_bit_cast(__float128, __builtin_nansf128("")); 2178 #else 2179 return quiet_NaN(); 2180 #endif 2181 } 2182 2183 static _GLIBCXX_CONSTEXPR __float128 2184 denorm_min() _GLIBCXX_USE_NOEXCEPT 2185 { 2186 #if defined(__STRICT_ANSI__) || defined(__INTEL_COMPILER) 2187 // 0x1.0p-142 * 0x1.0p-16352 2188 return double(1.7936620343357659e-43) * _S_1pm16352(); 2189 #else 2190 return __extension__ 0x1.0p-16494Q; 2191 #endif 2192 } 2193 2194 static _GLIBCXX_USE_CONSTEXPR bool is_iec559 = has_signaling_NaN; 2195 static _GLIBCXX_USE_CONSTEXPR bool is_bounded = true; 2196 static _GLIBCXX_USE_CONSTEXPR bool is_modulo = false; 2197 2198 static _GLIBCXX_USE_CONSTEXPR bool traps = false; 2199 static _GLIBCXX_USE_CONSTEXPR bool tinyness_before = false; 2200 static _GLIBCXX_USE_CONSTEXPR float_round_style round_style 2201 = round_to_nearest; 2202 2203 #if defined(__STRICT_ANSI__) || defined(__INTEL_COMPILER) 2204 private: 2205 static _GLIBCXX_CONSTEXPR __float128 2206 _S_4p(__float128 __v) _GLIBCXX_USE_NOEXCEPT 2207 { return __v * __v * __v * __v; } 2208 2209 static _GLIBCXX_CONSTEXPR __float128 2210 _S_1pm4088() _GLIBCXX_USE_NOEXCEPT 2211 { return _S_4p(/* 0x1.0p-1022 */ double(2.2250738585072014e-308)); } 2212 2213 static _GLIBCXX_CONSTEXPR __float128 2214 _S_1pm16352() _GLIBCXX_USE_NOEXCEPT 2215 { return _S_4p(_S_1pm4088()); } 2216 2217 static _GLIBCXX_CONSTEXPR __float128 2218 _S_1p4064() _GLIBCXX_USE_NOEXCEPT 2219 { return _S_4p(/* 0x1.0p+1016 */ double(7.0222388080559215e+305)); } 2220 2221 static _GLIBCXX_CONSTEXPR __float128 2222 _S_1p16256() _GLIBCXX_USE_NOEXCEPT 2223 { return _S_4p(_S_1p4064()); } 2224 #endif 2225 }; 2226 #endif // !__STRICT_ANSI__ || DOUBLE_IS_IEEE_BINARY64 2227 #endif // _GLIBCXX_USE_FLOAT128 2228 2229 _GLIBCXX_END_NAMESPACE_VERSION 2230 } // namespace 2231 2232 #undef __glibcxx_signed 2233 #undef __glibcxx_min 2234 #undef __glibcxx_max 2235 #undef __glibcxx_digits 2236 #undef __glibcxx_digits10 2237 #undef __glibcxx_max_digits10 2238 2239 #pragma GCC diagnostic pop 2240 #endif // _GLIBCXX_NUMERIC_LIMITS