libstdc++
|
00001 // The template and inlines for the numeric_limits classes. -*- C++ -*- 00002 00003 // Copyright (C) 1999-2015 Free Software Foundation, Inc. 00004 // 00005 // This file is part of the GNU ISO C++ Library. This library is free 00006 // software; you can redistribute it and/or modify it under the 00007 // terms of the GNU General Public License as published by the 00008 // Free Software Foundation; either version 3, or (at your option) 00009 // any later version. 00010 00011 // This library is distributed in the hope that it will be useful, 00012 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00014 // GNU General Public License for more details. 00015 00016 // Under Section 7 of GPL version 3, you are granted additional 00017 // permissions described in the GCC Runtime Library Exception, version 00018 // 3.1, as published by the Free Software Foundation. 00019 00020 // You should have received a copy of the GNU General Public License and 00021 // a copy of the GCC Runtime Library Exception along with this program; 00022 // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see 00023 // <http://www.gnu.org/licenses/>. 00024 00025 /** @file include/limits 00026 * This is a Standard C++ Library header. 00027 */ 00028 00029 // Note: this is not a conforming implementation. 00030 // Written by Gabriel Dos Reis <gdr@codesourcery.com> 00031 00032 // 00033 // ISO 14882:1998 00034 // 18.2.1 00035 // 00036 00037 #ifndef _GLIBCXX_NUMERIC_LIMITS 00038 #define _GLIBCXX_NUMERIC_LIMITS 1 00039 00040 #pragma GCC system_header 00041 00042 #include <bits/c++config.h> 00043 00044 // 00045 // The numeric_limits<> traits document implementation-defined aspects 00046 // of fundamental arithmetic data types (integers and floating points). 00047 // From Standard C++ point of view, there are 14 such types: 00048 // * integers 00049 // bool (1) 00050 // char, signed char, unsigned char, wchar_t (4) 00051 // short, unsigned short (2) 00052 // int, unsigned (2) 00053 // long, unsigned long (2) 00054 // 00055 // * floating points 00056 // float (1) 00057 // double (1) 00058 // long double (1) 00059 // 00060 // GNU C++ understands (where supported by the host C-library) 00061 // * integer 00062 // long long, unsigned long long (2) 00063 // 00064 // which brings us to 16 fundamental arithmetic data types in GNU C++. 00065 // 00066 // 00067 // Since a numeric_limits<> is a bit tricky to get right, we rely on 00068 // an interface composed of macros which should be defined in config/os 00069 // or config/cpu when they differ from the generic (read arbitrary) 00070 // definitions given here. 00071 // 00072 00073 // These values can be overridden in the target configuration file. 00074 // The default values are appropriate for many 32-bit targets. 00075 00076 // GCC only intrinsically supports modulo integral types. The only remaining 00077 // integral exceptional values is division by zero. Only targets that do not 00078 // signal division by zero in some "hard to ignore" way should use false. 00079 #ifndef __glibcxx_integral_traps 00080 # define __glibcxx_integral_traps true 00081 #endif 00082 00083 // float 00084 // 00085 00086 // Default values. Should be overridden in configuration files if necessary. 00087 00088 #ifndef __glibcxx_float_has_denorm_loss 00089 # define __glibcxx_float_has_denorm_loss false 00090 #endif 00091 #ifndef __glibcxx_float_traps 00092 # define __glibcxx_float_traps false 00093 #endif 00094 #ifndef __glibcxx_float_tinyness_before 00095 # define __glibcxx_float_tinyness_before false 00096 #endif 00097 00098 // double 00099 00100 // Default values. Should be overridden in configuration files if necessary. 00101 00102 #ifndef __glibcxx_double_has_denorm_loss 00103 # define __glibcxx_double_has_denorm_loss false 00104 #endif 00105 #ifndef __glibcxx_double_traps 00106 # define __glibcxx_double_traps false 00107 #endif 00108 #ifndef __glibcxx_double_tinyness_before 00109 # define __glibcxx_double_tinyness_before false 00110 #endif 00111 00112 // long double 00113 00114 // Default values. Should be overridden in configuration files if necessary. 00115 00116 #ifndef __glibcxx_long_double_has_denorm_loss 00117 # define __glibcxx_long_double_has_denorm_loss false 00118 #endif 00119 #ifndef __glibcxx_long_double_traps 00120 # define __glibcxx_long_double_traps false 00121 #endif 00122 #ifndef __glibcxx_long_double_tinyness_before 00123 # define __glibcxx_long_double_tinyness_before false 00124 #endif 00125 00126 // You should not need to define any macros below this point. 00127 00128 #define __glibcxx_signed_b(T,B) ((T)(-1) < 0) 00129 00130 #define __glibcxx_min_b(T,B) \ 00131 (__glibcxx_signed_b (T,B) ? -__glibcxx_max_b (T,B) - 1 : (T)0) 00132 00133 #define __glibcxx_max_b(T,B) \ 00134 (__glibcxx_signed_b (T,B) ? \ 00135 (((((T)1 << (__glibcxx_digits_b (T,B) - 1)) - 1) << 1) + 1) : ~(T)0) 00136 00137 #define __glibcxx_digits_b(T,B) \ 00138 (B - __glibcxx_signed_b (T,B)) 00139 00140 // The fraction 643/2136 approximates log10(2) to 7 significant digits. 00141 #define __glibcxx_digits10_b(T,B) \ 00142 (__glibcxx_digits_b (T,B) * 643L / 2136) 00143 00144 #define __glibcxx_signed(T) \ 00145 __glibcxx_signed_b (T, sizeof(T) * __CHAR_BIT__) 00146 #define __glibcxx_min(T) \ 00147 __glibcxx_min_b (T, sizeof(T) * __CHAR_BIT__) 00148 #define __glibcxx_max(T) \ 00149 __glibcxx_max_b (T, sizeof(T) * __CHAR_BIT__) 00150 #define __glibcxx_digits(T) \ 00151 __glibcxx_digits_b (T, sizeof(T) * __CHAR_BIT__) 00152 #define __glibcxx_digits10(T) \ 00153 __glibcxx_digits10_b (T, sizeof(T) * __CHAR_BIT__) 00154 00155 #define __glibcxx_max_digits10(T) \ 00156 (2 + (T) * 643L / 2136) 00157 00158 namespace std _GLIBCXX_VISIBILITY(default) 00159 { 00160 _GLIBCXX_BEGIN_NAMESPACE_VERSION 00161 00162 /** 00163 * @brief Describes the rounding style for floating-point types. 00164 * 00165 * This is used in the std::numeric_limits class. 00166 */ 00167 enum float_round_style 00168 { 00169 round_indeterminate = -1, /// Intermediate. 00170 round_toward_zero = 0, /// To zero. 00171 round_to_nearest = 1, /// To the nearest representable value. 00172 round_toward_infinity = 2, /// To infinity. 00173 round_toward_neg_infinity = 3 /// To negative infinity. 00174 }; 00175 00176 /** 00177 * @brief Describes the denormalization for floating-point types. 00178 * 00179 * These values represent the presence or absence of a variable number 00180 * of exponent bits. This type is used in the std::numeric_limits class. 00181 */ 00182 enum float_denorm_style 00183 { 00184 /// Indeterminate at compile time whether denormalized values are allowed. 00185 denorm_indeterminate = -1, 00186 /// The type does not allow denormalized values. 00187 denorm_absent = 0, 00188 /// The type allows denormalized values. 00189 denorm_present = 1 00190 }; 00191 00192 /** 00193 * @brief Part of std::numeric_limits. 00194 * 00195 * The @c static @c const members are usable as integral constant 00196 * expressions. 00197 * 00198 * @note This is a separate class for purposes of efficiency; you 00199 * should only access these members as part of an instantiation 00200 * of the std::numeric_limits class. 00201 */ 00202 struct __numeric_limits_base 00203 { 00204 /** This will be true for all fundamental types (which have 00205 specializations), and false for everything else. */ 00206 static _GLIBCXX_USE_CONSTEXPR bool is_specialized = false; 00207 00208 /** The number of @c radix digits that be represented without change: for 00209 integer types, the number of non-sign bits in the mantissa; for 00210 floating types, the number of @c radix digits in the mantissa. */ 00211 static _GLIBCXX_USE_CONSTEXPR int digits = 0; 00212 00213 /** The number of base 10 digits that can be represented without change. */ 00214 static _GLIBCXX_USE_CONSTEXPR int digits10 = 0; 00215 00216 #if __cplusplus >= 201103L 00217 /** The number of base 10 digits required to ensure that values which 00218 differ are always differentiated. */ 00219 static constexpr int max_digits10 = 0; 00220 #endif 00221 00222 /** True if the type is signed. */ 00223 static _GLIBCXX_USE_CONSTEXPR bool is_signed = false; 00224 00225 /** True if the type is integer. */ 00226 static _GLIBCXX_USE_CONSTEXPR bool is_integer = false; 00227 00228 /** True if the type uses an exact representation. All integer types are 00229 exact, but not all exact types are integer. For example, rational and 00230 fixed-exponent representations are exact but not integer. */ 00231 static _GLIBCXX_USE_CONSTEXPR bool is_exact = false; 00232 00233 /** For integer types, specifies the base of the representation. For 00234 floating types, specifies the base of the exponent representation. */ 00235 static _GLIBCXX_USE_CONSTEXPR int radix = 0; 00236 00237 /** The minimum negative integer such that @c radix raised to the power of 00238 (one less than that integer) is a normalized floating point number. */ 00239 static _GLIBCXX_USE_CONSTEXPR int min_exponent = 0; 00240 00241 /** The minimum negative integer such that 10 raised to that power is in 00242 the range of normalized floating point numbers. */ 00243 static _GLIBCXX_USE_CONSTEXPR int min_exponent10 = 0; 00244 00245 /** The maximum positive integer such that @c radix raised to the power of 00246 (one less than that integer) is a representable finite floating point 00247 number. */ 00248 static _GLIBCXX_USE_CONSTEXPR int max_exponent = 0; 00249 00250 /** The maximum positive integer such that 10 raised to that power is in 00251 the range of representable finite floating point numbers. */ 00252 static _GLIBCXX_USE_CONSTEXPR int max_exponent10 = 0; 00253 00254 /** True if the type has a representation for positive infinity. */ 00255 static _GLIBCXX_USE_CONSTEXPR bool has_infinity = false; 00256 00257 /** True if the type has a representation for a quiet (non-signaling) 00258 Not a Number. */ 00259 static _GLIBCXX_USE_CONSTEXPR bool has_quiet_NaN = false; 00260 00261 /** True if the type has a representation for a signaling 00262 Not a Number. */ 00263 static _GLIBCXX_USE_CONSTEXPR bool has_signaling_NaN = false; 00264 00265 /** See std::float_denorm_style for more information. */ 00266 static _GLIBCXX_USE_CONSTEXPR float_denorm_style has_denorm = denorm_absent; 00267 00268 /** True if loss of accuracy is detected as a denormalization loss, 00269 rather than as an inexact result. */ 00270 static _GLIBCXX_USE_CONSTEXPR bool has_denorm_loss = false; 00271 00272 /** True if-and-only-if the type adheres to the IEC 559 standard, also 00273 known as IEEE 754. (Only makes sense for floating point types.) */ 00274 static _GLIBCXX_USE_CONSTEXPR bool is_iec559 = false; 00275 00276 /** True if the set of values representable by the type is 00277 finite. All built-in types are bounded, this member would be 00278 false for arbitrary precision types. */ 00279 static _GLIBCXX_USE_CONSTEXPR bool is_bounded = false; 00280 00281 /** True if the type is @e modulo. A type is modulo if, for any 00282 operation involving +, -, or * on values of that type whose 00283 result would fall outside the range [min(),max()], the value 00284 returned differs from the true value by an integer multiple of 00285 max() - min() + 1. On most machines, this is false for floating 00286 types, true for unsigned integers, and true for signed integers. 00287 See PR22200 about signed integers. */ 00288 static _GLIBCXX_USE_CONSTEXPR bool is_modulo = false; 00289 00290 /** True if trapping is implemented for this type. */ 00291 static _GLIBCXX_USE_CONSTEXPR bool traps = false; 00292 00293 /** True if tininess is detected before rounding. (see IEC 559) */ 00294 static _GLIBCXX_USE_CONSTEXPR bool tinyness_before = false; 00295 00296 /** See std::float_round_style for more information. This is only 00297 meaningful for floating types; integer types will all be 00298 round_toward_zero. */ 00299 static _GLIBCXX_USE_CONSTEXPR float_round_style round_style = 00300 round_toward_zero; 00301 }; 00302 00303 /** 00304 * @brief Properties of fundamental types. 00305 * 00306 * This class allows a program to obtain information about the 00307 * representation of a fundamental type on a given platform. For 00308 * non-fundamental types, the functions will return 0 and the data 00309 * members will all be @c false. 00310 * 00311 * _GLIBCXX_RESOLVE_LIB_DEFECTS: DRs 201 and 184 (hi Gaby!) are 00312 * noted, but not incorporated in this documented (yet). 00313 */ 00314 template<typename _Tp> 00315 struct numeric_limits : public __numeric_limits_base 00316 { 00317 /** The minimum finite value, or for floating types with 00318 denormalization, the minimum positive normalized value. */ 00319 static _GLIBCXX_CONSTEXPR _Tp 00320 min() _GLIBCXX_USE_NOEXCEPT { return _Tp(); } 00321 00322 /** The maximum finite value. */ 00323 static _GLIBCXX_CONSTEXPR _Tp 00324 max() _GLIBCXX_USE_NOEXCEPT { return _Tp(); } 00325 00326 #if __cplusplus >= 201103L 00327 /** A finite value x such that there is no other finite value y 00328 * where y < x. */ 00329 static constexpr _Tp 00330 lowest() noexcept { return _Tp(); } 00331 #endif 00332 00333 /** The @e machine @e epsilon: the difference between 1 and the least 00334 value greater than 1 that is representable. */ 00335 static _GLIBCXX_CONSTEXPR _Tp 00336 epsilon() _GLIBCXX_USE_NOEXCEPT { return _Tp(); } 00337 00338 /** The maximum rounding error measurement (see LIA-1). */ 00339 static _GLIBCXX_CONSTEXPR _Tp 00340 round_error() _GLIBCXX_USE_NOEXCEPT { return _Tp(); } 00341 00342 /** The representation of positive infinity, if @c has_infinity. */ 00343 static _GLIBCXX_CONSTEXPR _Tp 00344 infinity() _GLIBCXX_USE_NOEXCEPT { return _Tp(); } 00345 00346 /** The representation of a quiet Not a Number, 00347 if @c has_quiet_NaN. */ 00348 static _GLIBCXX_CONSTEXPR _Tp 00349 quiet_NaN() _GLIBCXX_USE_NOEXCEPT { return _Tp(); } 00350 00351 /** The representation of a signaling Not a Number, if 00352 @c has_signaling_NaN. */ 00353 static _GLIBCXX_CONSTEXPR _Tp 00354 signaling_NaN() _GLIBCXX_USE_NOEXCEPT { return _Tp(); } 00355 00356 /** The minimum positive denormalized value. For types where 00357 @c has_denorm is false, this is the minimum positive normalized 00358 value. */ 00359 static _GLIBCXX_CONSTEXPR _Tp 00360 denorm_min() _GLIBCXX_USE_NOEXCEPT { return _Tp(); } 00361 }; 00362 00363 #if __cplusplus >= 201103L 00364 template<typename _Tp> 00365 struct numeric_limits<const _Tp> 00366 : public numeric_limits<_Tp> { }; 00367 00368 template<typename _Tp> 00369 struct numeric_limits<volatile _Tp> 00370 : public numeric_limits<_Tp> { }; 00371 00372 template<typename _Tp> 00373 struct numeric_limits<const volatile _Tp> 00374 : public numeric_limits<_Tp> { }; 00375 #endif 00376 00377 // Now there follow 16 explicit specializations. Yes, 16. Make sure 00378 // you get the count right. (18 in c++0x mode) 00379 00380 /// numeric_limits<bool> specialization. 00381 template<> 00382 struct numeric_limits<bool> 00383 { 00384 static _GLIBCXX_USE_CONSTEXPR bool is_specialized = true; 00385 00386 static _GLIBCXX_CONSTEXPR bool 00387 min() _GLIBCXX_USE_NOEXCEPT { return false; } 00388 00389 static _GLIBCXX_CONSTEXPR bool 00390 max() _GLIBCXX_USE_NOEXCEPT { return true; } 00391 00392 #if __cplusplus >= 201103L 00393 static constexpr bool 00394 lowest() noexcept { return min(); } 00395 #endif 00396 static _GLIBCXX_USE_CONSTEXPR int digits = 1; 00397 static _GLIBCXX_USE_CONSTEXPR int digits10 = 0; 00398 #if __cplusplus >= 201103L 00399 static constexpr int max_digits10 = 0; 00400 #endif 00401 static _GLIBCXX_USE_CONSTEXPR bool is_signed = false; 00402 static _GLIBCXX_USE_CONSTEXPR bool is_integer = true; 00403 static _GLIBCXX_USE_CONSTEXPR bool is_exact = true; 00404 static _GLIBCXX_USE_CONSTEXPR int radix = 2; 00405 00406 static _GLIBCXX_CONSTEXPR bool 00407 epsilon() _GLIBCXX_USE_NOEXCEPT { return false; } 00408 00409 static _GLIBCXX_CONSTEXPR bool 00410 round_error() _GLIBCXX_USE_NOEXCEPT { return false; } 00411 00412 static _GLIBCXX_USE_CONSTEXPR int min_exponent = 0; 00413 static _GLIBCXX_USE_CONSTEXPR int min_exponent10 = 0; 00414 static _GLIBCXX_USE_CONSTEXPR int max_exponent = 0; 00415 static _GLIBCXX_USE_CONSTEXPR int max_exponent10 = 0; 00416 00417 static _GLIBCXX_USE_CONSTEXPR bool has_infinity = false; 00418 static _GLIBCXX_USE_CONSTEXPR bool has_quiet_NaN = false; 00419 static _GLIBCXX_USE_CONSTEXPR bool has_signaling_NaN = false; 00420 static _GLIBCXX_USE_CONSTEXPR float_denorm_style has_denorm 00421 = denorm_absent; 00422 static _GLIBCXX_USE_CONSTEXPR bool has_denorm_loss = false; 00423 00424 static _GLIBCXX_CONSTEXPR bool 00425 infinity() _GLIBCXX_USE_NOEXCEPT { return false; } 00426 00427 static _GLIBCXX_CONSTEXPR bool 00428 quiet_NaN() _GLIBCXX_USE_NOEXCEPT { return false; } 00429 00430 static _GLIBCXX_CONSTEXPR bool 00431 signaling_NaN() _GLIBCXX_USE_NOEXCEPT { return false; } 00432 00433 static _GLIBCXX_CONSTEXPR bool 00434 denorm_min() _GLIBCXX_USE_NOEXCEPT { return false; } 00435 00436 static _GLIBCXX_USE_CONSTEXPR bool is_iec559 = false; 00437 static _GLIBCXX_USE_CONSTEXPR bool is_bounded = true; 00438 static _GLIBCXX_USE_CONSTEXPR bool is_modulo = false; 00439 00440 // It is not clear what it means for a boolean type to trap. 00441 // This is a DR on the LWG issue list. Here, I use integer 00442 // promotion semantics. 00443 static _GLIBCXX_USE_CONSTEXPR bool traps = __glibcxx_integral_traps; 00444 static _GLIBCXX_USE_CONSTEXPR bool tinyness_before = false; 00445 static _GLIBCXX_USE_CONSTEXPR float_round_style round_style 00446 = round_toward_zero; 00447 }; 00448 00449 /// numeric_limits<char> specialization. 00450 template<> 00451 struct numeric_limits<char> 00452 { 00453 static _GLIBCXX_USE_CONSTEXPR bool is_specialized = true; 00454 00455 static _GLIBCXX_CONSTEXPR char 00456 min() _GLIBCXX_USE_NOEXCEPT { return __glibcxx_min(char); } 00457 00458 static _GLIBCXX_CONSTEXPR char 00459 max() _GLIBCXX_USE_NOEXCEPT { return __glibcxx_max(char); } 00460 00461 #if __cplusplus >= 201103L 00462 static constexpr char 00463 lowest() noexcept { return min(); } 00464 #endif 00465 00466 static _GLIBCXX_USE_CONSTEXPR int digits = __glibcxx_digits (char); 00467 static _GLIBCXX_USE_CONSTEXPR int digits10 = __glibcxx_digits10 (char); 00468 #if __cplusplus >= 201103L 00469 static constexpr int max_digits10 = 0; 00470 #endif 00471 static _GLIBCXX_USE_CONSTEXPR bool is_signed = __glibcxx_signed (char); 00472 static _GLIBCXX_USE_CONSTEXPR bool is_integer = true; 00473 static _GLIBCXX_USE_CONSTEXPR bool is_exact = true; 00474 static _GLIBCXX_USE_CONSTEXPR int radix = 2; 00475 00476 static _GLIBCXX_CONSTEXPR char 00477 epsilon() _GLIBCXX_USE_NOEXCEPT { return 0; } 00478 00479 static _GLIBCXX_CONSTEXPR char 00480 round_error() _GLIBCXX_USE_NOEXCEPT { return 0; } 00481 00482 static _GLIBCXX_USE_CONSTEXPR int min_exponent = 0; 00483 static _GLIBCXX_USE_CONSTEXPR int min_exponent10 = 0; 00484 static _GLIBCXX_USE_CONSTEXPR int max_exponent = 0; 00485 static _GLIBCXX_USE_CONSTEXPR int max_exponent10 = 0; 00486 00487 static _GLIBCXX_USE_CONSTEXPR bool has_infinity = false; 00488 static _GLIBCXX_USE_CONSTEXPR bool has_quiet_NaN = false; 00489 static _GLIBCXX_USE_CONSTEXPR bool has_signaling_NaN = false; 00490 static _GLIBCXX_USE_CONSTEXPR float_denorm_style has_denorm 00491 = denorm_absent; 00492 static _GLIBCXX_USE_CONSTEXPR bool has_denorm_loss = false; 00493 00494 static _GLIBCXX_CONSTEXPR 00495 char infinity() _GLIBCXX_USE_NOEXCEPT { return char(); } 00496 00497 static _GLIBCXX_CONSTEXPR char 00498 quiet_NaN() _GLIBCXX_USE_NOEXCEPT { return char(); } 00499 00500 static _GLIBCXX_CONSTEXPR char 00501 signaling_NaN() _GLIBCXX_USE_NOEXCEPT { return char(); } 00502 00503 static _GLIBCXX_CONSTEXPR char 00504 denorm_min() _GLIBCXX_USE_NOEXCEPT { return static_cast<char>(0); } 00505 00506 static _GLIBCXX_USE_CONSTEXPR bool is_iec559 = false; 00507 static _GLIBCXX_USE_CONSTEXPR bool is_bounded = true; 00508 static _GLIBCXX_USE_CONSTEXPR bool is_modulo = !is_signed; 00509 00510 static _GLIBCXX_USE_CONSTEXPR bool traps = __glibcxx_integral_traps; 00511 static _GLIBCXX_USE_CONSTEXPR bool tinyness_before = false; 00512 static _GLIBCXX_USE_CONSTEXPR float_round_style round_style 00513 = round_toward_zero; 00514 }; 00515 00516 /// numeric_limits<signed char> specialization. 00517 template<> 00518 struct numeric_limits<signed char> 00519 { 00520 static _GLIBCXX_USE_CONSTEXPR bool is_specialized = true; 00521 00522 static _GLIBCXX_CONSTEXPR signed char 00523 min() _GLIBCXX_USE_NOEXCEPT { return -__SCHAR_MAX__ - 1; } 00524 00525 static _GLIBCXX_CONSTEXPR signed char 00526 max() _GLIBCXX_USE_NOEXCEPT { return __SCHAR_MAX__; } 00527 00528 #if __cplusplus >= 201103L 00529 static constexpr signed char 00530 lowest() noexcept { return min(); } 00531 #endif 00532 00533 static _GLIBCXX_USE_CONSTEXPR int digits = __glibcxx_digits (signed char); 00534 static _GLIBCXX_USE_CONSTEXPR int digits10 00535 = __glibcxx_digits10 (signed char); 00536 #if __cplusplus >= 201103L 00537 static constexpr int max_digits10 = 0; 00538 #endif 00539 static _GLIBCXX_USE_CONSTEXPR bool is_signed = true; 00540 static _GLIBCXX_USE_CONSTEXPR bool is_integer = true; 00541 static _GLIBCXX_USE_CONSTEXPR bool is_exact = true; 00542 static _GLIBCXX_USE_CONSTEXPR int radix = 2; 00543 00544 static _GLIBCXX_CONSTEXPR signed char 00545 epsilon() _GLIBCXX_USE_NOEXCEPT { return 0; } 00546 00547 static _GLIBCXX_CONSTEXPR signed char 00548 round_error() _GLIBCXX_USE_NOEXCEPT { return 0; } 00549 00550 static _GLIBCXX_USE_CONSTEXPR int min_exponent = 0; 00551 static _GLIBCXX_USE_CONSTEXPR int min_exponent10 = 0; 00552 static _GLIBCXX_USE_CONSTEXPR int max_exponent = 0; 00553 static _GLIBCXX_USE_CONSTEXPR int max_exponent10 = 0; 00554 00555 static _GLIBCXX_USE_CONSTEXPR bool has_infinity = false; 00556 static _GLIBCXX_USE_CONSTEXPR bool has_quiet_NaN = false; 00557 static _GLIBCXX_USE_CONSTEXPR bool has_signaling_NaN = false; 00558 static _GLIBCXX_USE_CONSTEXPR float_denorm_style has_denorm 00559 = denorm_absent; 00560 static _GLIBCXX_USE_CONSTEXPR bool has_denorm_loss = false; 00561 00562 static _GLIBCXX_CONSTEXPR signed char 00563 infinity() _GLIBCXX_USE_NOEXCEPT { return static_cast<signed char>(0); } 00564 00565 static _GLIBCXX_CONSTEXPR signed char 00566 quiet_NaN() _GLIBCXX_USE_NOEXCEPT { return static_cast<signed char>(0); } 00567 00568 static _GLIBCXX_CONSTEXPR signed char 00569 signaling_NaN() _GLIBCXX_USE_NOEXCEPT 00570 { return static_cast<signed char>(0); } 00571 00572 static _GLIBCXX_CONSTEXPR signed char 00573 denorm_min() _GLIBCXX_USE_NOEXCEPT 00574 { return static_cast<signed char>(0); } 00575 00576 static _GLIBCXX_USE_CONSTEXPR bool is_iec559 = false; 00577 static _GLIBCXX_USE_CONSTEXPR bool is_bounded = true; 00578 static _GLIBCXX_USE_CONSTEXPR bool is_modulo = false; 00579 00580 static _GLIBCXX_USE_CONSTEXPR bool traps = __glibcxx_integral_traps; 00581 static _GLIBCXX_USE_CONSTEXPR bool tinyness_before = false; 00582 static _GLIBCXX_USE_CONSTEXPR float_round_style round_style 00583 = round_toward_zero; 00584 }; 00585 00586 /// numeric_limits<unsigned char> specialization. 00587 template<> 00588 struct numeric_limits<unsigned char> 00589 { 00590 static _GLIBCXX_USE_CONSTEXPR bool is_specialized = true; 00591 00592 static _GLIBCXX_CONSTEXPR unsigned char 00593 min() _GLIBCXX_USE_NOEXCEPT { return 0; } 00594 00595 static _GLIBCXX_CONSTEXPR unsigned char 00596 max() _GLIBCXX_USE_NOEXCEPT { return __SCHAR_MAX__ * 2U + 1; } 00597 00598 #if __cplusplus >= 201103L 00599 static constexpr unsigned char 00600 lowest() noexcept { return min(); } 00601 #endif 00602 00603 static _GLIBCXX_USE_CONSTEXPR int digits 00604 = __glibcxx_digits (unsigned char); 00605 static _GLIBCXX_USE_CONSTEXPR int digits10 00606 = __glibcxx_digits10 (unsigned char); 00607 #if __cplusplus >= 201103L 00608 static constexpr int max_digits10 = 0; 00609 #endif 00610 static _GLIBCXX_USE_CONSTEXPR bool is_signed = false; 00611 static _GLIBCXX_USE_CONSTEXPR bool is_integer = true; 00612 static _GLIBCXX_USE_CONSTEXPR bool is_exact = true; 00613 static _GLIBCXX_USE_CONSTEXPR int radix = 2; 00614 00615 static _GLIBCXX_CONSTEXPR unsigned char 00616 epsilon() _GLIBCXX_USE_NOEXCEPT { return 0; } 00617 00618 static _GLIBCXX_CONSTEXPR unsigned char 00619 round_error() _GLIBCXX_USE_NOEXCEPT { return 0; } 00620 00621 static _GLIBCXX_USE_CONSTEXPR int min_exponent = 0; 00622 static _GLIBCXX_USE_CONSTEXPR int min_exponent10 = 0; 00623 static _GLIBCXX_USE_CONSTEXPR int max_exponent = 0; 00624 static _GLIBCXX_USE_CONSTEXPR int max_exponent10 = 0; 00625 00626 static _GLIBCXX_USE_CONSTEXPR bool has_infinity = false; 00627 static _GLIBCXX_USE_CONSTEXPR bool has_quiet_NaN = false; 00628 static _GLIBCXX_USE_CONSTEXPR bool has_signaling_NaN = false; 00629 static _GLIBCXX_USE_CONSTEXPR float_denorm_style has_denorm 00630 = denorm_absent; 00631 static _GLIBCXX_USE_CONSTEXPR bool has_denorm_loss = false; 00632 00633 static _GLIBCXX_CONSTEXPR unsigned char 00634 infinity() _GLIBCXX_USE_NOEXCEPT 00635 { return static_cast<unsigned char>(0); } 00636 00637 static _GLIBCXX_CONSTEXPR unsigned char 00638 quiet_NaN() _GLIBCXX_USE_NOEXCEPT 00639 { return static_cast<unsigned char>(0); } 00640 00641 static _GLIBCXX_CONSTEXPR unsigned char 00642 signaling_NaN() _GLIBCXX_USE_NOEXCEPT 00643 { return static_cast<unsigned char>(0); } 00644 00645 static _GLIBCXX_CONSTEXPR unsigned char 00646 denorm_min() _GLIBCXX_USE_NOEXCEPT 00647 { return static_cast<unsigned char>(0); } 00648 00649 static _GLIBCXX_USE_CONSTEXPR bool is_iec559 = false; 00650 static _GLIBCXX_USE_CONSTEXPR bool is_bounded = true; 00651 static _GLIBCXX_USE_CONSTEXPR bool is_modulo = true; 00652 00653 static _GLIBCXX_USE_CONSTEXPR bool traps = __glibcxx_integral_traps; 00654 static _GLIBCXX_USE_CONSTEXPR bool tinyness_before = false; 00655 static _GLIBCXX_USE_CONSTEXPR float_round_style round_style 00656 = round_toward_zero; 00657 }; 00658 00659 /// numeric_limits<wchar_t> specialization. 00660 template<> 00661 struct numeric_limits<wchar_t> 00662 { 00663 static _GLIBCXX_USE_CONSTEXPR bool is_specialized = true; 00664 00665 static _GLIBCXX_CONSTEXPR wchar_t 00666 min() _GLIBCXX_USE_NOEXCEPT { return __glibcxx_min (wchar_t); } 00667 00668 static _GLIBCXX_CONSTEXPR wchar_t 00669 max() _GLIBCXX_USE_NOEXCEPT { return __glibcxx_max (wchar_t); } 00670 00671 #if __cplusplus >= 201103L 00672 static constexpr wchar_t 00673 lowest() noexcept { return min(); } 00674 #endif 00675 00676 static _GLIBCXX_USE_CONSTEXPR int digits = __glibcxx_digits (wchar_t); 00677 static _GLIBCXX_USE_CONSTEXPR int digits10 00678 = __glibcxx_digits10 (wchar_t); 00679 #if __cplusplus >= 201103L 00680 static constexpr int max_digits10 = 0; 00681 #endif 00682 static _GLIBCXX_USE_CONSTEXPR bool is_signed = __glibcxx_signed (wchar_t); 00683 static _GLIBCXX_USE_CONSTEXPR bool is_integer = true; 00684 static _GLIBCXX_USE_CONSTEXPR bool is_exact = true; 00685 static _GLIBCXX_USE_CONSTEXPR int radix = 2; 00686 00687 static _GLIBCXX_CONSTEXPR wchar_t 00688 epsilon() _GLIBCXX_USE_NOEXCEPT { return 0; } 00689 00690 static _GLIBCXX_CONSTEXPR wchar_t 00691 round_error() _GLIBCXX_USE_NOEXCEPT { return 0; } 00692 00693 static _GLIBCXX_USE_CONSTEXPR int min_exponent = 0; 00694 static _GLIBCXX_USE_CONSTEXPR int min_exponent10 = 0; 00695 static _GLIBCXX_USE_CONSTEXPR int max_exponent = 0; 00696 static _GLIBCXX_USE_CONSTEXPR int max_exponent10 = 0; 00697 00698 static _GLIBCXX_USE_CONSTEXPR bool has_infinity = false; 00699 static _GLIBCXX_USE_CONSTEXPR bool has_quiet_NaN = false; 00700 static _GLIBCXX_USE_CONSTEXPR bool has_signaling_NaN = false; 00701 static _GLIBCXX_USE_CONSTEXPR float_denorm_style has_denorm 00702 = denorm_absent; 00703 static _GLIBCXX_USE_CONSTEXPR bool has_denorm_loss = false; 00704 00705 static _GLIBCXX_CONSTEXPR wchar_t 00706 infinity() _GLIBCXX_USE_NOEXCEPT { return wchar_t(); } 00707 00708 static _GLIBCXX_CONSTEXPR wchar_t 00709 quiet_NaN() _GLIBCXX_USE_NOEXCEPT { return wchar_t(); } 00710 00711 static _GLIBCXX_CONSTEXPR wchar_t 00712 signaling_NaN() _GLIBCXX_USE_NOEXCEPT { return wchar_t(); } 00713 00714 static _GLIBCXX_CONSTEXPR wchar_t 00715 denorm_min() _GLIBCXX_USE_NOEXCEPT { return wchar_t(); } 00716 00717 static _GLIBCXX_USE_CONSTEXPR bool is_iec559 = false; 00718 static _GLIBCXX_USE_CONSTEXPR bool is_bounded = true; 00719 static _GLIBCXX_USE_CONSTEXPR bool is_modulo = !is_signed; 00720 00721 static _GLIBCXX_USE_CONSTEXPR bool traps = __glibcxx_integral_traps; 00722 static _GLIBCXX_USE_CONSTEXPR bool tinyness_before = false; 00723 static _GLIBCXX_USE_CONSTEXPR float_round_style round_style 00724 = round_toward_zero; 00725 }; 00726 00727 #if __cplusplus >= 201103L 00728 /// numeric_limits<char16_t> specialization. 00729 template<> 00730 struct numeric_limits<char16_t> 00731 { 00732 static constexpr bool is_specialized = true; 00733 00734 static constexpr char16_t 00735 min() noexcept { return __glibcxx_min (char16_t); } 00736 00737 static constexpr char16_t 00738 max() noexcept { return __glibcxx_max (char16_t); } 00739 00740 static constexpr char16_t 00741 lowest() noexcept { return min(); } 00742 00743 static constexpr int digits = __glibcxx_digits (char16_t); 00744 static constexpr int digits10 = __glibcxx_digits10 (char16_t); 00745 static constexpr int max_digits10 = 0; 00746 static constexpr bool is_signed = __glibcxx_signed (char16_t); 00747 static constexpr bool is_integer = true; 00748 static constexpr bool is_exact = true; 00749 static constexpr int radix = 2; 00750 00751 static constexpr char16_t 00752 epsilon() noexcept { return 0; } 00753 00754 static constexpr char16_t 00755 round_error() noexcept { return 0; } 00756 00757 static constexpr int min_exponent = 0; 00758 static constexpr int min_exponent10 = 0; 00759 static constexpr int max_exponent = 0; 00760 static constexpr int max_exponent10 = 0; 00761 00762 static constexpr bool has_infinity = false; 00763 static constexpr bool has_quiet_NaN = false; 00764 static constexpr bool has_signaling_NaN = false; 00765 static constexpr float_denorm_style has_denorm = denorm_absent; 00766 static constexpr bool has_denorm_loss = false; 00767 00768 static constexpr char16_t 00769 infinity() noexcept { return char16_t(); } 00770 00771 static constexpr char16_t 00772 quiet_NaN() noexcept { return char16_t(); } 00773 00774 static constexpr char16_t 00775 signaling_NaN() noexcept { return char16_t(); } 00776 00777 static constexpr char16_t 00778 denorm_min() noexcept { return char16_t(); } 00779 00780 static constexpr bool is_iec559 = false; 00781 static constexpr bool is_bounded = true; 00782 static constexpr bool is_modulo = !is_signed; 00783 00784 static constexpr bool traps = __glibcxx_integral_traps; 00785 static constexpr bool tinyness_before = false; 00786 static constexpr float_round_style round_style = round_toward_zero; 00787 }; 00788 00789 /// numeric_limits<char32_t> specialization. 00790 template<> 00791 struct numeric_limits<char32_t> 00792 { 00793 static constexpr bool is_specialized = true; 00794 00795 static constexpr char32_t 00796 min() noexcept { return __glibcxx_min (char32_t); } 00797 00798 static constexpr char32_t 00799 max() noexcept { return __glibcxx_max (char32_t); } 00800 00801 static constexpr char32_t 00802 lowest() noexcept { return min(); } 00803 00804 static constexpr int digits = __glibcxx_digits (char32_t); 00805 static constexpr int digits10 = __glibcxx_digits10 (char32_t); 00806 static constexpr int max_digits10 = 0; 00807 static constexpr bool is_signed = __glibcxx_signed (char32_t); 00808 static constexpr bool is_integer = true; 00809 static constexpr bool is_exact = true; 00810 static constexpr int radix = 2; 00811 00812 static constexpr char32_t 00813 epsilon() noexcept { return 0; } 00814 00815 static constexpr char32_t 00816 round_error() noexcept { return 0; } 00817 00818 static constexpr int min_exponent = 0; 00819 static constexpr int min_exponent10 = 0; 00820 static constexpr int max_exponent = 0; 00821 static constexpr int max_exponent10 = 0; 00822 00823 static constexpr bool has_infinity = false; 00824 static constexpr bool has_quiet_NaN = false; 00825 static constexpr bool has_signaling_NaN = false; 00826 static constexpr float_denorm_style has_denorm = denorm_absent; 00827 static constexpr bool has_denorm_loss = false; 00828 00829 static constexpr char32_t 00830 infinity() noexcept { return char32_t(); } 00831 00832 static constexpr char32_t 00833 quiet_NaN() noexcept { return char32_t(); } 00834 00835 static constexpr char32_t 00836 signaling_NaN() noexcept { return char32_t(); } 00837 00838 static constexpr char32_t 00839 denorm_min() noexcept { return char32_t(); } 00840 00841 static constexpr bool is_iec559 = false; 00842 static constexpr bool is_bounded = true; 00843 static constexpr bool is_modulo = !is_signed; 00844 00845 static constexpr bool traps = __glibcxx_integral_traps; 00846 static constexpr bool tinyness_before = false; 00847 static constexpr float_round_style round_style = round_toward_zero; 00848 }; 00849 #endif 00850 00851 /// numeric_limits<short> specialization. 00852 template<> 00853 struct numeric_limits<short> 00854 { 00855 static _GLIBCXX_USE_CONSTEXPR bool is_specialized = true; 00856 00857 static _GLIBCXX_CONSTEXPR short 00858 min() _GLIBCXX_USE_NOEXCEPT { return -__SHRT_MAX__ - 1; } 00859 00860 static _GLIBCXX_CONSTEXPR short 00861 max() _GLIBCXX_USE_NOEXCEPT { return __SHRT_MAX__; } 00862 00863 #if __cplusplus >= 201103L 00864 static constexpr short 00865 lowest() noexcept { return min(); } 00866 #endif 00867 00868 static _GLIBCXX_USE_CONSTEXPR int digits = __glibcxx_digits (short); 00869 static _GLIBCXX_USE_CONSTEXPR int digits10 = __glibcxx_digits10 (short); 00870 #if __cplusplus >= 201103L 00871 static constexpr int max_digits10 = 0; 00872 #endif 00873 static _GLIBCXX_USE_CONSTEXPR bool is_signed = true; 00874 static _GLIBCXX_USE_CONSTEXPR bool is_integer = true; 00875 static _GLIBCXX_USE_CONSTEXPR bool is_exact = true; 00876 static _GLIBCXX_USE_CONSTEXPR int radix = 2; 00877 00878 static _GLIBCXX_CONSTEXPR short 00879 epsilon() _GLIBCXX_USE_NOEXCEPT { return 0; } 00880 00881 static _GLIBCXX_CONSTEXPR short 00882 round_error() _GLIBCXX_USE_NOEXCEPT { return 0; } 00883 00884 static _GLIBCXX_USE_CONSTEXPR int min_exponent = 0; 00885 static _GLIBCXX_USE_CONSTEXPR int min_exponent10 = 0; 00886 static _GLIBCXX_USE_CONSTEXPR int max_exponent = 0; 00887 static _GLIBCXX_USE_CONSTEXPR int max_exponent10 = 0; 00888 00889 static _GLIBCXX_USE_CONSTEXPR bool has_infinity = false; 00890 static _GLIBCXX_USE_CONSTEXPR bool has_quiet_NaN = false; 00891 static _GLIBCXX_USE_CONSTEXPR bool has_signaling_NaN = false; 00892 static _GLIBCXX_USE_CONSTEXPR float_denorm_style has_denorm 00893 = denorm_absent; 00894 static _GLIBCXX_USE_CONSTEXPR bool has_denorm_loss = false; 00895 00896 static _GLIBCXX_CONSTEXPR short 00897 infinity() _GLIBCXX_USE_NOEXCEPT { return short(); } 00898 00899 static _GLIBCXX_CONSTEXPR short 00900 quiet_NaN() _GLIBCXX_USE_NOEXCEPT { return short(); } 00901 00902 static _GLIBCXX_CONSTEXPR short 00903 signaling_NaN() _GLIBCXX_USE_NOEXCEPT { return short(); } 00904 00905 static _GLIBCXX_CONSTEXPR short 00906 denorm_min() _GLIBCXX_USE_NOEXCEPT { return short(); } 00907 00908 static _GLIBCXX_USE_CONSTEXPR bool is_iec559 = false; 00909 static _GLIBCXX_USE_CONSTEXPR bool is_bounded = true; 00910 static _GLIBCXX_USE_CONSTEXPR bool is_modulo = false; 00911 00912 static _GLIBCXX_USE_CONSTEXPR bool traps = __glibcxx_integral_traps; 00913 static _GLIBCXX_USE_CONSTEXPR bool tinyness_before = false; 00914 static _GLIBCXX_USE_CONSTEXPR float_round_style round_style 00915 = round_toward_zero; 00916 }; 00917 00918 /// numeric_limits<unsigned short> specialization. 00919 template<> 00920 struct numeric_limits<unsigned short> 00921 { 00922 static _GLIBCXX_USE_CONSTEXPR bool is_specialized = true; 00923 00924 static _GLIBCXX_CONSTEXPR unsigned short 00925 min() _GLIBCXX_USE_NOEXCEPT { return 0; } 00926 00927 static _GLIBCXX_CONSTEXPR unsigned short 00928 max() _GLIBCXX_USE_NOEXCEPT { return __SHRT_MAX__ * 2U + 1; } 00929 00930 #if __cplusplus >= 201103L 00931 static constexpr unsigned short 00932 lowest() noexcept { return min(); } 00933 #endif 00934 00935 static _GLIBCXX_USE_CONSTEXPR int digits 00936 = __glibcxx_digits (unsigned short); 00937 static _GLIBCXX_USE_CONSTEXPR int digits10 00938 = __glibcxx_digits10 (unsigned short); 00939 #if __cplusplus >= 201103L 00940 static constexpr int max_digits10 = 0; 00941 #endif 00942 static _GLIBCXX_USE_CONSTEXPR bool is_signed = false; 00943 static _GLIBCXX_USE_CONSTEXPR bool is_integer = true; 00944 static _GLIBCXX_USE_CONSTEXPR bool is_exact = true; 00945 static _GLIBCXX_USE_CONSTEXPR int radix = 2; 00946 00947 static _GLIBCXX_CONSTEXPR unsigned short 00948 epsilon() _GLIBCXX_USE_NOEXCEPT { return 0; } 00949 00950 static _GLIBCXX_CONSTEXPR unsigned short 00951 round_error() _GLIBCXX_USE_NOEXCEPT { return 0; } 00952 00953 static _GLIBCXX_USE_CONSTEXPR int min_exponent = 0; 00954 static _GLIBCXX_USE_CONSTEXPR int min_exponent10 = 0; 00955 static _GLIBCXX_USE_CONSTEXPR int max_exponent = 0; 00956 static _GLIBCXX_USE_CONSTEXPR int max_exponent10 = 0; 00957 00958 static _GLIBCXX_USE_CONSTEXPR bool has_infinity = false; 00959 static _GLIBCXX_USE_CONSTEXPR bool has_quiet_NaN = false; 00960 static _GLIBCXX_USE_CONSTEXPR bool has_signaling_NaN = false; 00961 static _GLIBCXX_USE_CONSTEXPR float_denorm_style has_denorm 00962 = denorm_absent; 00963 static _GLIBCXX_USE_CONSTEXPR bool has_denorm_loss = false; 00964 00965 static _GLIBCXX_CONSTEXPR unsigned short 00966 infinity() _GLIBCXX_USE_NOEXCEPT 00967 { return static_cast<unsigned short>(0); } 00968 00969 static _GLIBCXX_CONSTEXPR unsigned short 00970 quiet_NaN() _GLIBCXX_USE_NOEXCEPT 00971 { return static_cast<unsigned short>(0); } 00972 00973 static _GLIBCXX_CONSTEXPR unsigned short 00974 signaling_NaN() _GLIBCXX_USE_NOEXCEPT 00975 { return static_cast<unsigned short>(0); } 00976 00977 static _GLIBCXX_CONSTEXPR unsigned short 00978 denorm_min() _GLIBCXX_USE_NOEXCEPT 00979 { return static_cast<unsigned short>(0); } 00980 00981 static _GLIBCXX_USE_CONSTEXPR bool is_iec559 = false; 00982 static _GLIBCXX_USE_CONSTEXPR bool is_bounded = true; 00983 static _GLIBCXX_USE_CONSTEXPR bool is_modulo = true; 00984 00985 static _GLIBCXX_USE_CONSTEXPR bool traps = __glibcxx_integral_traps; 00986 static _GLIBCXX_USE_CONSTEXPR bool tinyness_before = false; 00987 static _GLIBCXX_USE_CONSTEXPR float_round_style round_style 00988 = round_toward_zero; 00989 }; 00990 00991 /// numeric_limits<int> specialization. 00992 template<> 00993 struct numeric_limits<int> 00994 { 00995 static _GLIBCXX_USE_CONSTEXPR bool is_specialized = true; 00996 00997 static _GLIBCXX_CONSTEXPR int 00998 min() _GLIBCXX_USE_NOEXCEPT { return -__INT_MAX__ - 1; } 00999 01000 static _GLIBCXX_CONSTEXPR int 01001 max() _GLIBCXX_USE_NOEXCEPT { return __INT_MAX__; } 01002 01003 #if __cplusplus >= 201103L 01004 static constexpr int 01005 lowest() noexcept { return min(); } 01006 #endif 01007 01008 static _GLIBCXX_USE_CONSTEXPR int digits = __glibcxx_digits (int); 01009 static _GLIBCXX_USE_CONSTEXPR int digits10 = __glibcxx_digits10 (int); 01010 #if __cplusplus >= 201103L 01011 static constexpr int max_digits10 = 0; 01012 #endif 01013 static _GLIBCXX_USE_CONSTEXPR bool is_signed = true; 01014 static _GLIBCXX_USE_CONSTEXPR bool is_integer = true; 01015 static _GLIBCXX_USE_CONSTEXPR bool is_exact = true; 01016 static _GLIBCXX_USE_CONSTEXPR int radix = 2; 01017 01018 static _GLIBCXX_CONSTEXPR int 01019 epsilon() _GLIBCXX_USE_NOEXCEPT { return 0; } 01020 01021 static _GLIBCXX_CONSTEXPR int 01022 round_error() _GLIBCXX_USE_NOEXCEPT { return 0; } 01023 01024 static _GLIBCXX_USE_CONSTEXPR int min_exponent = 0; 01025 static _GLIBCXX_USE_CONSTEXPR int min_exponent10 = 0; 01026 static _GLIBCXX_USE_CONSTEXPR int max_exponent = 0; 01027 static _GLIBCXX_USE_CONSTEXPR int max_exponent10 = 0; 01028 01029 static _GLIBCXX_USE_CONSTEXPR bool has_infinity = false; 01030 static _GLIBCXX_USE_CONSTEXPR bool has_quiet_NaN = false; 01031 static _GLIBCXX_USE_CONSTEXPR bool has_signaling_NaN = false; 01032 static _GLIBCXX_USE_CONSTEXPR float_denorm_style has_denorm 01033 = denorm_absent; 01034 static _GLIBCXX_USE_CONSTEXPR bool has_denorm_loss = false; 01035 01036 static _GLIBCXX_CONSTEXPR int 01037 infinity() _GLIBCXX_USE_NOEXCEPT { return static_cast<int>(0); } 01038 01039 static _GLIBCXX_CONSTEXPR int 01040 quiet_NaN() _GLIBCXX_USE_NOEXCEPT { return static_cast<int>(0); } 01041 01042 static _GLIBCXX_CONSTEXPR int 01043 signaling_NaN() _GLIBCXX_USE_NOEXCEPT { return static_cast<int>(0); } 01044 01045 static _GLIBCXX_CONSTEXPR int 01046 denorm_min() _GLIBCXX_USE_NOEXCEPT { return static_cast<int>(0); } 01047 01048 static _GLIBCXX_USE_CONSTEXPR bool is_iec559 = false; 01049 static _GLIBCXX_USE_CONSTEXPR bool is_bounded = true; 01050 static _GLIBCXX_USE_CONSTEXPR bool is_modulo = false; 01051 01052 static _GLIBCXX_USE_CONSTEXPR bool traps = __glibcxx_integral_traps; 01053 static _GLIBCXX_USE_CONSTEXPR bool tinyness_before = false; 01054 static _GLIBCXX_USE_CONSTEXPR float_round_style round_style 01055 = round_toward_zero; 01056 }; 01057 01058 /// numeric_limits<unsigned int> specialization. 01059 template<> 01060 struct numeric_limits<unsigned int> 01061 { 01062 static _GLIBCXX_USE_CONSTEXPR bool is_specialized = true; 01063 01064 static _GLIBCXX_CONSTEXPR unsigned int 01065 min() _GLIBCXX_USE_NOEXCEPT { return 0; } 01066 01067 static _GLIBCXX_CONSTEXPR unsigned int 01068 max() _GLIBCXX_USE_NOEXCEPT { return __INT_MAX__ * 2U + 1; } 01069 01070 #if __cplusplus >= 201103L 01071 static constexpr unsigned int 01072 lowest() noexcept { return min(); } 01073 #endif 01074 01075 static _GLIBCXX_USE_CONSTEXPR int digits 01076 = __glibcxx_digits (unsigned int); 01077 static _GLIBCXX_USE_CONSTEXPR int digits10 01078 = __glibcxx_digits10 (unsigned int); 01079 #if __cplusplus >= 201103L 01080 static constexpr int max_digits10 = 0; 01081 #endif 01082 static _GLIBCXX_USE_CONSTEXPR bool is_signed = false; 01083 static _GLIBCXX_USE_CONSTEXPR bool is_integer = true; 01084 static _GLIBCXX_USE_CONSTEXPR bool is_exact = true; 01085 static _GLIBCXX_USE_CONSTEXPR int radix = 2; 01086 01087 static _GLIBCXX_CONSTEXPR unsigned int 01088 epsilon() _GLIBCXX_USE_NOEXCEPT { return 0; } 01089 01090 static _GLIBCXX_CONSTEXPR unsigned int 01091 round_error() _GLIBCXX_USE_NOEXCEPT { return 0; } 01092 01093 static _GLIBCXX_USE_CONSTEXPR int min_exponent = 0; 01094 static _GLIBCXX_USE_CONSTEXPR int min_exponent10 = 0; 01095 static _GLIBCXX_USE_CONSTEXPR int max_exponent = 0; 01096 static _GLIBCXX_USE_CONSTEXPR int max_exponent10 = 0; 01097 01098 static _GLIBCXX_USE_CONSTEXPR bool has_infinity = false; 01099 static _GLIBCXX_USE_CONSTEXPR bool has_quiet_NaN = false; 01100 static _GLIBCXX_USE_CONSTEXPR bool has_signaling_NaN = false; 01101 static _GLIBCXX_USE_CONSTEXPR float_denorm_style has_denorm 01102 = denorm_absent; 01103 static _GLIBCXX_USE_CONSTEXPR bool has_denorm_loss = false; 01104 01105 static _GLIBCXX_CONSTEXPR unsigned int 01106 infinity() _GLIBCXX_USE_NOEXCEPT { return static_cast<unsigned int>(0); } 01107 01108 static _GLIBCXX_CONSTEXPR unsigned int 01109 quiet_NaN() _GLIBCXX_USE_NOEXCEPT 01110 { return static_cast<unsigned int>(0); } 01111 01112 static _GLIBCXX_CONSTEXPR unsigned int 01113 signaling_NaN() _GLIBCXX_USE_NOEXCEPT 01114 { return static_cast<unsigned int>(0); } 01115 01116 static _GLIBCXX_CONSTEXPR unsigned int 01117 denorm_min() _GLIBCXX_USE_NOEXCEPT 01118 { return static_cast<unsigned int>(0); } 01119 01120 static _GLIBCXX_USE_CONSTEXPR bool is_iec559 = false; 01121 static _GLIBCXX_USE_CONSTEXPR bool is_bounded = true; 01122 static _GLIBCXX_USE_CONSTEXPR bool is_modulo = true; 01123 01124 static _GLIBCXX_USE_CONSTEXPR bool traps = __glibcxx_integral_traps; 01125 static _GLIBCXX_USE_CONSTEXPR bool tinyness_before = false; 01126 static _GLIBCXX_USE_CONSTEXPR float_round_style round_style 01127 = round_toward_zero; 01128 }; 01129 01130 /// numeric_limits<long> specialization. 01131 template<> 01132 struct numeric_limits<long> 01133 { 01134 static _GLIBCXX_USE_CONSTEXPR bool is_specialized = true; 01135 01136 static _GLIBCXX_CONSTEXPR long 01137 min() _GLIBCXX_USE_NOEXCEPT { return -__LONG_MAX__ - 1; } 01138 01139 static _GLIBCXX_CONSTEXPR long 01140 max() _GLIBCXX_USE_NOEXCEPT { return __LONG_MAX__; } 01141 01142 #if __cplusplus >= 201103L 01143 static constexpr long 01144 lowest() noexcept { return min(); } 01145 #endif 01146 01147 static _GLIBCXX_USE_CONSTEXPR int digits = __glibcxx_digits (long); 01148 static _GLIBCXX_USE_CONSTEXPR int digits10 = __glibcxx_digits10 (long); 01149 #if __cplusplus >= 201103L 01150 static constexpr int max_digits10 = 0; 01151 #endif 01152 static _GLIBCXX_USE_CONSTEXPR bool is_signed = true; 01153 static _GLIBCXX_USE_CONSTEXPR bool is_integer = true; 01154 static _GLIBCXX_USE_CONSTEXPR bool is_exact = true; 01155 static _GLIBCXX_USE_CONSTEXPR int radix = 2; 01156 01157 static _GLIBCXX_CONSTEXPR long 01158 epsilon() _GLIBCXX_USE_NOEXCEPT { return 0; } 01159 01160 static _GLIBCXX_CONSTEXPR long 01161 round_error() _GLIBCXX_USE_NOEXCEPT { return 0; } 01162 01163 static _GLIBCXX_USE_CONSTEXPR int min_exponent = 0; 01164 static _GLIBCXX_USE_CONSTEXPR int min_exponent10 = 0; 01165 static _GLIBCXX_USE_CONSTEXPR int max_exponent = 0; 01166 static _GLIBCXX_USE_CONSTEXPR int max_exponent10 = 0; 01167 01168 static _GLIBCXX_USE_CONSTEXPR bool has_infinity = false; 01169 static _GLIBCXX_USE_CONSTEXPR bool has_quiet_NaN = false; 01170 static _GLIBCXX_USE_CONSTEXPR bool has_signaling_NaN = false; 01171 static _GLIBCXX_USE_CONSTEXPR float_denorm_style has_denorm 01172 = denorm_absent; 01173 static _GLIBCXX_USE_CONSTEXPR bool has_denorm_loss = false; 01174 01175 static _GLIBCXX_CONSTEXPR long 01176 infinity() _GLIBCXX_USE_NOEXCEPT { return static_cast<long>(0); } 01177 01178 static _GLIBCXX_CONSTEXPR long 01179 quiet_NaN() _GLIBCXX_USE_NOEXCEPT { return static_cast<long>(0); } 01180 01181 static _GLIBCXX_CONSTEXPR long 01182 signaling_NaN() _GLIBCXX_USE_NOEXCEPT { return static_cast<long>(0); } 01183 01184 static _GLIBCXX_CONSTEXPR long 01185 denorm_min() _GLIBCXX_USE_NOEXCEPT { return static_cast<long>(0); } 01186 01187 static _GLIBCXX_USE_CONSTEXPR bool is_iec559 = false; 01188 static _GLIBCXX_USE_CONSTEXPR bool is_bounded = true; 01189 static _GLIBCXX_USE_CONSTEXPR bool is_modulo = false; 01190 01191 static _GLIBCXX_USE_CONSTEXPR bool traps = __glibcxx_integral_traps; 01192 static _GLIBCXX_USE_CONSTEXPR bool tinyness_before = false; 01193 static _GLIBCXX_USE_CONSTEXPR float_round_style round_style 01194 = round_toward_zero; 01195 }; 01196 01197 /// numeric_limits<unsigned long> specialization. 01198 template<> 01199 struct numeric_limits<unsigned long> 01200 { 01201 static _GLIBCXX_USE_CONSTEXPR bool is_specialized = true; 01202 01203 static _GLIBCXX_CONSTEXPR unsigned long 01204 min() _GLIBCXX_USE_NOEXCEPT { return 0; } 01205 01206 static _GLIBCXX_CONSTEXPR unsigned long 01207 max() _GLIBCXX_USE_NOEXCEPT { return __LONG_MAX__ * 2UL + 1; } 01208 01209 #if __cplusplus >= 201103L 01210 static constexpr unsigned long 01211 lowest() noexcept { return min(); } 01212 #endif 01213 01214 static _GLIBCXX_USE_CONSTEXPR int digits 01215 = __glibcxx_digits (unsigned long); 01216 static _GLIBCXX_USE_CONSTEXPR int digits10 01217 = __glibcxx_digits10 (unsigned long); 01218 #if __cplusplus >= 201103L 01219 static constexpr int max_digits10 = 0; 01220 #endif 01221 static _GLIBCXX_USE_CONSTEXPR bool is_signed = false; 01222 static _GLIBCXX_USE_CONSTEXPR bool is_integer = true; 01223 static _GLIBCXX_USE_CONSTEXPR bool is_exact = true; 01224 static _GLIBCXX_USE_CONSTEXPR int radix = 2; 01225 01226 static _GLIBCXX_CONSTEXPR unsigned long 01227 epsilon() _GLIBCXX_USE_NOEXCEPT { return 0; } 01228 01229 static _GLIBCXX_CONSTEXPR unsigned long 01230 round_error() _GLIBCXX_USE_NOEXCEPT { return 0; } 01231 01232 static _GLIBCXX_USE_CONSTEXPR int min_exponent = 0; 01233 static _GLIBCXX_USE_CONSTEXPR int min_exponent10 = 0; 01234 static _GLIBCXX_USE_CONSTEXPR int max_exponent = 0; 01235 static _GLIBCXX_USE_CONSTEXPR int max_exponent10 = 0; 01236 01237 static _GLIBCXX_USE_CONSTEXPR bool has_infinity = false; 01238 static _GLIBCXX_USE_CONSTEXPR bool has_quiet_NaN = false; 01239 static _GLIBCXX_USE_CONSTEXPR bool has_signaling_NaN = false; 01240 static _GLIBCXX_USE_CONSTEXPR float_denorm_style has_denorm 01241 = denorm_absent; 01242 static _GLIBCXX_USE_CONSTEXPR bool has_denorm_loss = false; 01243 01244 static _GLIBCXX_CONSTEXPR unsigned long 01245 infinity() _GLIBCXX_USE_NOEXCEPT 01246 { return static_cast<unsigned long>(0); } 01247 01248 static _GLIBCXX_CONSTEXPR unsigned long 01249 quiet_NaN() _GLIBCXX_USE_NOEXCEPT 01250 { return static_cast<unsigned long>(0); } 01251 01252 static _GLIBCXX_CONSTEXPR unsigned long 01253 signaling_NaN() _GLIBCXX_USE_NOEXCEPT 01254 { return static_cast<unsigned long>(0); } 01255 01256 static _GLIBCXX_CONSTEXPR unsigned long 01257 denorm_min() _GLIBCXX_USE_NOEXCEPT 01258 { return static_cast<unsigned long>(0); } 01259 01260 static _GLIBCXX_USE_CONSTEXPR bool is_iec559 = false; 01261 static _GLIBCXX_USE_CONSTEXPR bool is_bounded = true; 01262 static _GLIBCXX_USE_CONSTEXPR bool is_modulo = true; 01263 01264 static _GLIBCXX_USE_CONSTEXPR bool traps = __glibcxx_integral_traps; 01265 static _GLIBCXX_USE_CONSTEXPR bool tinyness_before = false; 01266 static _GLIBCXX_USE_CONSTEXPR float_round_style round_style 01267 = round_toward_zero; 01268 }; 01269 01270 /// numeric_limits<long long> specialization. 01271 template<> 01272 struct numeric_limits<long long> 01273 { 01274 static _GLIBCXX_USE_CONSTEXPR bool is_specialized = true; 01275 01276 static _GLIBCXX_CONSTEXPR long long 01277 min() _GLIBCXX_USE_NOEXCEPT { return -__LONG_LONG_MAX__ - 1; } 01278 01279 static _GLIBCXX_CONSTEXPR long long 01280 max() _GLIBCXX_USE_NOEXCEPT { return __LONG_LONG_MAX__; } 01281 01282 #if __cplusplus >= 201103L 01283 static constexpr long long 01284 lowest() noexcept { return min(); } 01285 #endif 01286 01287 static _GLIBCXX_USE_CONSTEXPR int digits 01288 = __glibcxx_digits (long long); 01289 static _GLIBCXX_USE_CONSTEXPR int digits10 01290 = __glibcxx_digits10 (long long); 01291 #if __cplusplus >= 201103L 01292 static constexpr int max_digits10 = 0; 01293 #endif 01294 static _GLIBCXX_USE_CONSTEXPR bool is_signed = true; 01295 static _GLIBCXX_USE_CONSTEXPR bool is_integer = true; 01296 static _GLIBCXX_USE_CONSTEXPR bool is_exact = true; 01297 static _GLIBCXX_USE_CONSTEXPR int radix = 2; 01298 01299 static _GLIBCXX_CONSTEXPR long long 01300 epsilon() _GLIBCXX_USE_NOEXCEPT { return 0; } 01301 01302 static _GLIBCXX_CONSTEXPR long long 01303 round_error() _GLIBCXX_USE_NOEXCEPT { return 0; } 01304 01305 static _GLIBCXX_USE_CONSTEXPR int min_exponent = 0; 01306 static _GLIBCXX_USE_CONSTEXPR int min_exponent10 = 0; 01307 static _GLIBCXX_USE_CONSTEXPR int max_exponent = 0; 01308 static _GLIBCXX_USE_CONSTEXPR int max_exponent10 = 0; 01309 01310 static _GLIBCXX_USE_CONSTEXPR bool has_infinity = false; 01311 static _GLIBCXX_USE_CONSTEXPR bool has_quiet_NaN = false; 01312 static _GLIBCXX_USE_CONSTEXPR bool has_signaling_NaN = false; 01313 static _GLIBCXX_USE_CONSTEXPR float_denorm_style has_denorm 01314 = denorm_absent; 01315 static _GLIBCXX_USE_CONSTEXPR bool has_denorm_loss = false; 01316 01317 static _GLIBCXX_CONSTEXPR long long 01318 infinity() _GLIBCXX_USE_NOEXCEPT { return static_cast<long long>(0); } 01319 01320 static _GLIBCXX_CONSTEXPR long long 01321 quiet_NaN() _GLIBCXX_USE_NOEXCEPT { return static_cast<long long>(0); } 01322 01323 static _GLIBCXX_CONSTEXPR long long 01324 signaling_NaN() _GLIBCXX_USE_NOEXCEPT 01325 { return static_cast<long long>(0); } 01326 01327 static _GLIBCXX_CONSTEXPR long long 01328 denorm_min() _GLIBCXX_USE_NOEXCEPT { return static_cast<long long>(0); } 01329 01330 static _GLIBCXX_USE_CONSTEXPR bool is_iec559 = false; 01331 static _GLIBCXX_USE_CONSTEXPR bool is_bounded = true; 01332 static _GLIBCXX_USE_CONSTEXPR bool is_modulo = false; 01333 01334 static _GLIBCXX_USE_CONSTEXPR bool traps = __glibcxx_integral_traps; 01335 static _GLIBCXX_USE_CONSTEXPR bool tinyness_before = false; 01336 static _GLIBCXX_USE_CONSTEXPR float_round_style round_style 01337 = round_toward_zero; 01338 }; 01339 01340 /// numeric_limits<unsigned long long> specialization. 01341 template<> 01342 struct numeric_limits<unsigned long long> 01343 { 01344 static _GLIBCXX_USE_CONSTEXPR bool is_specialized = true; 01345 01346 static _GLIBCXX_CONSTEXPR unsigned long long 01347 min() _GLIBCXX_USE_NOEXCEPT { return 0; } 01348 01349 static _GLIBCXX_CONSTEXPR unsigned long long 01350 max() _GLIBCXX_USE_NOEXCEPT { return __LONG_LONG_MAX__ * 2ULL + 1; } 01351 01352 #if __cplusplus >= 201103L 01353 static constexpr unsigned long long 01354 lowest() noexcept { return min(); } 01355 #endif 01356 01357 static _GLIBCXX_USE_CONSTEXPR int digits 01358 = __glibcxx_digits (unsigned long long); 01359 static _GLIBCXX_USE_CONSTEXPR int digits10 01360 = __glibcxx_digits10 (unsigned long long); 01361 #if __cplusplus >= 201103L 01362 static constexpr int max_digits10 = 0; 01363 #endif 01364 static _GLIBCXX_USE_CONSTEXPR bool is_signed = false; 01365 static _GLIBCXX_USE_CONSTEXPR bool is_integer = true; 01366 static _GLIBCXX_USE_CONSTEXPR bool is_exact = true; 01367 static _GLIBCXX_USE_CONSTEXPR int radix = 2; 01368 01369 static _GLIBCXX_CONSTEXPR unsigned long long 01370 epsilon() _GLIBCXX_USE_NOEXCEPT { return 0; } 01371 01372 static _GLIBCXX_CONSTEXPR unsigned long long 01373 round_error() _GLIBCXX_USE_NOEXCEPT { return 0; } 01374 01375 static _GLIBCXX_USE_CONSTEXPR int min_exponent = 0; 01376 static _GLIBCXX_USE_CONSTEXPR int min_exponent10 = 0; 01377 static _GLIBCXX_USE_CONSTEXPR int max_exponent = 0; 01378 static _GLIBCXX_USE_CONSTEXPR int max_exponent10 = 0; 01379 01380 static _GLIBCXX_USE_CONSTEXPR bool has_infinity = false; 01381 static _GLIBCXX_USE_CONSTEXPR bool has_quiet_NaN = false; 01382 static _GLIBCXX_USE_CONSTEXPR bool has_signaling_NaN = false; 01383 static _GLIBCXX_USE_CONSTEXPR float_denorm_style has_denorm 01384 = denorm_absent; 01385 static _GLIBCXX_USE_CONSTEXPR bool has_denorm_loss = false; 01386 01387 static _GLIBCXX_CONSTEXPR unsigned long long 01388 infinity() _GLIBCXX_USE_NOEXCEPT 01389 { return static_cast<unsigned long long>(0); } 01390 01391 static _GLIBCXX_CONSTEXPR unsigned long long 01392 quiet_NaN() _GLIBCXX_USE_NOEXCEPT 01393 { return static_cast<unsigned long long>(0); } 01394 01395 static _GLIBCXX_CONSTEXPR unsigned long long 01396 signaling_NaN() _GLIBCXX_USE_NOEXCEPT 01397 { return static_cast<unsigned long long>(0); } 01398 01399 static _GLIBCXX_CONSTEXPR unsigned long long 01400 denorm_min() _GLIBCXX_USE_NOEXCEPT 01401 { return static_cast<unsigned long long>(0); } 01402 01403 static _GLIBCXX_USE_CONSTEXPR bool is_iec559 = false; 01404 static _GLIBCXX_USE_CONSTEXPR bool is_bounded = true; 01405 static _GLIBCXX_USE_CONSTEXPR bool is_modulo = true; 01406 01407 static _GLIBCXX_USE_CONSTEXPR bool traps = __glibcxx_integral_traps; 01408 static _GLIBCXX_USE_CONSTEXPR bool tinyness_before = false; 01409 static _GLIBCXX_USE_CONSTEXPR float_round_style round_style 01410 = round_toward_zero; 01411 }; 01412 01413 #if !defined(__STRICT_ANSI__) 01414 01415 #define __INT_N(TYPE, BITSIZE, EXT, UEXT) \ 01416 template<> \ 01417 struct numeric_limits<TYPE> \ 01418 { \ 01419 static _GLIBCXX_USE_CONSTEXPR bool is_specialized = true; \ 01420 \ 01421 static _GLIBCXX_CONSTEXPR TYPE \ 01422 min() _GLIBCXX_USE_NOEXCEPT { return __glibcxx_min_b (TYPE, BITSIZE); } \ 01423 \ 01424 static _GLIBCXX_CONSTEXPR TYPE \ 01425 max() _GLIBCXX_USE_NOEXCEPT { return __glibcxx_max_b (TYPE, BITSIZE); } \ 01426 \ 01427 static _GLIBCXX_USE_CONSTEXPR int digits \ 01428 = BITSIZE - 1; \ 01429 static _GLIBCXX_USE_CONSTEXPR int digits10 \ 01430 = (BITSIZE - 1) * 643L / 2136; \ 01431 \ 01432 static _GLIBCXX_USE_CONSTEXPR bool is_signed = true; \ 01433 static _GLIBCXX_USE_CONSTEXPR bool is_integer = true; \ 01434 static _GLIBCXX_USE_CONSTEXPR bool is_exact = true; \ 01435 static _GLIBCXX_USE_CONSTEXPR int radix = 2; \ 01436 \ 01437 static _GLIBCXX_CONSTEXPR TYPE \ 01438 epsilon() _GLIBCXX_USE_NOEXCEPT { return 0; } \ 01439 \ 01440 static _GLIBCXX_CONSTEXPR TYPE \ 01441 round_error() _GLIBCXX_USE_NOEXCEPT { return 0; } \ 01442 \ 01443 EXT \ 01444 \ 01445 static _GLIBCXX_USE_CONSTEXPR int min_exponent = 0; \ 01446 static _GLIBCXX_USE_CONSTEXPR int min_exponent10 = 0; \ 01447 static _GLIBCXX_USE_CONSTEXPR int max_exponent = 0; \ 01448 static _GLIBCXX_USE_CONSTEXPR int max_exponent10 = 0; \ 01449 \ 01450 static _GLIBCXX_USE_CONSTEXPR bool has_infinity = false; \ 01451 static _GLIBCXX_USE_CONSTEXPR bool has_quiet_NaN = false; \ 01452 static _GLIBCXX_USE_CONSTEXPR bool has_signaling_NaN = false; \ 01453 static _GLIBCXX_USE_CONSTEXPR float_denorm_style has_denorm \ 01454 = denorm_absent; \ 01455 static _GLIBCXX_USE_CONSTEXPR bool has_denorm_loss = false; \ 01456 \ 01457 static _GLIBCXX_CONSTEXPR TYPE \ 01458 infinity() _GLIBCXX_USE_NOEXCEPT \ 01459 { return static_cast<TYPE>(0); } \ 01460 \ 01461 static _GLIBCXX_CONSTEXPR TYPE \ 01462 quiet_NaN() _GLIBCXX_USE_NOEXCEPT \ 01463 { return static_cast<TYPE>(0); } \ 01464 \ 01465 static _GLIBCXX_CONSTEXPR TYPE \ 01466 signaling_NaN() _GLIBCXX_USE_NOEXCEPT \ 01467 { return static_cast<TYPE>(0); } \ 01468 \ 01469 static _GLIBCXX_CONSTEXPR TYPE \ 01470 denorm_min() _GLIBCXX_USE_NOEXCEPT \ 01471 { return static_cast<TYPE>(0); } \ 01472 \ 01473 static _GLIBCXX_USE_CONSTEXPR bool is_iec559 = false; \ 01474 static _GLIBCXX_USE_CONSTEXPR bool is_bounded = true; \ 01475 static _GLIBCXX_USE_CONSTEXPR bool is_modulo = false; \ 01476 \ 01477 static _GLIBCXX_USE_CONSTEXPR bool traps \ 01478 = __glibcxx_integral_traps; \ 01479 static _GLIBCXX_USE_CONSTEXPR bool tinyness_before = false; \ 01480 static _GLIBCXX_USE_CONSTEXPR float_round_style round_style \ 01481 = round_toward_zero; \ 01482 }; \ 01483 \ 01484 template<> \ 01485 struct numeric_limits<unsigned TYPE> \ 01486 { \ 01487 static _GLIBCXX_USE_CONSTEXPR bool is_specialized = true; \ 01488 \ 01489 static _GLIBCXX_CONSTEXPR unsigned TYPE \ 01490 min() _GLIBCXX_USE_NOEXCEPT { return 0; } \ 01491 \ 01492 static _GLIBCXX_CONSTEXPR unsigned TYPE \ 01493 max() _GLIBCXX_USE_NOEXCEPT \ 01494 { return __glibcxx_max_b (unsigned TYPE, BITSIZE); } \ 01495 \ 01496 UEXT \ 01497 \ 01498 static _GLIBCXX_USE_CONSTEXPR int digits \ 01499 = BITSIZE; \ 01500 static _GLIBCXX_USE_CONSTEXPR int digits10 \ 01501 = BITSIZE * 643L / 2136; \ 01502 static _GLIBCXX_USE_CONSTEXPR bool is_signed = false; \ 01503 static _GLIBCXX_USE_CONSTEXPR bool is_integer = true; \ 01504 static _GLIBCXX_USE_CONSTEXPR bool is_exact = true; \ 01505 static _GLIBCXX_USE_CONSTEXPR int radix = 2; \ 01506 \ 01507 static _GLIBCXX_CONSTEXPR unsigned TYPE \ 01508 epsilon() _GLIBCXX_USE_NOEXCEPT { return 0; } \ 01509 \ 01510 static _GLIBCXX_CONSTEXPR unsigned TYPE \ 01511 round_error() _GLIBCXX_USE_NOEXCEPT { return 0; } \ 01512 \ 01513 static _GLIBCXX_USE_CONSTEXPR int min_exponent = 0; \ 01514 static _GLIBCXX_USE_CONSTEXPR int min_exponent10 = 0; \ 01515 static _GLIBCXX_USE_CONSTEXPR int max_exponent = 0; \ 01516 static _GLIBCXX_USE_CONSTEXPR int max_exponent10 = 0; \ 01517 \ 01518 static _GLIBCXX_USE_CONSTEXPR bool has_infinity = false; \ 01519 static _GLIBCXX_USE_CONSTEXPR bool has_quiet_NaN = false; \ 01520 static _GLIBCXX_USE_CONSTEXPR bool has_signaling_NaN = false; \ 01521 static _GLIBCXX_USE_CONSTEXPR float_denorm_style has_denorm \ 01522 = denorm_absent; \ 01523 static _GLIBCXX_USE_CONSTEXPR bool has_denorm_loss = false; \ 01524 \ 01525 static _GLIBCXX_CONSTEXPR unsigned TYPE \ 01526 infinity() _GLIBCXX_USE_NOEXCEPT \ 01527 { return static_cast<unsigned TYPE>(0); } \ 01528 \ 01529 static _GLIBCXX_CONSTEXPR unsigned TYPE \ 01530 quiet_NaN() _GLIBCXX_USE_NOEXCEPT \ 01531 { return static_cast<unsigned TYPE>(0); } \ 01532 \ 01533 static _GLIBCXX_CONSTEXPR unsigned TYPE \ 01534 signaling_NaN() _GLIBCXX_USE_NOEXCEPT \ 01535 { return static_cast<unsigned TYPE>(0); } \ 01536 \ 01537 static _GLIBCXX_CONSTEXPR unsigned TYPE \ 01538 denorm_min() _GLIBCXX_USE_NOEXCEPT \ 01539 { return static_cast<unsigned TYPE>(0); } \ 01540 \ 01541 static _GLIBCXX_USE_CONSTEXPR bool is_iec559 = false; \ 01542 static _GLIBCXX_USE_CONSTEXPR bool is_bounded = true; \ 01543 static _GLIBCXX_USE_CONSTEXPR bool is_modulo = true; \ 01544 \ 01545 static _GLIBCXX_USE_CONSTEXPR bool traps = __glibcxx_integral_traps; \ 01546 static _GLIBCXX_USE_CONSTEXPR bool tinyness_before = false; \ 01547 static _GLIBCXX_USE_CONSTEXPR float_round_style round_style \ 01548 = round_toward_zero; \ 01549 }; 01550 01551 #if __cplusplus >= 201103L 01552 01553 #define __INT_N_201103(TYPE) \ 01554 static constexpr TYPE \ 01555 lowest() noexcept { return min(); } \ 01556 static constexpr int max_digits10 = 0; 01557 01558 #define __INT_N_U201103(TYPE) \ 01559 static constexpr unsigned TYPE \ 01560 lowest() noexcept { return min(); } \ 01561 static constexpr int max_digits10 = 0; 01562 01563 #else 01564 #define __INT_N_201103(TYPE) 01565 #define __INT_N_U201103(TYPE) 01566 #endif 01567 01568 #ifdef __GLIBCXX_TYPE_INT_N_0 01569 __INT_N(__GLIBCXX_TYPE_INT_N_0, __GLIBCXX_BITSIZE_INT_N_0, 01570 __INT_N_201103 (__GLIBCXX_TYPE_INT_N_0), __INT_N_U201103 (__GLIBCXX_TYPE_INT_N_0)) 01571 #endif 01572 #ifdef __GLIBCXX_TYPE_INT_N_1 01573 __INT_N (__GLIBCXX_TYPE_INT_N_1, __GLIBCXX_BITSIZE_INT_N_1, 01574 __INT_N_201103 (__GLIBCXX_TYPE_INT_N_1), __INT_N_U201103 (__GLIBCXX_TYPE_INT_N_1)) 01575 #endif 01576 #ifdef __GLIBCXX_TYPE_INT_N_2 01577 __INT_N (__GLIBCXX_TYPE_INT_N_2, __GLIBCXX_BITSIZE_INT_N_2, 01578 __INT_N_201103 (__GLIBCXX_TYPE_INT_N_2), __INT_N_U201103 (__GLIBCXX_TYPE_INT_N_2)) 01579 #endif 01580 #ifdef __GLIBCXX_TYPE_INT_N_3 01581 __INT_N (__GLIBCXX_TYPE_INT_N_3, __GLIBCXX_BITSIZE_INT_N_3, 01582 __INT_N_201103 (__GLIBCXX_TYPE_INT_N_3), __INT_N_U201103 (__GLIBCXX_TYPE_INT_N_3)) 01583 #endif 01584 01585 #undef __INT_N 01586 #undef __INT_N_201103 01587 #undef __INT_N_U201103 01588 01589 #endif 01590 01591 /// numeric_limits<float> specialization. 01592 template<> 01593 struct numeric_limits<float> 01594 { 01595 static _GLIBCXX_USE_CONSTEXPR bool is_specialized = true; 01596 01597 static _GLIBCXX_CONSTEXPR float 01598 min() _GLIBCXX_USE_NOEXCEPT { return __FLT_MIN__; } 01599 01600 static _GLIBCXX_CONSTEXPR float 01601 max() _GLIBCXX_USE_NOEXCEPT { return __FLT_MAX__; } 01602 01603 #if __cplusplus >= 201103L 01604 static constexpr float 01605 lowest() noexcept { return -__FLT_MAX__; } 01606 #endif 01607 01608 static _GLIBCXX_USE_CONSTEXPR int digits = __FLT_MANT_DIG__; 01609 static _GLIBCXX_USE_CONSTEXPR int digits10 = __FLT_DIG__; 01610 #if __cplusplus >= 201103L 01611 static constexpr int max_digits10 01612 = __glibcxx_max_digits10 (__FLT_MANT_DIG__); 01613 #endif 01614 static _GLIBCXX_USE_CONSTEXPR bool is_signed = true; 01615 static _GLIBCXX_USE_CONSTEXPR bool is_integer = false; 01616 static _GLIBCXX_USE_CONSTEXPR bool is_exact = false; 01617 static _GLIBCXX_USE_CONSTEXPR int radix = __FLT_RADIX__; 01618 01619 static _GLIBCXX_CONSTEXPR float 01620 epsilon() _GLIBCXX_USE_NOEXCEPT { return __FLT_EPSILON__; } 01621 01622 static _GLIBCXX_CONSTEXPR float 01623 round_error() _GLIBCXX_USE_NOEXCEPT { return 0.5F; } 01624 01625 static _GLIBCXX_USE_CONSTEXPR int min_exponent = __FLT_MIN_EXP__; 01626 static _GLIBCXX_USE_CONSTEXPR int min_exponent10 = __FLT_MIN_10_EXP__; 01627 static _GLIBCXX_USE_CONSTEXPR int max_exponent = __FLT_MAX_EXP__; 01628 static _GLIBCXX_USE_CONSTEXPR int max_exponent10 = __FLT_MAX_10_EXP__; 01629 01630 static _GLIBCXX_USE_CONSTEXPR bool has_infinity = __FLT_HAS_INFINITY__; 01631 static _GLIBCXX_USE_CONSTEXPR bool has_quiet_NaN = __FLT_HAS_QUIET_NAN__; 01632 static _GLIBCXX_USE_CONSTEXPR bool has_signaling_NaN = has_quiet_NaN; 01633 static _GLIBCXX_USE_CONSTEXPR float_denorm_style has_denorm 01634 = bool(__FLT_HAS_DENORM__) ? denorm_present : denorm_absent; 01635 static _GLIBCXX_USE_CONSTEXPR bool has_denorm_loss 01636 = __glibcxx_float_has_denorm_loss; 01637 01638 static _GLIBCXX_CONSTEXPR float 01639 infinity() _GLIBCXX_USE_NOEXCEPT { return __builtin_huge_valf(); } 01640 01641 static _GLIBCXX_CONSTEXPR float 01642 quiet_NaN() _GLIBCXX_USE_NOEXCEPT { return __builtin_nanf(""); } 01643 01644 static _GLIBCXX_CONSTEXPR float 01645 signaling_NaN() _GLIBCXX_USE_NOEXCEPT { return __builtin_nansf(""); } 01646 01647 static _GLIBCXX_CONSTEXPR float 01648 denorm_min() _GLIBCXX_USE_NOEXCEPT { return __FLT_DENORM_MIN__; } 01649 01650 static _GLIBCXX_USE_CONSTEXPR bool is_iec559 01651 = has_infinity && has_quiet_NaN && has_denorm == denorm_present; 01652 static _GLIBCXX_USE_CONSTEXPR bool is_bounded = true; 01653 static _GLIBCXX_USE_CONSTEXPR bool is_modulo = false; 01654 01655 static _GLIBCXX_USE_CONSTEXPR bool traps = __glibcxx_float_traps; 01656 static _GLIBCXX_USE_CONSTEXPR bool tinyness_before 01657 = __glibcxx_float_tinyness_before; 01658 static _GLIBCXX_USE_CONSTEXPR float_round_style round_style 01659 = round_to_nearest; 01660 }; 01661 01662 #undef __glibcxx_float_has_denorm_loss 01663 #undef __glibcxx_float_traps 01664 #undef __glibcxx_float_tinyness_before 01665 01666 /// numeric_limits<double> specialization. 01667 template<> 01668 struct numeric_limits<double> 01669 { 01670 static _GLIBCXX_USE_CONSTEXPR bool is_specialized = true; 01671 01672 static _GLIBCXX_CONSTEXPR double 01673 min() _GLIBCXX_USE_NOEXCEPT { return __DBL_MIN__; } 01674 01675 static _GLIBCXX_CONSTEXPR double 01676 max() _GLIBCXX_USE_NOEXCEPT { return __DBL_MAX__; } 01677 01678 #if __cplusplus >= 201103L 01679 static constexpr double 01680 lowest() noexcept { return -__DBL_MAX__; } 01681 #endif 01682 01683 static _GLIBCXX_USE_CONSTEXPR int digits = __DBL_MANT_DIG__; 01684 static _GLIBCXX_USE_CONSTEXPR int digits10 = __DBL_DIG__; 01685 #if __cplusplus >= 201103L 01686 static constexpr int max_digits10 01687 = __glibcxx_max_digits10 (__DBL_MANT_DIG__); 01688 #endif 01689 static _GLIBCXX_USE_CONSTEXPR bool is_signed = true; 01690 static _GLIBCXX_USE_CONSTEXPR bool is_integer = false; 01691 static _GLIBCXX_USE_CONSTEXPR bool is_exact = false; 01692 static _GLIBCXX_USE_CONSTEXPR int radix = __FLT_RADIX__; 01693 01694 static _GLIBCXX_CONSTEXPR double 01695 epsilon() _GLIBCXX_USE_NOEXCEPT { return __DBL_EPSILON__; } 01696 01697 static _GLIBCXX_CONSTEXPR double 01698 round_error() _GLIBCXX_USE_NOEXCEPT { return 0.5; } 01699 01700 static _GLIBCXX_USE_CONSTEXPR int min_exponent = __DBL_MIN_EXP__; 01701 static _GLIBCXX_USE_CONSTEXPR int min_exponent10 = __DBL_MIN_10_EXP__; 01702 static _GLIBCXX_USE_CONSTEXPR int max_exponent = __DBL_MAX_EXP__; 01703 static _GLIBCXX_USE_CONSTEXPR int max_exponent10 = __DBL_MAX_10_EXP__; 01704 01705 static _GLIBCXX_USE_CONSTEXPR bool has_infinity = __DBL_HAS_INFINITY__; 01706 static _GLIBCXX_USE_CONSTEXPR bool has_quiet_NaN = __DBL_HAS_QUIET_NAN__; 01707 static _GLIBCXX_USE_CONSTEXPR bool has_signaling_NaN = has_quiet_NaN; 01708 static _GLIBCXX_USE_CONSTEXPR float_denorm_style has_denorm 01709 = bool(__DBL_HAS_DENORM__) ? denorm_present : denorm_absent; 01710 static _GLIBCXX_USE_CONSTEXPR bool has_denorm_loss 01711 = __glibcxx_double_has_denorm_loss; 01712 01713 static _GLIBCXX_CONSTEXPR double 01714 infinity() _GLIBCXX_USE_NOEXCEPT { return __builtin_huge_val(); } 01715 01716 static _GLIBCXX_CONSTEXPR double 01717 quiet_NaN() _GLIBCXX_USE_NOEXCEPT { return __builtin_nan(""); } 01718 01719 static _GLIBCXX_CONSTEXPR double 01720 signaling_NaN() _GLIBCXX_USE_NOEXCEPT { return __builtin_nans(""); } 01721 01722 static _GLIBCXX_CONSTEXPR double 01723 denorm_min() _GLIBCXX_USE_NOEXCEPT { return __DBL_DENORM_MIN__; } 01724 01725 static _GLIBCXX_USE_CONSTEXPR bool is_iec559 01726 = has_infinity && has_quiet_NaN && has_denorm == denorm_present; 01727 static _GLIBCXX_USE_CONSTEXPR bool is_bounded = true; 01728 static _GLIBCXX_USE_CONSTEXPR bool is_modulo = false; 01729 01730 static _GLIBCXX_USE_CONSTEXPR bool traps = __glibcxx_double_traps; 01731 static _GLIBCXX_USE_CONSTEXPR bool tinyness_before 01732 = __glibcxx_double_tinyness_before; 01733 static _GLIBCXX_USE_CONSTEXPR float_round_style round_style 01734 = round_to_nearest; 01735 }; 01736 01737 #undef __glibcxx_double_has_denorm_loss 01738 #undef __glibcxx_double_traps 01739 #undef __glibcxx_double_tinyness_before 01740 01741 /// numeric_limits<long double> specialization. 01742 template<> 01743 struct numeric_limits<long double> 01744 { 01745 static _GLIBCXX_USE_CONSTEXPR bool is_specialized = true; 01746 01747 static _GLIBCXX_CONSTEXPR long double 01748 min() _GLIBCXX_USE_NOEXCEPT { return __LDBL_MIN__; } 01749 01750 static _GLIBCXX_CONSTEXPR long double 01751 max() _GLIBCXX_USE_NOEXCEPT { return __LDBL_MAX__; } 01752 01753 #if __cplusplus >= 201103L 01754 static constexpr long double 01755 lowest() noexcept { return -__LDBL_MAX__; } 01756 #endif 01757 01758 static _GLIBCXX_USE_CONSTEXPR int digits = __LDBL_MANT_DIG__; 01759 static _GLIBCXX_USE_CONSTEXPR int digits10 = __LDBL_DIG__; 01760 #if __cplusplus >= 201103L 01761 static _GLIBCXX_USE_CONSTEXPR int max_digits10 01762 = __glibcxx_max_digits10 (__LDBL_MANT_DIG__); 01763 #endif 01764 static _GLIBCXX_USE_CONSTEXPR bool is_signed = true; 01765 static _GLIBCXX_USE_CONSTEXPR bool is_integer = false; 01766 static _GLIBCXX_USE_CONSTEXPR bool is_exact = false; 01767 static _GLIBCXX_USE_CONSTEXPR int radix = __FLT_RADIX__; 01768 01769 static _GLIBCXX_CONSTEXPR long double 01770 epsilon() _GLIBCXX_USE_NOEXCEPT { return __LDBL_EPSILON__; } 01771 01772 static _GLIBCXX_CONSTEXPR long double 01773 round_error() _GLIBCXX_USE_NOEXCEPT { return 0.5L; } 01774 01775 static _GLIBCXX_USE_CONSTEXPR int min_exponent = __LDBL_MIN_EXP__; 01776 static _GLIBCXX_USE_CONSTEXPR int min_exponent10 = __LDBL_MIN_10_EXP__; 01777 static _GLIBCXX_USE_CONSTEXPR int max_exponent = __LDBL_MAX_EXP__; 01778 static _GLIBCXX_USE_CONSTEXPR int max_exponent10 = __LDBL_MAX_10_EXP__; 01779 01780 static _GLIBCXX_USE_CONSTEXPR bool has_infinity = __LDBL_HAS_INFINITY__; 01781 static _GLIBCXX_USE_CONSTEXPR bool has_quiet_NaN = __LDBL_HAS_QUIET_NAN__; 01782 static _GLIBCXX_USE_CONSTEXPR bool has_signaling_NaN = has_quiet_NaN; 01783 static _GLIBCXX_USE_CONSTEXPR float_denorm_style has_denorm 01784 = bool(__LDBL_HAS_DENORM__) ? denorm_present : denorm_absent; 01785 static _GLIBCXX_USE_CONSTEXPR bool has_denorm_loss 01786 = __glibcxx_long_double_has_denorm_loss; 01787 01788 static _GLIBCXX_CONSTEXPR long double 01789 infinity() _GLIBCXX_USE_NOEXCEPT { return __builtin_huge_vall(); } 01790 01791 static _GLIBCXX_CONSTEXPR long double 01792 quiet_NaN() _GLIBCXX_USE_NOEXCEPT { return __builtin_nanl(""); } 01793 01794 static _GLIBCXX_CONSTEXPR long double 01795 signaling_NaN() _GLIBCXX_USE_NOEXCEPT { return __builtin_nansl(""); } 01796 01797 static _GLIBCXX_CONSTEXPR long double 01798 denorm_min() _GLIBCXX_USE_NOEXCEPT { return __LDBL_DENORM_MIN__; } 01799 01800 static _GLIBCXX_USE_CONSTEXPR bool is_iec559 01801 = has_infinity && has_quiet_NaN && has_denorm == denorm_present; 01802 static _GLIBCXX_USE_CONSTEXPR bool is_bounded = true; 01803 static _GLIBCXX_USE_CONSTEXPR bool is_modulo = false; 01804 01805 static _GLIBCXX_USE_CONSTEXPR bool traps = __glibcxx_long_double_traps; 01806 static _GLIBCXX_USE_CONSTEXPR bool tinyness_before = 01807 __glibcxx_long_double_tinyness_before; 01808 static _GLIBCXX_USE_CONSTEXPR float_round_style round_style = 01809 round_to_nearest; 01810 }; 01811 01812 #undef __glibcxx_long_double_has_denorm_loss 01813 #undef __glibcxx_long_double_traps 01814 #undef __glibcxx_long_double_tinyness_before 01815 01816 _GLIBCXX_END_NAMESPACE_VERSION 01817 } // namespace 01818 01819 #undef __glibcxx_signed 01820 #undef __glibcxx_min 01821 #undef __glibcxx_max 01822 #undef __glibcxx_digits 01823 #undef __glibcxx_digits10 01824 #undef __glibcxx_max_digits10 01825 01826 #endif // _GLIBCXX_NUMERIC_LIMITS