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