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