1404b540aSrobert // The template and inlines for the numeric_limits classes. -*- C++ -*- 2404b540aSrobert 3404b540aSrobert // Copyright (C) 1999, 2000, 2001, 2002, 2003, 2005 4404b540aSrobert // Free Software Foundation, Inc. 5404b540aSrobert // 6404b540aSrobert // This file is part of the GNU ISO C++ Library. This library is free 7404b540aSrobert // software; you can redistribute it and/or modify it under the 8404b540aSrobert // terms of the GNU General Public License as published by the 9404b540aSrobert // Free Software Foundation; either version 2, or (at your option) 10404b540aSrobert // any later version. 11404b540aSrobert 12404b540aSrobert // This library is distributed in the hope that it will be useful, 13404b540aSrobert // but WITHOUT ANY WARRANTY; without even the implied warranty of 14404b540aSrobert // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15404b540aSrobert // GNU General Public License for more details. 16404b540aSrobert 17404b540aSrobert // You should have received a copy of the GNU General Public License along 18404b540aSrobert // with this library; see the file COPYING. If not, write to the Free 19404b540aSrobert // Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, 20404b540aSrobert // USA. 21404b540aSrobert 22404b540aSrobert // As a special exception, you may use this file as part of a free software 23404b540aSrobert // library without restriction. Specifically, if other files instantiate 24404b540aSrobert // templates or use macros or inline functions from this file, or you compile 25404b540aSrobert // this file and link it with other files to produce an executable, this 26404b540aSrobert // file does not by itself cause the resulting executable to be covered by 27404b540aSrobert // the GNU General Public License. This exception does not however 28404b540aSrobert // invalidate any other reasons why the executable file might be covered by 29404b540aSrobert // the GNU General Public License. 30404b540aSrobert 31404b540aSrobert /** @file limits 32404b540aSrobert * This is a Standard C++ Library header. 33404b540aSrobert */ 34404b540aSrobert 35404b540aSrobert // Note: this is not a conforming implementation. 36404b540aSrobert // Written by Gabriel Dos Reis <gdr@codesourcery.com> 37404b540aSrobert 38404b540aSrobert // 39404b540aSrobert // ISO 14882:1998 40404b540aSrobert // 18.2.1 41404b540aSrobert // 42404b540aSrobert 43404b540aSrobert #ifndef _GLIBCXX_NUMERIC_LIMITS 44404b540aSrobert #define _GLIBCXX_NUMERIC_LIMITS 1 45404b540aSrobert 46404b540aSrobert #pragma GCC system_header 47404b540aSrobert 48404b540aSrobert #include <bits/c++config.h> 49404b540aSrobert 50404b540aSrobert // 51404b540aSrobert // The numeric_limits<> traits document implementation-defined aspects 52404b540aSrobert // of fundamental arithmetic data types (integers and floating points). 53404b540aSrobert // From Standard C++ point of view, there are 13 such types: 54404b540aSrobert // * integers 55404b540aSrobert // bool (1) 56404b540aSrobert // char, signed char, unsigned char (3) 57404b540aSrobert // short, unsigned short (2) 58404b540aSrobert // int, unsigned (2) 59404b540aSrobert // long, unsigned long (2) 60404b540aSrobert // 61404b540aSrobert // * floating points 62404b540aSrobert // float (1) 63404b540aSrobert // double (1) 64404b540aSrobert // long double (1) 65404b540aSrobert // 66404b540aSrobert // GNU C++ undertstands (where supported by the host C-library) 67404b540aSrobert // * integer 68404b540aSrobert // long long, unsigned long long (2) 69404b540aSrobert // 70404b540aSrobert // which brings us to 15 fundamental arithmetic data types in GNU C++. 71404b540aSrobert // 72404b540aSrobert // 73404b540aSrobert // Since a numeric_limits<> is a bit tricky to get right, we rely on 74404b540aSrobert // an interface composed of macros which should be defined in config/os 75404b540aSrobert // or config/cpu when they differ from the generic (read arbitrary) 76404b540aSrobert // definitions given here. 77404b540aSrobert // 78404b540aSrobert 79404b540aSrobert // These values can be overridden in the target configuration file. 80404b540aSrobert // The default values are appropriate for many 32-bit targets. 81404b540aSrobert 82404b540aSrobert // GCC only intrinsicly supports modulo integral types. The only remaining 83404b540aSrobert // integral exceptional values is division by zero. Only targets that do not 84404b540aSrobert // signal division by zero in some "hard to ignore" way should use false. 85404b540aSrobert #ifndef __glibcxx_integral_traps 86404b540aSrobert # define __glibcxx_integral_traps true 87404b540aSrobert #endif 88404b540aSrobert 89404b540aSrobert // float 90404b540aSrobert // 91404b540aSrobert 92404b540aSrobert // Default values. Should be overriden in configuration files if necessary. 93404b540aSrobert 94404b540aSrobert #ifndef __glibcxx_float_has_denorm_loss 95404b540aSrobert # define __glibcxx_float_has_denorm_loss false 96404b540aSrobert #endif 97404b540aSrobert #ifndef __glibcxx_float_traps 98404b540aSrobert # define __glibcxx_float_traps false 99404b540aSrobert #endif 100404b540aSrobert #ifndef __glibcxx_float_tinyness_before 101404b540aSrobert # define __glibcxx_float_tinyness_before false 102404b540aSrobert #endif 103404b540aSrobert 104404b540aSrobert // double 105404b540aSrobert 106404b540aSrobert // Default values. Should be overriden in configuration files if necessary. 107404b540aSrobert 108404b540aSrobert #ifndef __glibcxx_double_has_denorm_loss 109404b540aSrobert # define __glibcxx_double_has_denorm_loss false 110404b540aSrobert #endif 111404b540aSrobert #ifndef __glibcxx_double_traps 112404b540aSrobert # define __glibcxx_double_traps false 113404b540aSrobert #endif 114404b540aSrobert #ifndef __glibcxx_double_tinyness_before 115404b540aSrobert # define __glibcxx_double_tinyness_before false 116404b540aSrobert #endif 117404b540aSrobert 118404b540aSrobert // long double 119404b540aSrobert 120404b540aSrobert // Default values. Should be overriden in configuration files if necessary. 121404b540aSrobert 122404b540aSrobert #ifndef __glibcxx_long_double_has_denorm_loss 123404b540aSrobert # define __glibcxx_long_double_has_denorm_loss false 124404b540aSrobert #endif 125404b540aSrobert #ifndef __glibcxx_long_double_traps 126404b540aSrobert # define __glibcxx_long_double_traps false 127404b540aSrobert #endif 128404b540aSrobert #ifndef __glibcxx_long_double_tinyness_before 129404b540aSrobert # define __glibcxx_long_double_tinyness_before false 130404b540aSrobert #endif 131404b540aSrobert 132404b540aSrobert // You should not need to define any macros below this point. 133404b540aSrobert 134404b540aSrobert #define __glibcxx_signed(T) ((T)(-1) < 0) 135404b540aSrobert 136404b540aSrobert #define __glibcxx_min(T) \ 137404b540aSrobert (__glibcxx_signed (T) ? (T)1 << __glibcxx_digits (T) : (T)0) 138404b540aSrobert 139404b540aSrobert #define __glibcxx_max(T) \ 140*cca36db2Sespie (__glibcxx_signed (T) ? \ 141*cca36db2Sespie (((((T)1 << (__glibcxx_digits (T) - 1)) - 1) << 1) + 1) : ~(T)0) 142*cca36db2Sespie 143404b540aSrobert 144404b540aSrobert #define __glibcxx_digits(T) \ 145404b540aSrobert (sizeof(T) * __CHAR_BIT__ - __glibcxx_signed (T)) 146404b540aSrobert 147404b540aSrobert // The fraction 643/2136 approximates log10(2) to 7 significant digits. 148404b540aSrobert #define __glibcxx_digits10(T) \ 149404b540aSrobert (__glibcxx_digits (T) * 643 / 2136) 150404b540aSrobert 151404b540aSrobert 152404b540aSrobert _GLIBCXX_BEGIN_NAMESPACE(std) 153404b540aSrobert 154404b540aSrobert /** 155404b540aSrobert * @brief Describes the rounding style for floating-point types. 156404b540aSrobert * 157404b540aSrobert * This is used in the std::numeric_limits class. 158404b540aSrobert */ 159404b540aSrobert enum float_round_style 160404b540aSrobert { 161404b540aSrobert round_indeterminate = -1, ///< Self-explanatory. 162404b540aSrobert round_toward_zero = 0, ///< Self-explanatory. 163404b540aSrobert round_to_nearest = 1, ///< To the nearest representable value. 164404b540aSrobert round_toward_infinity = 2, ///< Self-explanatory. 165404b540aSrobert round_toward_neg_infinity = 3 ///< Self-explanatory. 166404b540aSrobert }; 167404b540aSrobert 168404b540aSrobert /** 169404b540aSrobert * @brief Describes the denormalization for floating-point types. 170404b540aSrobert * 171404b540aSrobert * These values represent the presence or absence of a variable number 172404b540aSrobert * of exponent bits. This type is used in the std::numeric_limits class. 173404b540aSrobert */ 174404b540aSrobert enum float_denorm_style 175404b540aSrobert { 176404b540aSrobert /// Indeterminate at compile time whether denormalized values are allowed. 177404b540aSrobert denorm_indeterminate = -1, 178404b540aSrobert /// The type does not allow denormalized values. 179404b540aSrobert denorm_absent = 0, 180404b540aSrobert /// The type allows denormalized values. 181404b540aSrobert denorm_present = 1 182404b540aSrobert }; 183404b540aSrobert 184404b540aSrobert /** 185404b540aSrobert * @brief Part of std::numeric_limits. 186404b540aSrobert * 187404b540aSrobert * The @c static @c const members are usable as integral constant 188404b540aSrobert * expressions. 189404b540aSrobert * 190404b540aSrobert * @note This is a seperate class for purposes of efficiency; you 191404b540aSrobert * should only access these members as part of an instantiation 192404b540aSrobert * of the std::numeric_limits class. 193404b540aSrobert */ 194404b540aSrobert struct __numeric_limits_base 195404b540aSrobert { 196404b540aSrobert /** This will be true for all fundamental types (which have 197404b540aSrobert specializations), and false for everything else. */ 198404b540aSrobert static const bool is_specialized = false; 199404b540aSrobert 200404b540aSrobert /** The number of @c radix digits that be represented without change: for 201404b540aSrobert integer types, the number of non-sign bits in the mantissa; for 202404b540aSrobert floating types, the number of @c radix digits in the mantissa. */ 203404b540aSrobert static const int digits = 0; 204404b540aSrobert /** The number of base 10 digits that can be represented without change. */ 205404b540aSrobert static const int digits10 = 0; 206404b540aSrobert /** True if the type is signed. */ 207404b540aSrobert static const bool is_signed = false; 208404b540aSrobert /** True if the type is integer. 209404b540aSrobert * @if maint 210404b540aSrobert * Is this supposed to be "if the type is integral"? 211404b540aSrobert * @endif 212404b540aSrobert */ 213404b540aSrobert static const bool is_integer = false; 214404b540aSrobert /** True if the type uses an exact representation. "All integer types are 215404b540aSrobert exact, but not all exact types are integer. For example, rational and 216404b540aSrobert fixed-exponent representations are exact but not integer." 217404b540aSrobert [18.2.1.2]/15 */ 218404b540aSrobert static const bool is_exact = false; 219404b540aSrobert /** For integer types, specifies the base of the representation. For 220404b540aSrobert floating types, specifies the base of the exponent representation. */ 221404b540aSrobert static const int radix = 0; 222404b540aSrobert 223404b540aSrobert /** The minimum negative integer such that @c radix raised to the power of 224404b540aSrobert (one less than that integer) is a normalized floating point number. */ 225404b540aSrobert static const int min_exponent = 0; 226404b540aSrobert /** The minimum negative integer such that 10 raised to that power is in 227404b540aSrobert the range of normalized floating point numbers. */ 228404b540aSrobert static const int min_exponent10 = 0; 229404b540aSrobert /** The maximum positive integer such that @c radix raised to the power of 230404b540aSrobert (one less than that integer) is a representable finite floating point 231404b540aSrobert number. */ 232404b540aSrobert static const int max_exponent = 0; 233404b540aSrobert /** The maximum positive integer such that 10 raised to that power is in 234404b540aSrobert the range of representable finite floating point numbers. */ 235404b540aSrobert static const int max_exponent10 = 0; 236404b540aSrobert 237404b540aSrobert /** True if the type has a representation for positive infinity. */ 238404b540aSrobert static const bool has_infinity = false; 239404b540aSrobert /** True if the type has a representation for a quiet (non-signaling) 240404b540aSrobert "Not a Number." */ 241404b540aSrobert static const bool has_quiet_NaN = false; 242404b540aSrobert /** True if the type has a representation for a signaling 243404b540aSrobert "Not a Number." */ 244404b540aSrobert static const bool has_signaling_NaN = false; 245404b540aSrobert /** See std::float_denorm_style for more information. */ 246404b540aSrobert static const float_denorm_style has_denorm = denorm_absent; 247404b540aSrobert /** "True if loss of accuracy is detected as a denormalization loss, 248404b540aSrobert rather than as an inexact result." [18.2.1.2]/42 */ 249404b540aSrobert static const bool has_denorm_loss = false; 250404b540aSrobert 251404b540aSrobert /** True if-and-only-if the type adheres to the IEC 559 standard, also 252404b540aSrobert known as IEEE 754. (Only makes sense for floating point types.) */ 253404b540aSrobert static const bool is_iec559 = false; 254404b540aSrobert /** "True if the set of values representable by the type is finite. All 255404b540aSrobert built-in types are bounded, this member would be false for arbitrary 256404b540aSrobert precision types." [18.2.1.2]/54 */ 257404b540aSrobert static const bool is_bounded = false; 258404b540aSrobert /** True if the type is @e modulo, that is, if it is possible to add two 259404b540aSrobert positive numbers and have a result that wraps around to a third number 260404b540aSrobert that is less. Typically false for floating types, true for unsigned 261404b540aSrobert integers, and true for signed integers. */ 262404b540aSrobert static const bool is_modulo = false; 263404b540aSrobert 264404b540aSrobert /** True if trapping is implemented for this type. */ 265404b540aSrobert static const bool traps = false; 266404b540aSrobert /** True if tinyness is detected before rounding. (see IEC 559) */ 267404b540aSrobert static const bool tinyness_before = false; 268404b540aSrobert /** See std::float_round_style for more information. This is only 269404b540aSrobert meaningful for floating types; integer types will all be 270404b540aSrobert round_toward_zero. */ 271404b540aSrobert static const float_round_style round_style = round_toward_zero; 272404b540aSrobert }; 273404b540aSrobert 274404b540aSrobert /** 275404b540aSrobert * @brief Properties of fundamental types. 276404b540aSrobert * 277404b540aSrobert * This class allows a program to obtain information about the 278404b540aSrobert * representation of a fundamental type on a given platform. For 279404b540aSrobert * non-fundamental types, the functions will return 0 and the data 280404b540aSrobert * members will all be @c false. 281404b540aSrobert * 282404b540aSrobert * @if maint 283404b540aSrobert * _GLIBCXX_RESOLVE_LIB_DEFECTS: DRs 201 and 184 (hi Gaby!) are 284404b540aSrobert * noted, but not incorporated in this documented (yet). 285404b540aSrobert * @endif 286404b540aSrobert */ 287404b540aSrobert template<typename _Tp> 288404b540aSrobert struct numeric_limits : public __numeric_limits_base 289404b540aSrobert { 290404b540aSrobert /** The minimum finite value, or for floating types with 291404b540aSrobert denormalization, the minimum positive normalized value. */ minnumeric_limits292404b540aSrobert static _Tp min() throw() { return static_cast<_Tp>(0); } 293404b540aSrobert /** The maximum finite value. */ maxnumeric_limits294404b540aSrobert static _Tp max() throw() { return static_cast<_Tp>(0); } 295404b540aSrobert /** The @e machine @e epsilon: the difference between 1 and the least 296404b540aSrobert value greater than 1 that is representable. */ epsilonnumeric_limits297404b540aSrobert static _Tp epsilon() throw() { return static_cast<_Tp>(0); } 298404b540aSrobert /** The maximum rounding error measurement (see LIA-1). */ round_errornumeric_limits299404b540aSrobert static _Tp round_error() throw() { return static_cast<_Tp>(0); } 300404b540aSrobert /** The representation of positive infinity, if @c has_infinity. */ infinitynumeric_limits301404b540aSrobert static _Tp infinity() throw() { return static_cast<_Tp>(0); } 302404b540aSrobert /** The representation of a quiet "Not a Number," if @c has_quiet_NaN. */ quiet_NaNnumeric_limits303404b540aSrobert static _Tp quiet_NaN() throw() { return static_cast<_Tp>(0); } 304404b540aSrobert /** The representation of a signaling "Not a Number," if 305404b540aSrobert @c has_signaling_NaN. */ signaling_NaNnumeric_limits306404b540aSrobert static _Tp signaling_NaN() throw() { return static_cast<_Tp>(0); } 307404b540aSrobert /** The minimum positive denormalized value. For types where 308404b540aSrobert @c has_denorm is false, this is the minimum positive normalized 309404b540aSrobert value. */ denorm_minnumeric_limits310404b540aSrobert static _Tp denorm_min() throw() { return static_cast<_Tp>(0); } 311404b540aSrobert }; 312404b540aSrobert 313404b540aSrobert // Now there follow 15 explicit specializations. Yes, 15. Make sure 314404b540aSrobert // you get the count right. 315404b540aSrobert 316404b540aSrobert /// numeric_limits<bool> specialization. 317404b540aSrobert template<> 318404b540aSrobert struct numeric_limits<bool> 319404b540aSrobert { 320404b540aSrobert static const bool is_specialized = true; 321404b540aSrobert 322404b540aSrobert static bool min() throw() 323404b540aSrobert { return false; } 324404b540aSrobert static bool max() throw() 325404b540aSrobert { return true; } 326404b540aSrobert 327404b540aSrobert static const int digits = 1; 328404b540aSrobert static const int digits10 = 0; 329404b540aSrobert static const bool is_signed = false; 330404b540aSrobert static const bool is_integer = true; 331404b540aSrobert static const bool is_exact = true; 332404b540aSrobert static const int radix = 2; 333404b540aSrobert static bool epsilon() throw() 334404b540aSrobert { return false; } 335404b540aSrobert static bool round_error() throw() 336404b540aSrobert { return false; } 337404b540aSrobert 338404b540aSrobert static const int min_exponent = 0; 339404b540aSrobert static const int min_exponent10 = 0; 340404b540aSrobert static const int max_exponent = 0; 341404b540aSrobert static const int max_exponent10 = 0; 342404b540aSrobert 343404b540aSrobert static const bool has_infinity = false; 344404b540aSrobert static const bool has_quiet_NaN = false; 345404b540aSrobert static const bool has_signaling_NaN = false; 346404b540aSrobert static const float_denorm_style has_denorm = denorm_absent; 347404b540aSrobert static const bool has_denorm_loss = false; 348404b540aSrobert 349404b540aSrobert static bool infinity() throw() 350404b540aSrobert { return false; } 351404b540aSrobert static bool quiet_NaN() throw() 352404b540aSrobert { return false; } 353404b540aSrobert static bool signaling_NaN() throw() 354404b540aSrobert { return false; } 355404b540aSrobert static bool denorm_min() throw() 356404b540aSrobert { return false; } 357404b540aSrobert 358404b540aSrobert static const bool is_iec559 = false; 359404b540aSrobert static const bool is_bounded = true; 360404b540aSrobert static const bool is_modulo = false; 361404b540aSrobert 362404b540aSrobert // It is not clear what it means for a boolean type to trap. 363404b540aSrobert // This is a DR on the LWG issue list. Here, I use integer 364404b540aSrobert // promotion semantics. 365404b540aSrobert static const bool traps = __glibcxx_integral_traps; 366404b540aSrobert static const bool tinyness_before = false; 367404b540aSrobert static const float_round_style round_style = round_toward_zero; 368404b540aSrobert }; 369404b540aSrobert 370404b540aSrobert /// numeric_limits<signed char> specialization. 371404b540aSrobert template<> 372404b540aSrobert struct numeric_limits<signed char> 373404b540aSrobert { 374404b540aSrobert static const bool is_specialized = true; 375404b540aSrobert 376404b540aSrobert static signed char min() throw() 377404b540aSrobert { return -__SCHAR_MAX__ - 1; } 378404b540aSrobert static signed char max() throw() 379404b540aSrobert { return __SCHAR_MAX__; } 380404b540aSrobert 381404b540aSrobert static const int digits = __glibcxx_digits (signed char); 382404b540aSrobert static const int digits10 = __glibcxx_digits10 (signed char); 383404b540aSrobert static const bool is_signed = true; 384404b540aSrobert static const bool is_integer = true; 385404b540aSrobert static const bool is_exact = true; 386404b540aSrobert static const int radix = 2; 387404b540aSrobert static signed char epsilon() throw() 388404b540aSrobert { return 0; } 389404b540aSrobert static signed char round_error() throw() 390404b540aSrobert { return 0; } 391404b540aSrobert 392404b540aSrobert static const int min_exponent = 0; 393404b540aSrobert static const int min_exponent10 = 0; 394404b540aSrobert static const int max_exponent = 0; 395404b540aSrobert static const int max_exponent10 = 0; 396404b540aSrobert 397404b540aSrobert static const bool has_infinity = false; 398404b540aSrobert static const bool has_quiet_NaN = false; 399404b540aSrobert static const bool has_signaling_NaN = false; 400404b540aSrobert static const float_denorm_style has_denorm = denorm_absent; 401404b540aSrobert static const bool has_denorm_loss = false; 402404b540aSrobert 403404b540aSrobert static signed char infinity() throw() 404404b540aSrobert { return static_cast<signed char>(0); } 405404b540aSrobert static signed char quiet_NaN() throw() 406404b540aSrobert { return static_cast<signed char>(0); } 407404b540aSrobert static signed char signaling_NaN() throw() 408404b540aSrobert { return static_cast<signed char>(0); } 409404b540aSrobert static signed char denorm_min() throw() 410404b540aSrobert { return static_cast<signed char>(0); } 411404b540aSrobert 412404b540aSrobert static const bool is_iec559 = false; 413404b540aSrobert static const bool is_bounded = true; 414404b540aSrobert static const bool is_modulo = true; 415404b540aSrobert 416404b540aSrobert static const bool traps = __glibcxx_integral_traps; 417404b540aSrobert static const bool tinyness_before = false; 418404b540aSrobert static const float_round_style round_style = round_toward_zero; 419404b540aSrobert }; 420404b540aSrobert 421404b540aSrobert /// numeric_limits<unsigned char> specialization. 422404b540aSrobert template<> 423404b540aSrobert struct numeric_limits<unsigned char> 424404b540aSrobert { 425404b540aSrobert static const bool is_specialized = true; 426404b540aSrobert 427404b540aSrobert static unsigned char min() throw() 428404b540aSrobert { return 0; } 429404b540aSrobert static unsigned char max() throw() 430404b540aSrobert { return __SCHAR_MAX__ * 2U + 1; } 431404b540aSrobert 432404b540aSrobert static const int digits = __glibcxx_digits (unsigned char); 433404b540aSrobert static const int digits10 = __glibcxx_digits10 (unsigned char); 434404b540aSrobert static const bool is_signed = false; 435404b540aSrobert static const bool is_integer = true; 436404b540aSrobert static const bool is_exact = true; 437404b540aSrobert static const int radix = 2; 438404b540aSrobert static unsigned char epsilon() throw() 439404b540aSrobert { return 0; } 440404b540aSrobert static unsigned char round_error() throw() 441404b540aSrobert { return 0; } 442404b540aSrobert 443404b540aSrobert static const int min_exponent = 0; 444404b540aSrobert static const int min_exponent10 = 0; 445404b540aSrobert static const int max_exponent = 0; 446404b540aSrobert static const int max_exponent10 = 0; 447404b540aSrobert 448404b540aSrobert static const bool has_infinity = false; 449404b540aSrobert static const bool has_quiet_NaN = false; 450404b540aSrobert static const bool has_signaling_NaN = false; 451404b540aSrobert static const float_denorm_style has_denorm = denorm_absent; 452404b540aSrobert static const bool has_denorm_loss = false; 453404b540aSrobert 454404b540aSrobert static unsigned char infinity() throw() 455404b540aSrobert { return static_cast<unsigned char>(0); } 456404b540aSrobert static unsigned char quiet_NaN() throw() 457404b540aSrobert { return static_cast<unsigned char>(0); } 458404b540aSrobert static unsigned char signaling_NaN() throw() 459404b540aSrobert { return static_cast<unsigned char>(0); } 460404b540aSrobert static unsigned char denorm_min() throw() 461404b540aSrobert { return static_cast<unsigned char>(0); } 462404b540aSrobert 463404b540aSrobert static const bool is_iec559 = false; 464404b540aSrobert static const bool is_bounded = true; 465404b540aSrobert static const bool is_modulo = true; 466404b540aSrobert 467404b540aSrobert static const bool traps = __glibcxx_integral_traps; 468404b540aSrobert static const bool tinyness_before = false; 469404b540aSrobert static const float_round_style round_style = round_toward_zero; 470404b540aSrobert }; 471404b540aSrobert 472*cca36db2Sespie /// numeric_limits<char> specialization. 473*cca36db2Sespie template<> 474*cca36db2Sespie struct numeric_limits<char> 475*cca36db2Sespie { 476*cca36db2Sespie static const bool is_specialized = true; 477*cca36db2Sespie 478*cca36db2Sespie static char min() throw() 479*cca36db2Sespie { return __glibcxx_signed(char) ? 480*cca36db2Sespie numeric_limits<signed char>::min() : 481*cca36db2Sespie numeric_limits<unsigned char>::min(); } 482*cca36db2Sespie static char max() throw() 483*cca36db2Sespie { return __glibcxx_signed(char) ? 484*cca36db2Sespie numeric_limits<signed char>::max() : 485*cca36db2Sespie numeric_limits<unsigned char>::max(); } 486*cca36db2Sespie 487*cca36db2Sespie static const int digits = __glibcxx_digits (char); 488*cca36db2Sespie static const int digits10 = __glibcxx_digits10 (char); 489*cca36db2Sespie static const bool is_signed = __glibcxx_signed (char); 490*cca36db2Sespie static const bool is_integer = true; 491*cca36db2Sespie static const bool is_exact = true; 492*cca36db2Sespie static const int radix = 2; 493*cca36db2Sespie static char epsilon() throw() 494*cca36db2Sespie { return 0; } 495*cca36db2Sespie static char round_error() throw() 496*cca36db2Sespie { return 0; } 497*cca36db2Sespie 498*cca36db2Sespie static const int min_exponent = 0; 499*cca36db2Sespie static const int min_exponent10 = 0; 500*cca36db2Sespie static const int max_exponent = 0; 501*cca36db2Sespie static const int max_exponent10 = 0; 502*cca36db2Sespie 503*cca36db2Sespie static const bool has_infinity = false; 504*cca36db2Sespie static const bool has_quiet_NaN = false; 505*cca36db2Sespie static const bool has_signaling_NaN = false; 506*cca36db2Sespie static const float_denorm_style has_denorm = denorm_absent; 507*cca36db2Sespie static const bool has_denorm_loss = false; 508*cca36db2Sespie 509*cca36db2Sespie static char infinity() throw() 510*cca36db2Sespie { return char(); } 511*cca36db2Sespie static char quiet_NaN() throw() 512*cca36db2Sespie { return char(); } 513*cca36db2Sespie static char signaling_NaN() throw() 514*cca36db2Sespie { return char(); } 515*cca36db2Sespie static char denorm_min() throw() 516*cca36db2Sespie { return static_cast<char>(0); } 517*cca36db2Sespie 518*cca36db2Sespie static const bool is_iec559 = false; 519*cca36db2Sespie static const bool is_bounded = true; 520*cca36db2Sespie static const bool is_modulo = true; 521*cca36db2Sespie 522*cca36db2Sespie static const bool traps = __glibcxx_integral_traps; 523*cca36db2Sespie static const bool tinyness_before = false; 524*cca36db2Sespie static const float_round_style round_style = round_toward_zero; 525*cca36db2Sespie }; 526*cca36db2Sespie 527404b540aSrobert /// numeric_limits<wchar_t> specialization. 528404b540aSrobert template<> 529404b540aSrobert struct numeric_limits<wchar_t> 530404b540aSrobert { 531404b540aSrobert static const bool is_specialized = true; 532404b540aSrobert 533404b540aSrobert static wchar_t min() throw() 534404b540aSrobert { return __glibcxx_min (wchar_t); } 535404b540aSrobert static wchar_t max() throw() 536404b540aSrobert { return __glibcxx_max (wchar_t); } 537404b540aSrobert 538404b540aSrobert static const int digits = __glibcxx_digits (wchar_t); 539404b540aSrobert static const int digits10 = __glibcxx_digits10 (wchar_t); 540404b540aSrobert static const bool is_signed = __glibcxx_signed (wchar_t); 541404b540aSrobert static const bool is_integer = true; 542404b540aSrobert static const bool is_exact = true; 543404b540aSrobert static const int radix = 2; 544404b540aSrobert static wchar_t epsilon() throw() 545404b540aSrobert { return 0; } 546404b540aSrobert static wchar_t round_error() throw() 547404b540aSrobert { return 0; } 548404b540aSrobert 549404b540aSrobert static const int min_exponent = 0; 550404b540aSrobert static const int min_exponent10 = 0; 551404b540aSrobert static const int max_exponent = 0; 552404b540aSrobert static const int max_exponent10 = 0; 553404b540aSrobert 554404b540aSrobert static const bool has_infinity = false; 555404b540aSrobert static const bool has_quiet_NaN = false; 556404b540aSrobert static const bool has_signaling_NaN = false; 557404b540aSrobert static const float_denorm_style has_denorm = denorm_absent; 558404b540aSrobert static const bool has_denorm_loss = false; 559404b540aSrobert 560404b540aSrobert static wchar_t infinity() throw() 561404b540aSrobert { return wchar_t(); } 562404b540aSrobert static wchar_t quiet_NaN() throw() 563404b540aSrobert { return wchar_t(); } 564404b540aSrobert static wchar_t signaling_NaN() throw() 565404b540aSrobert { return wchar_t(); } 566404b540aSrobert static wchar_t denorm_min() throw() 567404b540aSrobert { return wchar_t(); } 568404b540aSrobert 569404b540aSrobert static const bool is_iec559 = false; 570404b540aSrobert static const bool is_bounded = true; 571404b540aSrobert static const bool is_modulo = true; 572404b540aSrobert 573404b540aSrobert static const bool traps = __glibcxx_integral_traps; 574404b540aSrobert static const bool tinyness_before = false; 575404b540aSrobert static const float_round_style round_style = round_toward_zero; 576404b540aSrobert }; 577404b540aSrobert 578404b540aSrobert /// numeric_limits<short> specialization. 579404b540aSrobert template<> 580404b540aSrobert struct numeric_limits<short> 581404b540aSrobert { 582404b540aSrobert static const bool is_specialized = true; 583404b540aSrobert 584404b540aSrobert static short min() throw() 585404b540aSrobert { return -__SHRT_MAX__ - 1; } 586404b540aSrobert static short max() throw() 587404b540aSrobert { return __SHRT_MAX__; } 588404b540aSrobert 589404b540aSrobert static const int digits = __glibcxx_digits (short); 590404b540aSrobert static const int digits10 = __glibcxx_digits10 (short); 591404b540aSrobert static const bool is_signed = true; 592404b540aSrobert static const bool is_integer = true; 593404b540aSrobert static const bool is_exact = true; 594404b540aSrobert static const int radix = 2; 595404b540aSrobert static short epsilon() throw() 596404b540aSrobert { return 0; } 597404b540aSrobert static short round_error() throw() 598404b540aSrobert { return 0; } 599404b540aSrobert 600404b540aSrobert static const int min_exponent = 0; 601404b540aSrobert static const int min_exponent10 = 0; 602404b540aSrobert static const int max_exponent = 0; 603404b540aSrobert static const int max_exponent10 = 0; 604404b540aSrobert 605404b540aSrobert static const bool has_infinity = false; 606404b540aSrobert static const bool has_quiet_NaN = false; 607404b540aSrobert static const bool has_signaling_NaN = false; 608404b540aSrobert static const float_denorm_style has_denorm = denorm_absent; 609404b540aSrobert static const bool has_denorm_loss = false; 610404b540aSrobert 611404b540aSrobert static short infinity() throw() 612404b540aSrobert { return short(); } 613404b540aSrobert static short quiet_NaN() throw() 614404b540aSrobert { return short(); } 615404b540aSrobert static short signaling_NaN() throw() 616404b540aSrobert { return short(); } 617404b540aSrobert static short denorm_min() throw() 618404b540aSrobert { return short(); } 619404b540aSrobert 620404b540aSrobert static const bool is_iec559 = false; 621404b540aSrobert static const bool is_bounded = true; 622404b540aSrobert static const bool is_modulo = true; 623404b540aSrobert 624404b540aSrobert static const bool traps = __glibcxx_integral_traps; 625404b540aSrobert static const bool tinyness_before = false; 626404b540aSrobert static const float_round_style round_style = round_toward_zero; 627404b540aSrobert }; 628404b540aSrobert 629404b540aSrobert /// numeric_limits<unsigned short> specialization. 630404b540aSrobert template<> 631404b540aSrobert struct numeric_limits<unsigned short> 632404b540aSrobert { 633404b540aSrobert static const bool is_specialized = true; 634404b540aSrobert 635404b540aSrobert static unsigned short min() throw() 636404b540aSrobert { return 0; } 637404b540aSrobert static unsigned short max() throw() 638404b540aSrobert { return __SHRT_MAX__ * 2U + 1; } 639404b540aSrobert 640404b540aSrobert static const int digits = __glibcxx_digits (unsigned short); 641404b540aSrobert static const int digits10 = __glibcxx_digits10 (unsigned short); 642404b540aSrobert static const bool is_signed = false; 643404b540aSrobert static const bool is_integer = true; 644404b540aSrobert static const bool is_exact = true; 645404b540aSrobert static const int radix = 2; 646404b540aSrobert static unsigned short epsilon() throw() 647404b540aSrobert { return 0; } 648404b540aSrobert static unsigned short round_error() throw() 649404b540aSrobert { return 0; } 650404b540aSrobert 651404b540aSrobert static const int min_exponent = 0; 652404b540aSrobert static const int min_exponent10 = 0; 653404b540aSrobert static const int max_exponent = 0; 654404b540aSrobert static const int max_exponent10 = 0; 655404b540aSrobert 656404b540aSrobert static const bool has_infinity = false; 657404b540aSrobert static const bool has_quiet_NaN = false; 658404b540aSrobert static const bool has_signaling_NaN = false; 659404b540aSrobert static const float_denorm_style has_denorm = denorm_absent; 660404b540aSrobert static const bool has_denorm_loss = false; 661404b540aSrobert 662404b540aSrobert static unsigned short infinity() throw() 663404b540aSrobert { return static_cast<unsigned short>(0); } 664404b540aSrobert static unsigned short quiet_NaN() throw() 665404b540aSrobert { return static_cast<unsigned short>(0); } 666404b540aSrobert static unsigned short signaling_NaN() throw() 667404b540aSrobert { return static_cast<unsigned short>(0); } 668404b540aSrobert static unsigned short denorm_min() throw() 669404b540aSrobert { return static_cast<unsigned short>(0); } 670404b540aSrobert 671404b540aSrobert static const bool is_iec559 = false; 672404b540aSrobert static const bool is_bounded = true; 673404b540aSrobert static const bool is_modulo = true; 674404b540aSrobert 675404b540aSrobert static const bool traps = __glibcxx_integral_traps; 676404b540aSrobert static const bool tinyness_before = false; 677404b540aSrobert static const float_round_style round_style = round_toward_zero; 678404b540aSrobert }; 679404b540aSrobert 680404b540aSrobert /// numeric_limits<int> specialization. 681404b540aSrobert template<> 682404b540aSrobert struct numeric_limits<int> 683404b540aSrobert { 684404b540aSrobert static const bool is_specialized = true; 685404b540aSrobert 686404b540aSrobert static int min() throw() 687404b540aSrobert { return -__INT_MAX__ - 1; } 688404b540aSrobert static int max() throw() 689404b540aSrobert { return __INT_MAX__; } 690404b540aSrobert 691404b540aSrobert static const int digits = __glibcxx_digits (int); 692404b540aSrobert static const int digits10 = __glibcxx_digits10 (int); 693404b540aSrobert static const bool is_signed = true; 694404b540aSrobert static const bool is_integer = true; 695404b540aSrobert static const bool is_exact = true; 696404b540aSrobert static const int radix = 2; 697404b540aSrobert static int epsilon() throw() 698404b540aSrobert { return 0; } 699404b540aSrobert static int round_error() throw() 700404b540aSrobert { return 0; } 701404b540aSrobert 702404b540aSrobert static const int min_exponent = 0; 703404b540aSrobert static const int min_exponent10 = 0; 704404b540aSrobert static const int max_exponent = 0; 705404b540aSrobert static const int max_exponent10 = 0; 706404b540aSrobert 707404b540aSrobert static const bool has_infinity = false; 708404b540aSrobert static const bool has_quiet_NaN = false; 709404b540aSrobert static const bool has_signaling_NaN = false; 710404b540aSrobert static const float_denorm_style has_denorm = denorm_absent; 711404b540aSrobert static const bool has_denorm_loss = false; 712404b540aSrobert 713404b540aSrobert static int infinity() throw() 714404b540aSrobert { return static_cast<int>(0); } 715404b540aSrobert static int quiet_NaN() throw() 716404b540aSrobert { return static_cast<int>(0); } 717404b540aSrobert static int signaling_NaN() throw() 718404b540aSrobert { return static_cast<int>(0); } 719404b540aSrobert static int denorm_min() throw() 720404b540aSrobert { return static_cast<int>(0); } 721404b540aSrobert 722404b540aSrobert static const bool is_iec559 = false; 723404b540aSrobert static const bool is_bounded = true; 724404b540aSrobert static const bool is_modulo = true; 725404b540aSrobert 726404b540aSrobert static const bool traps = __glibcxx_integral_traps; 727404b540aSrobert static const bool tinyness_before = false; 728404b540aSrobert static const float_round_style round_style = round_toward_zero; 729404b540aSrobert }; 730404b540aSrobert 731404b540aSrobert /// numeric_limits<unsigned int> specialization. 732404b540aSrobert template<> 733404b540aSrobert struct numeric_limits<unsigned int> 734404b540aSrobert { 735404b540aSrobert static const bool is_specialized = true; 736404b540aSrobert 737404b540aSrobert static unsigned int min() throw() 738404b540aSrobert { return 0; } 739404b540aSrobert static unsigned int max() throw() 740404b540aSrobert { return __INT_MAX__ * 2U + 1; } 741404b540aSrobert 742404b540aSrobert static const int digits = __glibcxx_digits (unsigned int); 743404b540aSrobert static const int digits10 = __glibcxx_digits10 (unsigned int); 744404b540aSrobert static const bool is_signed = false; 745404b540aSrobert static const bool is_integer = true; 746404b540aSrobert static const bool is_exact = true; 747404b540aSrobert static const int radix = 2; 748404b540aSrobert static unsigned int epsilon() throw() 749404b540aSrobert { return 0; } 750404b540aSrobert static unsigned int round_error() throw() 751404b540aSrobert { return 0; } 752404b540aSrobert 753404b540aSrobert static const int min_exponent = 0; 754404b540aSrobert static const int min_exponent10 = 0; 755404b540aSrobert static const int max_exponent = 0; 756404b540aSrobert static const int max_exponent10 = 0; 757404b540aSrobert 758404b540aSrobert static const bool has_infinity = false; 759404b540aSrobert static const bool has_quiet_NaN = false; 760404b540aSrobert static const bool has_signaling_NaN = false; 761404b540aSrobert static const float_denorm_style has_denorm = denorm_absent; 762404b540aSrobert static const bool has_denorm_loss = false; 763404b540aSrobert 764404b540aSrobert static unsigned int infinity() throw() 765404b540aSrobert { return static_cast<unsigned int>(0); } 766404b540aSrobert static unsigned int quiet_NaN() throw() 767404b540aSrobert { return static_cast<unsigned int>(0); } 768404b540aSrobert static unsigned int signaling_NaN() throw() 769404b540aSrobert { return static_cast<unsigned int>(0); } 770404b540aSrobert static unsigned int denorm_min() throw() 771404b540aSrobert { return static_cast<unsigned int>(0); } 772404b540aSrobert 773404b540aSrobert static const bool is_iec559 = false; 774404b540aSrobert static const bool is_bounded = true; 775404b540aSrobert static const bool is_modulo = true; 776404b540aSrobert 777404b540aSrobert static const bool traps = __glibcxx_integral_traps; 778404b540aSrobert static const bool tinyness_before = false; 779404b540aSrobert static const float_round_style round_style = round_toward_zero; 780404b540aSrobert }; 781404b540aSrobert 782404b540aSrobert /// numeric_limits<long> specialization. 783404b540aSrobert template<> 784404b540aSrobert struct numeric_limits<long> 785404b540aSrobert { 786404b540aSrobert static const bool is_specialized = true; 787404b540aSrobert 788404b540aSrobert static long min() throw() 789404b540aSrobert { return -__LONG_MAX__ - 1; } 790404b540aSrobert static long max() throw() 791404b540aSrobert { return __LONG_MAX__; } 792404b540aSrobert 793404b540aSrobert static const int digits = __glibcxx_digits (long); 794404b540aSrobert static const int digits10 = __glibcxx_digits10 (long); 795404b540aSrobert static const bool is_signed = true; 796404b540aSrobert static const bool is_integer = true; 797404b540aSrobert static const bool is_exact = true; 798404b540aSrobert static const int radix = 2; 799404b540aSrobert static long epsilon() throw() 800404b540aSrobert { return 0; } 801404b540aSrobert static long round_error() throw() 802404b540aSrobert { return 0; } 803404b540aSrobert 804404b540aSrobert static const int min_exponent = 0; 805404b540aSrobert static const int min_exponent10 = 0; 806404b540aSrobert static const int max_exponent = 0; 807404b540aSrobert static const int max_exponent10 = 0; 808404b540aSrobert 809404b540aSrobert static const bool has_infinity = false; 810404b540aSrobert static const bool has_quiet_NaN = false; 811404b540aSrobert static const bool has_signaling_NaN = false; 812404b540aSrobert static const float_denorm_style has_denorm = denorm_absent; 813404b540aSrobert static const bool has_denorm_loss = false; 814404b540aSrobert 815404b540aSrobert static long infinity() throw() 816404b540aSrobert { return static_cast<long>(0); } 817404b540aSrobert static long quiet_NaN() throw() 818404b540aSrobert { return static_cast<long>(0); } 819404b540aSrobert static long signaling_NaN() throw() 820404b540aSrobert { return static_cast<long>(0); } 821404b540aSrobert static long denorm_min() throw() 822404b540aSrobert { return static_cast<long>(0); } 823404b540aSrobert 824404b540aSrobert static const bool is_iec559 = false; 825404b540aSrobert static const bool is_bounded = true; 826404b540aSrobert static const bool is_modulo = true; 827404b540aSrobert 828404b540aSrobert static const bool traps = __glibcxx_integral_traps; 829404b540aSrobert static const bool tinyness_before = false; 830404b540aSrobert static const float_round_style round_style = round_toward_zero; 831404b540aSrobert }; 832404b540aSrobert 833404b540aSrobert /// numeric_limits<unsigned long> specialization. 834404b540aSrobert template<> 835404b540aSrobert struct numeric_limits<unsigned long> 836404b540aSrobert { 837404b540aSrobert static const bool is_specialized = true; 838404b540aSrobert 839404b540aSrobert static unsigned long min() throw() 840404b540aSrobert { return 0; } 841404b540aSrobert static unsigned long max() throw() 842404b540aSrobert { return __LONG_MAX__ * 2UL + 1; } 843404b540aSrobert 844404b540aSrobert static const int digits = __glibcxx_digits (unsigned long); 845404b540aSrobert static const int digits10 = __glibcxx_digits10 (unsigned long); 846404b540aSrobert static const bool is_signed = false; 847404b540aSrobert static const bool is_integer = true; 848404b540aSrobert static const bool is_exact = true; 849404b540aSrobert static const int radix = 2; 850404b540aSrobert static unsigned long epsilon() throw() 851404b540aSrobert { return 0; } 852404b540aSrobert static unsigned long round_error() throw() 853404b540aSrobert { return 0; } 854404b540aSrobert 855404b540aSrobert static const int min_exponent = 0; 856404b540aSrobert static const int min_exponent10 = 0; 857404b540aSrobert static const int max_exponent = 0; 858404b540aSrobert static const int max_exponent10 = 0; 859404b540aSrobert 860404b540aSrobert static const bool has_infinity = false; 861404b540aSrobert static const bool has_quiet_NaN = false; 862404b540aSrobert static const bool has_signaling_NaN = false; 863404b540aSrobert static const float_denorm_style has_denorm = denorm_absent; 864404b540aSrobert static const bool has_denorm_loss = false; 865404b540aSrobert 866404b540aSrobert static unsigned long infinity() throw() 867404b540aSrobert { return static_cast<unsigned long>(0); } 868404b540aSrobert static unsigned long quiet_NaN() throw() 869404b540aSrobert { return static_cast<unsigned long>(0); } 870404b540aSrobert static unsigned long signaling_NaN() throw() 871404b540aSrobert { return static_cast<unsigned long>(0); } 872404b540aSrobert static unsigned long denorm_min() throw() 873404b540aSrobert { return static_cast<unsigned long>(0); } 874404b540aSrobert 875404b540aSrobert static const bool is_iec559 = false; 876404b540aSrobert static const bool is_bounded = true; 877404b540aSrobert static const bool is_modulo = true; 878404b540aSrobert 879404b540aSrobert static const bool traps = __glibcxx_integral_traps; 880404b540aSrobert static const bool tinyness_before = false; 881404b540aSrobert static const float_round_style round_style = round_toward_zero; 882404b540aSrobert }; 883404b540aSrobert 884404b540aSrobert /// numeric_limits<long long> specialization. 885404b540aSrobert template<> 886404b540aSrobert struct numeric_limits<long long> 887404b540aSrobert { 888404b540aSrobert static const bool is_specialized = true; 889404b540aSrobert 890404b540aSrobert static long long min() throw() 891404b540aSrobert { return -__LONG_LONG_MAX__ - 1; } 892404b540aSrobert static long long max() throw() 893404b540aSrobert { return __LONG_LONG_MAX__; } 894404b540aSrobert 895404b540aSrobert static const int digits = __glibcxx_digits (long long); 896404b540aSrobert static const int digits10 = __glibcxx_digits10 (long long); 897404b540aSrobert static const bool is_signed = true; 898404b540aSrobert static const bool is_integer = true; 899404b540aSrobert static const bool is_exact = true; 900404b540aSrobert static const int radix = 2; 901404b540aSrobert static long long epsilon() throw() 902404b540aSrobert { return 0; } 903404b540aSrobert static long long round_error() throw() 904404b540aSrobert { return 0; } 905404b540aSrobert 906404b540aSrobert static const int min_exponent = 0; 907404b540aSrobert static const int min_exponent10 = 0; 908404b540aSrobert static const int max_exponent = 0; 909404b540aSrobert static const int max_exponent10 = 0; 910404b540aSrobert 911404b540aSrobert static const bool has_infinity = false; 912404b540aSrobert static const bool has_quiet_NaN = false; 913404b540aSrobert static const bool has_signaling_NaN = false; 914404b540aSrobert static const float_denorm_style has_denorm = denorm_absent; 915404b540aSrobert static const bool has_denorm_loss = false; 916404b540aSrobert 917404b540aSrobert static long long infinity() throw() 918404b540aSrobert { return static_cast<long long>(0); } 919404b540aSrobert static long long quiet_NaN() throw() 920404b540aSrobert { return static_cast<long long>(0); } 921404b540aSrobert static long long signaling_NaN() throw() 922404b540aSrobert { return static_cast<long long>(0); } 923404b540aSrobert static long long denorm_min() throw() 924404b540aSrobert { return static_cast<long long>(0); } 925404b540aSrobert 926404b540aSrobert static const bool is_iec559 = false; 927404b540aSrobert static const bool is_bounded = true; 928404b540aSrobert static const bool is_modulo = true; 929404b540aSrobert 930404b540aSrobert static const bool traps = __glibcxx_integral_traps; 931404b540aSrobert static const bool tinyness_before = false; 932404b540aSrobert static const float_round_style round_style = round_toward_zero; 933404b540aSrobert }; 934404b540aSrobert 935404b540aSrobert /// numeric_limits<unsigned long long> specialization. 936404b540aSrobert template<> 937404b540aSrobert struct numeric_limits<unsigned long long> 938404b540aSrobert { 939404b540aSrobert static const bool is_specialized = true; 940404b540aSrobert 941404b540aSrobert static unsigned long long min() throw() 942404b540aSrobert { return 0; } 943404b540aSrobert static unsigned long long max() throw() 944404b540aSrobert { return __LONG_LONG_MAX__ * 2ULL + 1; } 945404b540aSrobert 946404b540aSrobert static const int digits = __glibcxx_digits (unsigned long long); 947404b540aSrobert static const int digits10 = __glibcxx_digits10 (unsigned long long); 948404b540aSrobert static const bool is_signed = false; 949404b540aSrobert static const bool is_integer = true; 950404b540aSrobert static const bool is_exact = true; 951404b540aSrobert static const int radix = 2; 952404b540aSrobert static unsigned long long epsilon() throw() 953404b540aSrobert { return 0; } 954404b540aSrobert static unsigned long long round_error() throw() 955404b540aSrobert { return 0; } 956404b540aSrobert 957404b540aSrobert static const int min_exponent = 0; 958404b540aSrobert static const int min_exponent10 = 0; 959404b540aSrobert static const int max_exponent = 0; 960404b540aSrobert static const int max_exponent10 = 0; 961404b540aSrobert 962404b540aSrobert static const bool has_infinity = false; 963404b540aSrobert static const bool has_quiet_NaN = false; 964404b540aSrobert static const bool has_signaling_NaN = false; 965404b540aSrobert static const float_denorm_style has_denorm = denorm_absent; 966404b540aSrobert static const bool has_denorm_loss = false; 967404b540aSrobert 968404b540aSrobert static unsigned long long infinity() throw() 969404b540aSrobert { return static_cast<unsigned long long>(0); } 970404b540aSrobert static unsigned long long quiet_NaN() throw() 971404b540aSrobert { return static_cast<unsigned long long>(0); } 972404b540aSrobert static unsigned long long signaling_NaN() throw() 973404b540aSrobert { return static_cast<unsigned long long>(0); } 974404b540aSrobert static unsigned long long denorm_min() throw() 975404b540aSrobert { return static_cast<unsigned long long>(0); } 976404b540aSrobert 977404b540aSrobert static const bool is_iec559 = false; 978404b540aSrobert static const bool is_bounded = true; 979404b540aSrobert static const bool is_modulo = true; 980404b540aSrobert 981404b540aSrobert static const bool traps = __glibcxx_integral_traps; 982404b540aSrobert static const bool tinyness_before = false; 983404b540aSrobert static const float_round_style round_style = round_toward_zero; 984404b540aSrobert }; 985404b540aSrobert 986404b540aSrobert /// numeric_limits<float> specialization. 987404b540aSrobert template<> 988404b540aSrobert struct numeric_limits<float> 989404b540aSrobert { 990404b540aSrobert static const bool is_specialized = true; 991404b540aSrobert 992404b540aSrobert static float min() throw() 993404b540aSrobert { return __FLT_MIN__; } 994404b540aSrobert static float max() throw() 995404b540aSrobert { return __FLT_MAX__; } 996404b540aSrobert 997404b540aSrobert static const int digits = __FLT_MANT_DIG__; 998404b540aSrobert static const int digits10 = __FLT_DIG__; 999404b540aSrobert static const bool is_signed = true; 1000404b540aSrobert static const bool is_integer = false; 1001404b540aSrobert static const bool is_exact = false; 1002404b540aSrobert static const int radix = __FLT_RADIX__; 1003404b540aSrobert static float epsilon() throw() 1004404b540aSrobert { return __FLT_EPSILON__; } 1005404b540aSrobert static float round_error() throw() 1006404b540aSrobert { return 0.5F; } 1007404b540aSrobert 1008404b540aSrobert static const int min_exponent = __FLT_MIN_EXP__; 1009404b540aSrobert static const int min_exponent10 = __FLT_MIN_10_EXP__; 1010404b540aSrobert static const int max_exponent = __FLT_MAX_EXP__; 1011404b540aSrobert static const int max_exponent10 = __FLT_MAX_10_EXP__; 1012404b540aSrobert 1013404b540aSrobert static const bool has_infinity = __FLT_HAS_INFINITY__; 1014404b540aSrobert static const bool has_quiet_NaN = __FLT_HAS_QUIET_NAN__; 1015404b540aSrobert static const bool has_signaling_NaN = has_quiet_NaN; 1016404b540aSrobert static const float_denorm_style has_denorm 1017404b540aSrobert = bool(__FLT_HAS_DENORM__) ? denorm_present : denorm_absent; 1018404b540aSrobert static const bool has_denorm_loss = __glibcxx_float_has_denorm_loss; 1019404b540aSrobert 1020404b540aSrobert static float infinity() throw() 1021404b540aSrobert { return __builtin_huge_valf (); } 1022404b540aSrobert static float quiet_NaN() throw() 1023404b540aSrobert { return __builtin_nanf (""); } 1024404b540aSrobert static float signaling_NaN() throw() 1025404b540aSrobert { return __builtin_nansf (""); } 1026404b540aSrobert static float denorm_min() throw() 1027404b540aSrobert { return __FLT_DENORM_MIN__; } 1028404b540aSrobert 1029404b540aSrobert static const bool is_iec559 1030404b540aSrobert = has_infinity && has_quiet_NaN && has_denorm == denorm_present; 1031404b540aSrobert static const bool is_bounded = true; 1032404b540aSrobert static const bool is_modulo = false; 1033404b540aSrobert 1034404b540aSrobert static const bool traps = __glibcxx_float_traps; 1035404b540aSrobert static const bool tinyness_before = __glibcxx_float_tinyness_before; 1036404b540aSrobert static const float_round_style round_style = round_to_nearest; 1037404b540aSrobert }; 1038404b540aSrobert 1039404b540aSrobert #undef __glibcxx_float_has_denorm_loss 1040404b540aSrobert #undef __glibcxx_float_traps 1041404b540aSrobert #undef __glibcxx_float_tinyness_before 1042404b540aSrobert 1043404b540aSrobert /// numeric_limits<double> specialization. 1044404b540aSrobert template<> 1045404b540aSrobert struct numeric_limits<double> 1046404b540aSrobert { 1047404b540aSrobert static const bool is_specialized = true; 1048404b540aSrobert 1049404b540aSrobert static double min() throw() 1050404b540aSrobert { return __DBL_MIN__; } 1051404b540aSrobert static double max() throw() 1052404b540aSrobert { return __DBL_MAX__; } 1053404b540aSrobert 1054404b540aSrobert static const int digits = __DBL_MANT_DIG__; 1055404b540aSrobert static const int digits10 = __DBL_DIG__; 1056404b540aSrobert static const bool is_signed = true; 1057404b540aSrobert static const bool is_integer = false; 1058404b540aSrobert static const bool is_exact = false; 1059404b540aSrobert static const int radix = __FLT_RADIX__; 1060404b540aSrobert static double epsilon() throw() 1061404b540aSrobert { return __DBL_EPSILON__; } 1062404b540aSrobert static double round_error() throw() 1063404b540aSrobert { return 0.5; } 1064404b540aSrobert 1065404b540aSrobert static const int min_exponent = __DBL_MIN_EXP__; 1066404b540aSrobert static const int min_exponent10 = __DBL_MIN_10_EXP__; 1067404b540aSrobert static const int max_exponent = __DBL_MAX_EXP__; 1068404b540aSrobert static const int max_exponent10 = __DBL_MAX_10_EXP__; 1069404b540aSrobert 1070404b540aSrobert static const bool has_infinity = __DBL_HAS_INFINITY__; 1071404b540aSrobert static const bool has_quiet_NaN = __DBL_HAS_QUIET_NAN__; 1072404b540aSrobert static const bool has_signaling_NaN = has_quiet_NaN; 1073404b540aSrobert static const float_denorm_style has_denorm 1074404b540aSrobert = bool(__DBL_HAS_DENORM__) ? denorm_present : denorm_absent; 1075404b540aSrobert static const bool has_denorm_loss = __glibcxx_double_has_denorm_loss; 1076404b540aSrobert 1077404b540aSrobert static double infinity() throw() 1078404b540aSrobert { return __builtin_huge_val(); } 1079404b540aSrobert static double quiet_NaN() throw() 1080404b540aSrobert { return __builtin_nan (""); } 1081404b540aSrobert static double signaling_NaN() throw() 1082404b540aSrobert { return __builtin_nans (""); } 1083404b540aSrobert static double denorm_min() throw() 1084404b540aSrobert { return __DBL_DENORM_MIN__; } 1085404b540aSrobert 1086404b540aSrobert static const bool is_iec559 1087404b540aSrobert = has_infinity && has_quiet_NaN && has_denorm == denorm_present; 1088404b540aSrobert static const bool is_bounded = true; 1089404b540aSrobert static const bool is_modulo = false; 1090404b540aSrobert 1091404b540aSrobert static const bool traps = __glibcxx_double_traps; 1092404b540aSrobert static const bool tinyness_before = __glibcxx_double_tinyness_before; 1093404b540aSrobert static const float_round_style round_style = round_to_nearest; 1094404b540aSrobert }; 1095404b540aSrobert 1096404b540aSrobert #undef __glibcxx_double_has_denorm_loss 1097404b540aSrobert #undef __glibcxx_double_traps 1098404b540aSrobert #undef __glibcxx_double_tinyness_before 1099404b540aSrobert 1100404b540aSrobert /// numeric_limits<long double> specialization. 1101404b540aSrobert template<> 1102404b540aSrobert struct numeric_limits<long double> 1103404b540aSrobert { 1104404b540aSrobert static const bool is_specialized = true; 1105404b540aSrobert 1106404b540aSrobert static long double min() throw() 1107404b540aSrobert { return __LDBL_MIN__; } 1108404b540aSrobert static long double max() throw() 1109404b540aSrobert { return __LDBL_MAX__; } 1110404b540aSrobert 1111404b540aSrobert static const int digits = __LDBL_MANT_DIG__; 1112404b540aSrobert static const int digits10 = __LDBL_DIG__; 1113404b540aSrobert static const bool is_signed = true; 1114404b540aSrobert static const bool is_integer = false; 1115404b540aSrobert static const bool is_exact = false; 1116404b540aSrobert static const int radix = __FLT_RADIX__; 1117404b540aSrobert static long double epsilon() throw() 1118404b540aSrobert { return __LDBL_EPSILON__; } 1119404b540aSrobert static long double round_error() throw() 1120404b540aSrobert { return 0.5L; } 1121404b540aSrobert 1122404b540aSrobert static const int min_exponent = __LDBL_MIN_EXP__; 1123404b540aSrobert static const int min_exponent10 = __LDBL_MIN_10_EXP__; 1124404b540aSrobert static const int max_exponent = __LDBL_MAX_EXP__; 1125404b540aSrobert static const int max_exponent10 = __LDBL_MAX_10_EXP__; 1126404b540aSrobert 1127404b540aSrobert static const bool has_infinity = __LDBL_HAS_INFINITY__; 1128404b540aSrobert static const bool has_quiet_NaN = __LDBL_HAS_QUIET_NAN__; 1129404b540aSrobert static const bool has_signaling_NaN = has_quiet_NaN; 1130404b540aSrobert static const float_denorm_style has_denorm 1131404b540aSrobert = bool(__LDBL_HAS_DENORM__) ? denorm_present : denorm_absent; 1132404b540aSrobert static const bool has_denorm_loss 1133404b540aSrobert = __glibcxx_long_double_has_denorm_loss; 1134404b540aSrobert 1135404b540aSrobert static long double infinity() throw() 1136404b540aSrobert { return __builtin_huge_vall (); } 1137404b540aSrobert static long double quiet_NaN() throw() 1138404b540aSrobert { return __builtin_nanl (""); } 1139404b540aSrobert static long double signaling_NaN() throw() 1140404b540aSrobert { return __builtin_nansl (""); } 1141404b540aSrobert static long double denorm_min() throw() 1142404b540aSrobert { return __LDBL_DENORM_MIN__; } 1143404b540aSrobert 1144404b540aSrobert static const bool is_iec559 1145404b540aSrobert = has_infinity && has_quiet_NaN && has_denorm == denorm_present; 1146404b540aSrobert static const bool is_bounded = true; 1147404b540aSrobert static const bool is_modulo = false; 1148404b540aSrobert 1149404b540aSrobert static const bool traps = __glibcxx_long_double_traps; 1150404b540aSrobert static const bool tinyness_before = __glibcxx_long_double_tinyness_before; 1151404b540aSrobert static const float_round_style round_style = round_to_nearest; 1152404b540aSrobert }; 1153404b540aSrobert 1154404b540aSrobert #undef __glibcxx_long_double_has_denorm_loss 1155404b540aSrobert #undef __glibcxx_long_double_traps 1156404b540aSrobert #undef __glibcxx_long_double_tinyness_before 1157404b540aSrobert 1158404b540aSrobert _GLIBCXX_END_NAMESPACE 1159404b540aSrobert 1160404b540aSrobert #undef __glibcxx_signed 1161404b540aSrobert #undef __glibcxx_min 1162404b540aSrobert #undef __glibcxx_max 1163404b540aSrobert #undef __glibcxx_digits 1164404b540aSrobert #undef __glibcxx_digits10 1165404b540aSrobert 1166404b540aSrobert #endif // _GLIBCXX_NUMERIC_LIMITS 1167