1169691Skan// The template and inlines for the numeric_limits classes. -*- C++ -*- 297403Sobrien 3169691Skan// Copyright (C) 1999, 2000, 2001, 2002, 2003, 2005 4169691Skan// Free Software Foundation, Inc. 597403Sobrien// 697403Sobrien// This file is part of the GNU ISO C++ Library. This library is free 797403Sobrien// software; you can redistribute it and/or modify it under the 897403Sobrien// terms of the GNU General Public License as published by the 997403Sobrien// Free Software Foundation; either version 2, or (at your option) 1097403Sobrien// any later version. 1197403Sobrien 1297403Sobrien// This library is distributed in the hope that it will be useful, 1397403Sobrien// but WITHOUT ANY WARRANTY; without even the implied warranty of 1497403Sobrien// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 1597403Sobrien// GNU General Public License for more details. 1697403Sobrien 1797403Sobrien// You should have received a copy of the GNU General Public License along 1897403Sobrien// with this library; see the file COPYING. If not, write to the Free 19169691Skan// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, 2097403Sobrien// USA. 2197403Sobrien 2297403Sobrien// As a special exception, you may use this file as part of a free software 2397403Sobrien// library without restriction. Specifically, if other files instantiate 2497403Sobrien// templates or use macros or inline functions from this file, or you compile 2597403Sobrien// this file and link it with other files to produce an executable, this 2697403Sobrien// file does not by itself cause the resulting executable to be covered by 2797403Sobrien// the GNU General Public License. This exception does not however 2897403Sobrien// invalidate any other reasons why the executable file might be covered by 2997403Sobrien// the GNU General Public License. 3097403Sobrien 31169691Skan/** @file limits 32169691Skan * This is a Standard C++ Library header. 33169691Skan */ 34169691Skan 3597403Sobrien// Note: this is not a conforming implementation. 3697403Sobrien// Written by Gabriel Dos Reis <gdr@codesourcery.com> 3797403Sobrien 3897403Sobrien// 3997403Sobrien// ISO 14882:1998 4097403Sobrien// 18.2.1 4197403Sobrien// 4297403Sobrien 43132720Skan#ifndef _GLIBCXX_NUMERIC_LIMITS 44132720Skan#define _GLIBCXX_NUMERIC_LIMITS 1 4597403Sobrien 4697403Sobrien#pragma GCC system_header 4797403Sobrien 4897403Sobrien#include <bits/c++config.h> 4997403Sobrien 5097403Sobrien// 5197403Sobrien// The numeric_limits<> traits document implementation-defined aspects 5297403Sobrien// of fundamental arithmetic data types (integers and floating points). 5397403Sobrien// From Standard C++ point of view, there are 13 such types: 5497403Sobrien// * integers 5597403Sobrien// bool (1) 5697403Sobrien// char, signed char, unsigned char (3) 5797403Sobrien// short, unsigned short (2) 5897403Sobrien// int, unsigned (2) 5997403Sobrien// long, unsigned long (2) 6097403Sobrien// 6197403Sobrien// * floating points 6297403Sobrien// float (1) 6397403Sobrien// double (1) 6497403Sobrien// long double (1) 6597403Sobrien// 66117397Skan// GNU C++ undertstands (where supported by the host C-library) 6797403Sobrien// * integer 6897403Sobrien// long long, unsigned long long (2) 6997403Sobrien// 7097403Sobrien// which brings us to 15 fundamental arithmetic data types in GNU C++. 7197403Sobrien// 72117397Skan// 7397403Sobrien// Since a numeric_limits<> is a bit tricky to get right, we rely on 7497403Sobrien// an interface composed of macros which should be defined in config/os 7597403Sobrien// or config/cpu when they differ from the generic (read arbitrary) 7697403Sobrien// definitions given here. 7797403Sobrien// 7897403Sobrien 7997403Sobrien// These values can be overridden in the target configuration file. 8097403Sobrien// The default values are appropriate for many 32-bit targets. 8197403Sobrien 82117397Skan// GCC only intrinsicly supports modulo integral types. The only remaining 83117397Skan// integral exceptional values is division by zero. Only targets that do not 84117397Skan// signal division by zero in some "hard to ignore" way should use false. 85132720Skan#ifndef __glibcxx_integral_traps 86132720Skan# define __glibcxx_integral_traps true 8797403Sobrien#endif 8897403Sobrien 8997403Sobrien// float 9097403Sobrien// 9197403Sobrien 92117397Skan// Default values. Should be overriden in configuration files if necessary. 9397403Sobrien 94132720Skan#ifndef __glibcxx_float_has_denorm_loss 95132720Skan# define __glibcxx_float_has_denorm_loss false 9697403Sobrien#endif 97132720Skan#ifndef __glibcxx_float_traps 98132720Skan# define __glibcxx_float_traps false 9997403Sobrien#endif 100132720Skan#ifndef __glibcxx_float_tinyness_before 101132720Skan# define __glibcxx_float_tinyness_before false 10297403Sobrien#endif 10397403Sobrien 10497403Sobrien// double 10597403Sobrien 106117397Skan// Default values. Should be overriden in configuration files if necessary. 10797403Sobrien 108132720Skan#ifndef __glibcxx_double_has_denorm_loss 109132720Skan# define __glibcxx_double_has_denorm_loss false 11097403Sobrien#endif 111132720Skan#ifndef __glibcxx_double_traps 112132720Skan# define __glibcxx_double_traps false 11397403Sobrien#endif 114132720Skan#ifndef __glibcxx_double_tinyness_before 115132720Skan# define __glibcxx_double_tinyness_before false 11697403Sobrien#endif 11797403Sobrien 11897403Sobrien// long double 11997403Sobrien 120117397Skan// Default values. Should be overriden in configuration files if necessary. 12197403Sobrien 122132720Skan#ifndef __glibcxx_long_double_has_denorm_loss 123132720Skan# define __glibcxx_long_double_has_denorm_loss false 12497403Sobrien#endif 125132720Skan#ifndef __glibcxx_long_double_traps 126132720Skan# define __glibcxx_long_double_traps false 12797403Sobrien#endif 128132720Skan#ifndef __glibcxx_long_double_tinyness_before 129132720Skan# define __glibcxx_long_double_tinyness_before false 13097403Sobrien#endif 13197403Sobrien 132117397Skan// You should not need to define any macros below this point. 13397403Sobrien 134132720Skan#define __glibcxx_signed(T) ((T)(-1) < 0) 13597403Sobrien 136132720Skan#define __glibcxx_min(T) \ 137259283Spfg (__glibcxx_signed (T) ? (((T)1 << (__glibcxx_digits (T) - 1)) << 1) : (T)0) 13897403Sobrien 139132720Skan#define __glibcxx_max(T) \ 140259283Spfg (__glibcxx_signed (T) ? \ 141259283Spfg (((((T)1 << (__glibcxx_digits (T) - 1)) - 1) << 1) + 1) : ~(T)0) 14297403Sobrien 143132720Skan#define __glibcxx_digits(T) \ 144132720Skan (sizeof(T) * __CHAR_BIT__ - __glibcxx_signed (T)) 14597403Sobrien 146117397Skan// The fraction 643/2136 approximates log10(2) to 7 significant digits. 147132720Skan#define __glibcxx_digits10(T) \ 148132720Skan (__glibcxx_digits (T) * 643 / 2136) 14997403Sobrien 15097403Sobrien 151169691Skan_GLIBCXX_BEGIN_NAMESPACE(std) 152169691Skan 153132720Skan /** 154132720Skan * @brief Describes the rounding style for floating-point types. 155132720Skan * 156132720Skan * This is used in the std::numeric_limits class. 157132720Skan */ 158117397Skan enum float_round_style 15997403Sobrien { 160132720Skan round_indeterminate = -1, ///< Self-explanatory. 161132720Skan round_toward_zero = 0, ///< Self-explanatory. 162132720Skan round_to_nearest = 1, ///< To the nearest representable value. 163132720Skan round_toward_infinity = 2, ///< Self-explanatory. 164132720Skan round_toward_neg_infinity = 3 ///< Self-explanatory. 16597403Sobrien }; 16697403Sobrien 167132720Skan /** 168132720Skan * @brief Describes the denormalization for floating-point types. 169132720Skan * 170132720Skan * These values represent the presence or absence of a variable number 171132720Skan * of exponent bits. This type is used in the std::numeric_limits class. 172132720Skan */ 173117397Skan enum float_denorm_style 17497403Sobrien { 175132720Skan /// Indeterminate at compile time whether denormalized values are allowed. 17697403Sobrien denorm_indeterminate = -1, 177132720Skan /// The type does not allow denormalized values. 17897403Sobrien denorm_absent = 0, 179132720Skan /// The type allows denormalized values. 18097403Sobrien denorm_present = 1 18197403Sobrien }; 18297403Sobrien 183132720Skan /** 184132720Skan * @brief Part of std::numeric_limits. 185132720Skan * 186132720Skan * The @c static @c const members are usable as integral constant 187132720Skan * expressions. 188132720Skan * 189132720Skan * @note This is a seperate class for purposes of efficiency; you 190132720Skan * should only access these members as part of an instantiation 191132720Skan * of the std::numeric_limits class. 192132720Skan */ 19397403Sobrien struct __numeric_limits_base 19497403Sobrien { 195132720Skan /** This will be true for all fundamental types (which have 196132720Skan specializations), and false for everything else. */ 19797403Sobrien static const bool is_specialized = false; 19897403Sobrien 199132720Skan /** The number of @c radix digits that be represented without change: for 200132720Skan integer types, the number of non-sign bits in the mantissa; for 201132720Skan floating types, the number of @c radix digits in the mantissa. */ 20297403Sobrien static const int digits = 0; 203132720Skan /** The number of base 10 digits that can be represented without change. */ 20497403Sobrien static const int digits10 = 0; 205132720Skan /** True if the type is signed. */ 20697403Sobrien static const bool is_signed = false; 207132720Skan /** True if the type is integer. 208132720Skan * @if maint 209132720Skan * Is this supposed to be "if the type is integral"? 210132720Skan * @endif 211132720Skan */ 21297403Sobrien static const bool is_integer = false; 213132720Skan /** True if the type uses an exact representation. "All integer types are 214132720Skan exact, but not all exact types are integer. For example, rational and 215132720Skan fixed-exponent representations are exact but not integer." 216132720Skan [18.2.1.2]/15 */ 21797403Sobrien static const bool is_exact = false; 218132720Skan /** For integer types, specifies the base of the representation. For 219132720Skan floating types, specifies the base of the exponent representation. */ 22097403Sobrien static const int radix = 0; 22197403Sobrien 222132720Skan /** The minimum negative integer such that @c radix raised to the power of 223132720Skan (one less than that integer) is a normalized floating point number. */ 22497403Sobrien static const int min_exponent = 0; 225132720Skan /** The minimum negative integer such that 10 raised to that power is in 226132720Skan the range of normalized floating point numbers. */ 22797403Sobrien static const int min_exponent10 = 0; 228132720Skan /** The maximum positive integer such that @c radix raised to the power of 229132720Skan (one less than that integer) is a representable finite floating point 230132720Skan number. */ 23197403Sobrien static const int max_exponent = 0; 232132720Skan /** The maximum positive integer such that 10 raised to that power is in 233132720Skan the range of representable finite floating point numbers. */ 23497403Sobrien static const int max_exponent10 = 0; 235117397Skan 236132720Skan /** True if the type has a representation for positive infinity. */ 23797403Sobrien static const bool has_infinity = false; 238132720Skan /** True if the type has a representation for a quiet (non-signaling) 239132720Skan "Not a Number." */ 24097403Sobrien static const bool has_quiet_NaN = false; 241132720Skan /** True if the type has a representation for a signaling 242132720Skan "Not a Number." */ 24397403Sobrien static const bool has_signaling_NaN = false; 244132720Skan /** See std::float_denorm_style for more information. */ 24597403Sobrien static const float_denorm_style has_denorm = denorm_absent; 246132720Skan /** "True if loss of accuracy is detected as a denormalization loss, 247132720Skan rather than as an inexact result." [18.2.1.2]/42 */ 24897403Sobrien static const bool has_denorm_loss = false; 24997403Sobrien 250132720Skan /** True if-and-only-if the type adheres to the IEC 559 standard, also 251132720Skan known as IEEE 754. (Only makes sense for floating point types.) */ 25297403Sobrien static const bool is_iec559 = false; 253132720Skan /** "True if the set of values representable by the type is finite. All 254132720Skan built-in types are bounded, this member would be false for arbitrary 255132720Skan precision types." [18.2.1.2]/54 */ 25697403Sobrien static const bool is_bounded = false; 257132720Skan /** True if the type is @e modulo, that is, if it is possible to add two 258132720Skan positive numbers and have a result that wraps around to a third number 259132720Skan that is less. Typically false for floating types, true for unsigned 260132720Skan integers, and true for signed integers. */ 26197403Sobrien static const bool is_modulo = false; 26297403Sobrien 263132720Skan /** True if trapping is implemented for this type. */ 26497403Sobrien static const bool traps = false; 265132720Skan /** True if tinyness is detected before rounding. (see IEC 559) */ 26697403Sobrien static const bool tinyness_before = false; 267132720Skan /** See std::float_round_style for more information. This is only 268132720Skan meaningful for floating types; integer types will all be 269132720Skan round_toward_zero. */ 27097403Sobrien static const float_round_style round_style = round_toward_zero; 27197403Sobrien }; 27297403Sobrien 273132720Skan /** 274132720Skan * @brief Properties of fundamental types. 275132720Skan * 276132720Skan * This class allows a program to obtain information about the 277132720Skan * representation of a fundamental type on a given platform. For 278132720Skan * non-fundamental types, the functions will return 0 and the data 279132720Skan * members will all be @c false. 280132720Skan * 281132720Skan * @if maint 282132720Skan * _GLIBCXX_RESOLVE_LIB_DEFECTS: DRs 201 and 184 (hi Gaby!) are 283132720Skan * noted, but not incorporated in this documented (yet). 284132720Skan * @endif 285132720Skan */ 286117397Skan template<typename _Tp> 287117397Skan struct numeric_limits : public __numeric_limits_base 28897403Sobrien { 289132720Skan /** The minimum finite value, or for floating types with 290132720Skan denormalization, the minimum positive normalized value. */ 29197403Sobrien static _Tp min() throw() { return static_cast<_Tp>(0); } 292132720Skan /** The maximum finite value. */ 29397403Sobrien static _Tp max() throw() { return static_cast<_Tp>(0); } 294132720Skan /** The @e machine @e epsilon: the difference between 1 and the least 295132720Skan value greater than 1 that is representable. */ 29697403Sobrien static _Tp epsilon() throw() { return static_cast<_Tp>(0); } 297132720Skan /** The maximum rounding error measurement (see LIA-1). */ 29897403Sobrien static _Tp round_error() throw() { return static_cast<_Tp>(0); } 299132720Skan /** The representation of positive infinity, if @c has_infinity. */ 30097403Sobrien static _Tp infinity() throw() { return static_cast<_Tp>(0); } 301132720Skan /** The representation of a quiet "Not a Number," if @c has_quiet_NaN. */ 30297403Sobrien static _Tp quiet_NaN() throw() { return static_cast<_Tp>(0); } 303132720Skan /** The representation of a signaling "Not a Number," if 304132720Skan @c has_signaling_NaN. */ 30597403Sobrien static _Tp signaling_NaN() throw() { return static_cast<_Tp>(0); } 306132720Skan /** The minimum positive denormalized value. For types where 307132720Skan @c has_denorm is false, this is the minimum positive normalized 308132720Skan value. */ 30997403Sobrien static _Tp denorm_min() throw() { return static_cast<_Tp>(0); } 31097403Sobrien }; 31197403Sobrien 31297403Sobrien // Now there follow 15 explicit specializations. Yes, 15. Make sure 313117397Skan // you get the count right. 314169691Skan 315169691Skan /// numeric_limits<bool> specialization. 31697403Sobrien template<> 31797403Sobrien struct numeric_limits<bool> 31897403Sobrien { 31997403Sobrien static const bool is_specialized = true; 32097403Sobrien 32197403Sobrien static bool min() throw() 32297403Sobrien { return false; } 32397403Sobrien static bool max() throw() 32497403Sobrien { return true; } 32597403Sobrien 326117397Skan static const int digits = 1; 32797403Sobrien static const int digits10 = 0; 32897403Sobrien static const bool is_signed = false; 32997403Sobrien static const bool is_integer = true; 33097403Sobrien static const bool is_exact = true; 33197403Sobrien static const int radix = 2; 33297403Sobrien static bool epsilon() throw() 33397403Sobrien { return false; } 33497403Sobrien static bool round_error() throw() 33597403Sobrien { return false; } 33697403Sobrien 33797403Sobrien static const int min_exponent = 0; 33897403Sobrien static const int min_exponent10 = 0; 33997403Sobrien static const int max_exponent = 0; 34097403Sobrien static const int max_exponent10 = 0; 34197403Sobrien 34297403Sobrien static const bool has_infinity = false; 34397403Sobrien static const bool has_quiet_NaN = false; 34497403Sobrien static const bool has_signaling_NaN = false; 34597403Sobrien static const float_denorm_style has_denorm = denorm_absent; 34697403Sobrien static const bool has_denorm_loss = false; 34797403Sobrien 34897403Sobrien static bool infinity() throw() 34997403Sobrien { return false; } 35097403Sobrien static bool quiet_NaN() throw() 35197403Sobrien { return false; } 35297403Sobrien static bool signaling_NaN() throw() 35397403Sobrien { return false; } 35497403Sobrien static bool denorm_min() throw() 35597403Sobrien { return false; } 35697403Sobrien 35797403Sobrien static const bool is_iec559 = false; 35897403Sobrien static const bool is_bounded = true; 35997403Sobrien static const bool is_modulo = false; 36097403Sobrien 36197403Sobrien // It is not clear what it means for a boolean type to trap. 36297403Sobrien // This is a DR on the LWG issue list. Here, I use integer 36397403Sobrien // promotion semantics. 364132720Skan static const bool traps = __glibcxx_integral_traps; 36597403Sobrien static const bool tinyness_before = false; 36697403Sobrien static const float_round_style round_style = round_toward_zero; 36797403Sobrien }; 36897403Sobrien 369169691Skan /// numeric_limits<char> specialization. 37097403Sobrien template<> 37197403Sobrien struct numeric_limits<char> 37297403Sobrien { 37397403Sobrien static const bool is_specialized = true; 37497403Sobrien 37597403Sobrien static char min() throw() 376132720Skan { return __glibcxx_min(char); } 37797403Sobrien static char max() throw() 378132720Skan { return __glibcxx_max(char); } 37997403Sobrien 380132720Skan static const int digits = __glibcxx_digits (char); 381132720Skan static const int digits10 = __glibcxx_digits10 (char); 382132720Skan static const bool is_signed = __glibcxx_signed (char); 38397403Sobrien static const bool is_integer = true; 38497403Sobrien static const bool is_exact = true; 38597403Sobrien static const int radix = 2; 38697403Sobrien static char epsilon() throw() 387117397Skan { return 0; } 38897403Sobrien static char round_error() throw() 389117397Skan { return 0; } 39097403Sobrien 39197403Sobrien static const int min_exponent = 0; 39297403Sobrien static const int min_exponent10 = 0; 39397403Sobrien static const int max_exponent = 0; 39497403Sobrien static const int max_exponent10 = 0; 39597403Sobrien 39697403Sobrien static const bool has_infinity = false; 39797403Sobrien static const bool has_quiet_NaN = false; 39897403Sobrien static const bool has_signaling_NaN = false; 39997403Sobrien static const float_denorm_style has_denorm = denorm_absent; 40097403Sobrien static const bool has_denorm_loss = false; 40197403Sobrien 40297403Sobrien static char infinity() throw() 40397403Sobrien { return char(); } 40497403Sobrien static char quiet_NaN() throw() 40597403Sobrien { return char(); } 40697403Sobrien static char signaling_NaN() throw() 40797403Sobrien { return char(); } 40897403Sobrien static char denorm_min() throw() 40997403Sobrien { return static_cast<char>(0); } 41097403Sobrien 41197403Sobrien static const bool is_iec559 = false; 41297403Sobrien static const bool is_bounded = true; 413117397Skan static const bool is_modulo = true; 41497403Sobrien 415132720Skan static const bool traps = __glibcxx_integral_traps; 41697403Sobrien static const bool tinyness_before = false; 41797403Sobrien static const float_round_style round_style = round_toward_zero; 41897403Sobrien }; 41997403Sobrien 420169691Skan /// numeric_limits<signed char> specialization. 42197403Sobrien template<> 42297403Sobrien struct numeric_limits<signed char> 42397403Sobrien { 42497403Sobrien static const bool is_specialized = true; 42597403Sobrien 42697403Sobrien static signed char min() throw() 427117397Skan { return -__SCHAR_MAX__ - 1; } 42897403Sobrien static signed char max() throw() 429117397Skan { return __SCHAR_MAX__; } 43097403Sobrien 431132720Skan static const int digits = __glibcxx_digits (signed char); 432132720Skan static const int digits10 = __glibcxx_digits10 (signed char); 43397403Sobrien static const bool is_signed = true; 43497403Sobrien static const bool is_integer = true; 43597403Sobrien static const bool is_exact = true; 43697403Sobrien static const int radix = 2; 43797403Sobrien static signed char epsilon() throw() 43897403Sobrien { return 0; } 43997403Sobrien static signed char round_error() throw() 44097403Sobrien { return 0; } 44197403Sobrien 44297403Sobrien static const int min_exponent = 0; 44397403Sobrien static const int min_exponent10 = 0; 44497403Sobrien static const int max_exponent = 0; 44597403Sobrien static const int max_exponent10 = 0; 44697403Sobrien 44797403Sobrien static const bool has_infinity = false; 44897403Sobrien static const bool has_quiet_NaN = false; 44997403Sobrien static const bool has_signaling_NaN = false; 45097403Sobrien static const float_denorm_style has_denorm = denorm_absent; 45197403Sobrien static const bool has_denorm_loss = false; 45297403Sobrien 45397403Sobrien static signed char infinity() throw() 45497403Sobrien { return static_cast<signed char>(0); } 45597403Sobrien static signed char quiet_NaN() throw() 45697403Sobrien { return static_cast<signed char>(0); } 45797403Sobrien static signed char signaling_NaN() throw() 45897403Sobrien { return static_cast<signed char>(0); } 45997403Sobrien static signed char denorm_min() throw() 46097403Sobrien { return static_cast<signed char>(0); } 46197403Sobrien 46297403Sobrien static const bool is_iec559 = false; 46397403Sobrien static const bool is_bounded = true; 464117397Skan static const bool is_modulo = true; 46597403Sobrien 466132720Skan static const bool traps = __glibcxx_integral_traps; 46797403Sobrien static const bool tinyness_before = false; 46897403Sobrien static const float_round_style round_style = round_toward_zero; 46997403Sobrien }; 47097403Sobrien 471169691Skan /// numeric_limits<unsigned char> specialization. 47297403Sobrien template<> 47397403Sobrien struct numeric_limits<unsigned char> 47497403Sobrien { 47597403Sobrien static const bool is_specialized = true; 47697403Sobrien 47797403Sobrien static unsigned char min() throw() 47897403Sobrien { return 0; } 47997403Sobrien static unsigned char max() throw() 480117397Skan { return __SCHAR_MAX__ * 2U + 1; } 48197403Sobrien 482132720Skan static const int digits = __glibcxx_digits (unsigned char); 483132720Skan static const int digits10 = __glibcxx_digits10 (unsigned char); 48497403Sobrien static const bool is_signed = false; 48597403Sobrien static const bool is_integer = true; 48697403Sobrien static const bool is_exact = true; 48797403Sobrien static const int radix = 2; 48897403Sobrien static unsigned char epsilon() throw() 48997403Sobrien { return 0; } 49097403Sobrien static unsigned char round_error() throw() 49197403Sobrien { return 0; } 49297403Sobrien 49397403Sobrien static const int min_exponent = 0; 49497403Sobrien static const int min_exponent10 = 0; 49597403Sobrien static const int max_exponent = 0; 49697403Sobrien static const int max_exponent10 = 0; 49797403Sobrien 49897403Sobrien static const bool has_infinity = false; 49997403Sobrien static const bool has_quiet_NaN = false; 50097403Sobrien static const bool has_signaling_NaN = false; 50197403Sobrien static const float_denorm_style has_denorm = denorm_absent; 50297403Sobrien static const bool has_denorm_loss = false; 50397403Sobrien 50497403Sobrien static unsigned char infinity() throw() 50597403Sobrien { return static_cast<unsigned char>(0); } 50697403Sobrien static unsigned char quiet_NaN() throw() 50797403Sobrien { return static_cast<unsigned char>(0); } 50897403Sobrien static unsigned char signaling_NaN() throw() 50997403Sobrien { return static_cast<unsigned char>(0); } 51097403Sobrien static unsigned char denorm_min() throw() 51197403Sobrien { return static_cast<unsigned char>(0); } 51297403Sobrien 51397403Sobrien static const bool is_iec559 = false; 51497403Sobrien static const bool is_bounded = true; 51597403Sobrien static const bool is_modulo = true; 51697403Sobrien 517132720Skan static const bool traps = __glibcxx_integral_traps; 51897403Sobrien static const bool tinyness_before = false; 51997403Sobrien static const float_round_style round_style = round_toward_zero; 52097403Sobrien }; 52197403Sobrien 522169691Skan /// numeric_limits<wchar_t> specialization. 52397403Sobrien template<> 52497403Sobrien struct numeric_limits<wchar_t> 52597403Sobrien { 52697403Sobrien static const bool is_specialized = true; 52797403Sobrien 52897403Sobrien static wchar_t min() throw() 529132720Skan { return __glibcxx_min (wchar_t); } 53097403Sobrien static wchar_t max() throw() 531132720Skan { return __glibcxx_max (wchar_t); } 53297403Sobrien 533132720Skan static const int digits = __glibcxx_digits (wchar_t); 534132720Skan static const int digits10 = __glibcxx_digits10 (wchar_t); 535132720Skan static const bool is_signed = __glibcxx_signed (wchar_t); 53697403Sobrien static const bool is_integer = true; 53797403Sobrien static const bool is_exact = true; 53897403Sobrien static const int radix = 2; 53997403Sobrien static wchar_t epsilon() throw() 54097403Sobrien { return 0; } 54197403Sobrien static wchar_t round_error() throw() 54297403Sobrien { return 0; } 54397403Sobrien 54497403Sobrien static const int min_exponent = 0; 54597403Sobrien static const int min_exponent10 = 0; 54697403Sobrien static const int max_exponent = 0; 54797403Sobrien static const int max_exponent10 = 0; 54897403Sobrien 54997403Sobrien static const bool has_infinity = false; 55097403Sobrien static const bool has_quiet_NaN = false; 55197403Sobrien static const bool has_signaling_NaN = false; 55297403Sobrien static const float_denorm_style has_denorm = denorm_absent; 55397403Sobrien static const bool has_denorm_loss = false; 55497403Sobrien 55597403Sobrien static wchar_t infinity() throw() 55697403Sobrien { return wchar_t(); } 55797403Sobrien static wchar_t quiet_NaN() throw() 55897403Sobrien { return wchar_t(); } 55997403Sobrien static wchar_t signaling_NaN() throw() 56097403Sobrien { return wchar_t(); } 56197403Sobrien static wchar_t denorm_min() throw() 56297403Sobrien { return wchar_t(); } 56397403Sobrien 56497403Sobrien static const bool is_iec559 = false; 56597403Sobrien static const bool is_bounded = true; 566117397Skan static const bool is_modulo = true; 56797403Sobrien 568132720Skan static const bool traps = __glibcxx_integral_traps; 56997403Sobrien static const bool tinyness_before = false; 57097403Sobrien static const float_round_style round_style = round_toward_zero; 57197403Sobrien }; 57297403Sobrien 573169691Skan /// numeric_limits<short> specialization. 57497403Sobrien template<> 57597403Sobrien struct numeric_limits<short> 57697403Sobrien { 57797403Sobrien static const bool is_specialized = true; 57897403Sobrien 57997403Sobrien static short min() throw() 580117397Skan { return -__SHRT_MAX__ - 1; } 58197403Sobrien static short max() throw() 582117397Skan { return __SHRT_MAX__; } 58397403Sobrien 584132720Skan static const int digits = __glibcxx_digits (short); 585132720Skan static const int digits10 = __glibcxx_digits10 (short); 58697403Sobrien static const bool is_signed = true; 58797403Sobrien static const bool is_integer = true; 58897403Sobrien static const bool is_exact = true; 58997403Sobrien static const int radix = 2; 59097403Sobrien static short epsilon() throw() 59197403Sobrien { return 0; } 59297403Sobrien static short round_error() throw() 59397403Sobrien { return 0; } 59497403Sobrien 59597403Sobrien static const int min_exponent = 0; 59697403Sobrien static const int min_exponent10 = 0; 59797403Sobrien static const int max_exponent = 0; 59897403Sobrien static const int max_exponent10 = 0; 59997403Sobrien 60097403Sobrien static const bool has_infinity = false; 60197403Sobrien static const bool has_quiet_NaN = false; 60297403Sobrien static const bool has_signaling_NaN = false; 60397403Sobrien static const float_denorm_style has_denorm = denorm_absent; 60497403Sobrien static const bool has_denorm_loss = false; 60597403Sobrien 60697403Sobrien static short infinity() throw() 60797403Sobrien { return short(); } 60897403Sobrien static short quiet_NaN() throw() 60997403Sobrien { return short(); } 61097403Sobrien static short signaling_NaN() throw() 61197403Sobrien { return short(); } 61297403Sobrien static short denorm_min() throw() 61397403Sobrien { return short(); } 61497403Sobrien 615117397Skan static const bool is_iec559 = false; 61697403Sobrien static const bool is_bounded = true; 617117397Skan static const bool is_modulo = true; 61897403Sobrien 619132720Skan static const bool traps = __glibcxx_integral_traps; 62097403Sobrien static const bool tinyness_before = false; 62197403Sobrien static const float_round_style round_style = round_toward_zero; 62297403Sobrien }; 62397403Sobrien 624169691Skan /// numeric_limits<unsigned short> specialization. 62597403Sobrien template<> 62697403Sobrien struct numeric_limits<unsigned short> 62797403Sobrien { 62897403Sobrien static const bool is_specialized = true; 62997403Sobrien 63097403Sobrien static unsigned short min() throw() 63197403Sobrien { return 0; } 63297403Sobrien static unsigned short max() throw() 633117397Skan { return __SHRT_MAX__ * 2U + 1; } 63497403Sobrien 635132720Skan static const int digits = __glibcxx_digits (unsigned short); 636132720Skan static const int digits10 = __glibcxx_digits10 (unsigned short); 63797403Sobrien static const bool is_signed = false; 63897403Sobrien static const bool is_integer = true; 63997403Sobrien static const bool is_exact = true; 64097403Sobrien static const int radix = 2; 64197403Sobrien static unsigned short epsilon() throw() 64297403Sobrien { return 0; } 64397403Sobrien static unsigned short round_error() throw() 64497403Sobrien { return 0; } 64597403Sobrien 64697403Sobrien static const int min_exponent = 0; 64797403Sobrien static const int min_exponent10 = 0; 64897403Sobrien static const int max_exponent = 0; 64997403Sobrien static const int max_exponent10 = 0; 65097403Sobrien 65197403Sobrien static const bool has_infinity = false; 65297403Sobrien static const bool has_quiet_NaN = false; 65397403Sobrien static const bool has_signaling_NaN = false; 65497403Sobrien static const float_denorm_style has_denorm = denorm_absent; 65597403Sobrien static const bool has_denorm_loss = false; 65697403Sobrien 65797403Sobrien static unsigned short infinity() throw() 65897403Sobrien { return static_cast<unsigned short>(0); } 65997403Sobrien static unsigned short quiet_NaN() throw() 66097403Sobrien { return static_cast<unsigned short>(0); } 66197403Sobrien static unsigned short signaling_NaN() throw() 66297403Sobrien { return static_cast<unsigned short>(0); } 66397403Sobrien static unsigned short denorm_min() throw() 66497403Sobrien { return static_cast<unsigned short>(0); } 66597403Sobrien 666117397Skan static const bool is_iec559 = false; 66797403Sobrien static const bool is_bounded = true; 66897403Sobrien static const bool is_modulo = true; 66997403Sobrien 670132720Skan static const bool traps = __glibcxx_integral_traps; 67197403Sobrien static const bool tinyness_before = false; 67297403Sobrien static const float_round_style round_style = round_toward_zero; 67397403Sobrien }; 67497403Sobrien 675169691Skan /// numeric_limits<int> specialization. 67697403Sobrien template<> 67797403Sobrien struct numeric_limits<int> 67897403Sobrien { 67997403Sobrien static const bool is_specialized = true; 68097403Sobrien 68197403Sobrien static int min() throw() 682117397Skan { return -__INT_MAX__ - 1; } 68397403Sobrien static int max() throw() 684117397Skan { return __INT_MAX__; } 68597403Sobrien 686132720Skan static const int digits = __glibcxx_digits (int); 687132720Skan static const int digits10 = __glibcxx_digits10 (int); 68897403Sobrien static const bool is_signed = true; 68997403Sobrien static const bool is_integer = true; 69097403Sobrien static const bool is_exact = true; 69197403Sobrien static const int radix = 2; 69297403Sobrien static int epsilon() throw() 69397403Sobrien { return 0; } 69497403Sobrien static int round_error() throw() 69597403Sobrien { return 0; } 69697403Sobrien 69797403Sobrien static const int min_exponent = 0; 69897403Sobrien static const int min_exponent10 = 0; 69997403Sobrien static const int max_exponent = 0; 70097403Sobrien static const int max_exponent10 = 0; 70197403Sobrien 70297403Sobrien static const bool has_infinity = false; 70397403Sobrien static const bool has_quiet_NaN = false; 70497403Sobrien static const bool has_signaling_NaN = false; 70597403Sobrien static const float_denorm_style has_denorm = denorm_absent; 70697403Sobrien static const bool has_denorm_loss = false; 70797403Sobrien 70897403Sobrien static int infinity() throw() 70997403Sobrien { return static_cast<int>(0); } 71097403Sobrien static int quiet_NaN() throw() 71197403Sobrien { return static_cast<int>(0); } 71297403Sobrien static int signaling_NaN() throw() 71397403Sobrien { return static_cast<int>(0); } 71497403Sobrien static int denorm_min() throw() 71597403Sobrien { return static_cast<int>(0); } 71697403Sobrien 717117397Skan static const bool is_iec559 = false; 71897403Sobrien static const bool is_bounded = true; 719117397Skan static const bool is_modulo = true; 72097403Sobrien 721132720Skan static const bool traps = __glibcxx_integral_traps; 72297403Sobrien static const bool tinyness_before = false; 72397403Sobrien static const float_round_style round_style = round_toward_zero; 72497403Sobrien }; 72597403Sobrien 726169691Skan /// numeric_limits<unsigned int> specialization. 72797403Sobrien template<> 72897403Sobrien struct numeric_limits<unsigned int> 72997403Sobrien { 73097403Sobrien static const bool is_specialized = true; 73197403Sobrien 73297403Sobrien static unsigned int min() throw() 73397403Sobrien { return 0; } 734117397Skan static unsigned int max() throw() 735117397Skan { return __INT_MAX__ * 2U + 1; } 73697403Sobrien 737132720Skan static const int digits = __glibcxx_digits (unsigned int); 738132720Skan static const int digits10 = __glibcxx_digits10 (unsigned int); 73997403Sobrien static const bool is_signed = false; 74097403Sobrien static const bool is_integer = true; 74197403Sobrien static const bool is_exact = true; 74297403Sobrien static const int radix = 2; 74397403Sobrien static unsigned int epsilon() throw() 74497403Sobrien { return 0; } 74597403Sobrien static unsigned int round_error() throw() 74697403Sobrien { return 0; } 74797403Sobrien 74897403Sobrien static const int min_exponent = 0; 74997403Sobrien static const int min_exponent10 = 0; 75097403Sobrien static const int max_exponent = 0; 75197403Sobrien static const int max_exponent10 = 0; 75297403Sobrien 75397403Sobrien static const bool has_infinity = false; 75497403Sobrien static const bool has_quiet_NaN = false; 75597403Sobrien static const bool has_signaling_NaN = false; 75697403Sobrien static const float_denorm_style has_denorm = denorm_absent; 75797403Sobrien static const bool has_denorm_loss = false; 75897403Sobrien 75997403Sobrien static unsigned int infinity() throw() 76097403Sobrien { return static_cast<unsigned int>(0); } 76197403Sobrien static unsigned int quiet_NaN() throw() 76297403Sobrien { return static_cast<unsigned int>(0); } 76397403Sobrien static unsigned int signaling_NaN() throw() 76497403Sobrien { return static_cast<unsigned int>(0); } 76597403Sobrien static unsigned int denorm_min() throw() 76697403Sobrien { return static_cast<unsigned int>(0); } 76797403Sobrien 768117397Skan static const bool is_iec559 = false; 76997403Sobrien static const bool is_bounded = true; 77097403Sobrien static const bool is_modulo = true; 77197403Sobrien 772132720Skan static const bool traps = __glibcxx_integral_traps; 77397403Sobrien static const bool tinyness_before = false; 77497403Sobrien static const float_round_style round_style = round_toward_zero; 77597403Sobrien }; 77697403Sobrien 777169691Skan /// numeric_limits<long> specialization. 77897403Sobrien template<> 77997403Sobrien struct numeric_limits<long> 78097403Sobrien { 78197403Sobrien static const bool is_specialized = true; 78297403Sobrien 78397403Sobrien static long min() throw() 784117397Skan { return -__LONG_MAX__ - 1; } 78597403Sobrien static long max() throw() 786117397Skan { return __LONG_MAX__; } 78797403Sobrien 788132720Skan static const int digits = __glibcxx_digits (long); 789132720Skan static const int digits10 = __glibcxx_digits10 (long); 79097403Sobrien static const bool is_signed = true; 79197403Sobrien static const bool is_integer = true; 79297403Sobrien static const bool is_exact = true; 79397403Sobrien static const int radix = 2; 79497403Sobrien static long epsilon() throw() 79597403Sobrien { return 0; } 79697403Sobrien static long round_error() throw() 79797403Sobrien { return 0; } 79897403Sobrien 79997403Sobrien static const int min_exponent = 0; 80097403Sobrien static const int min_exponent10 = 0; 80197403Sobrien static const int max_exponent = 0; 80297403Sobrien static const int max_exponent10 = 0; 80397403Sobrien 80497403Sobrien static const bool has_infinity = false; 80597403Sobrien static const bool has_quiet_NaN = false; 80697403Sobrien static const bool has_signaling_NaN = false; 80797403Sobrien static const float_denorm_style has_denorm = denorm_absent; 80897403Sobrien static const bool has_denorm_loss = false; 80997403Sobrien 81097403Sobrien static long infinity() throw() 81197403Sobrien { return static_cast<long>(0); } 81297403Sobrien static long quiet_NaN() throw() 81397403Sobrien { return static_cast<long>(0); } 81497403Sobrien static long signaling_NaN() throw() 81597403Sobrien { return static_cast<long>(0); } 81697403Sobrien static long denorm_min() throw() 81797403Sobrien { return static_cast<long>(0); } 81897403Sobrien 819117397Skan static const bool is_iec559 = false; 82097403Sobrien static const bool is_bounded = true; 821117397Skan static const bool is_modulo = true; 82297403Sobrien 823132720Skan static const bool traps = __glibcxx_integral_traps; 82497403Sobrien static const bool tinyness_before = false; 82597403Sobrien static const float_round_style round_style = round_toward_zero; 82697403Sobrien }; 82797403Sobrien 828169691Skan /// numeric_limits<unsigned long> specialization. 82997403Sobrien template<> 83097403Sobrien struct numeric_limits<unsigned long> 83197403Sobrien { 83297403Sobrien static const bool is_specialized = true; 83397403Sobrien 83497403Sobrien static unsigned long min() throw() 83597403Sobrien { return 0; } 83697403Sobrien static unsigned long max() throw() 837117397Skan { return __LONG_MAX__ * 2UL + 1; } 83897403Sobrien 839132720Skan static const int digits = __glibcxx_digits (unsigned long); 840132720Skan static const int digits10 = __glibcxx_digits10 (unsigned long); 84197403Sobrien static const bool is_signed = false; 84297403Sobrien static const bool is_integer = true; 84397403Sobrien static const bool is_exact = true; 84497403Sobrien static const int radix = 2; 84597403Sobrien static unsigned long epsilon() throw() 84697403Sobrien { return 0; } 84797403Sobrien static unsigned long round_error() throw() 84897403Sobrien { return 0; } 84997403Sobrien 85097403Sobrien static const int min_exponent = 0; 85197403Sobrien static const int min_exponent10 = 0; 85297403Sobrien static const int max_exponent = 0; 85397403Sobrien static const int max_exponent10 = 0; 85497403Sobrien 85597403Sobrien static const bool has_infinity = false; 85697403Sobrien static const bool has_quiet_NaN = false; 85797403Sobrien static const bool has_signaling_NaN = false; 85897403Sobrien static const float_denorm_style has_denorm = denorm_absent; 85997403Sobrien static const bool has_denorm_loss = false; 86097403Sobrien 86197403Sobrien static unsigned long infinity() throw() 86297403Sobrien { return static_cast<unsigned long>(0); } 86397403Sobrien static unsigned long quiet_NaN() throw() 86497403Sobrien { return static_cast<unsigned long>(0); } 86597403Sobrien static unsigned long signaling_NaN() throw() 86697403Sobrien { return static_cast<unsigned long>(0); } 86797403Sobrien static unsigned long denorm_min() throw() 86897403Sobrien { return static_cast<unsigned long>(0); } 86997403Sobrien 870117397Skan static const bool is_iec559 = false; 87197403Sobrien static const bool is_bounded = true; 87297403Sobrien static const bool is_modulo = true; 87397403Sobrien 874132720Skan static const bool traps = __glibcxx_integral_traps; 87597403Sobrien static const bool tinyness_before = false; 87697403Sobrien static const float_round_style round_style = round_toward_zero; 87797403Sobrien }; 87897403Sobrien 879169691Skan /// numeric_limits<long long> specialization. 88097403Sobrien template<> 88197403Sobrien struct numeric_limits<long long> 88297403Sobrien { 88397403Sobrien static const bool is_specialized = true; 884117397Skan 88597403Sobrien static long long min() throw() 886117397Skan { return -__LONG_LONG_MAX__ - 1; } 88797403Sobrien static long long max() throw() 888117397Skan { return __LONG_LONG_MAX__; } 889117397Skan 890132720Skan static const int digits = __glibcxx_digits (long long); 891132720Skan static const int digits10 = __glibcxx_digits10 (long long); 89297403Sobrien static const bool is_signed = true; 89397403Sobrien static const bool is_integer = true; 89497403Sobrien static const bool is_exact = true; 89597403Sobrien static const int radix = 2; 89697403Sobrien static long long epsilon() throw() 89797403Sobrien { return 0; } 89897403Sobrien static long long round_error() throw() 89997403Sobrien { return 0; } 900117397Skan 90197403Sobrien static const int min_exponent = 0; 90297403Sobrien static const int min_exponent10 = 0; 90397403Sobrien static const int max_exponent = 0; 90497403Sobrien static const int max_exponent10 = 0; 905117397Skan 90697403Sobrien static const bool has_infinity = false; 90797403Sobrien static const bool has_quiet_NaN = false; 90897403Sobrien static const bool has_signaling_NaN = false; 90997403Sobrien static const float_denorm_style has_denorm = denorm_absent; 91097403Sobrien static const bool has_denorm_loss = false; 911117397Skan 91297403Sobrien static long long infinity() throw() 91397403Sobrien { return static_cast<long long>(0); } 91497403Sobrien static long long quiet_NaN() throw() 91597403Sobrien { return static_cast<long long>(0); } 91697403Sobrien static long long signaling_NaN() throw() 91797403Sobrien { return static_cast<long long>(0); } 91897403Sobrien static long long denorm_min() throw() 91997403Sobrien { return static_cast<long long>(0); } 920117397Skan 921117397Skan static const bool is_iec559 = false; 92297403Sobrien static const bool is_bounded = true; 923117397Skan static const bool is_modulo = true; 92497403Sobrien 925132720Skan static const bool traps = __glibcxx_integral_traps; 92697403Sobrien static const bool tinyness_before = false; 92797403Sobrien static const float_round_style round_style = round_toward_zero; 92897403Sobrien }; 92997403Sobrien 930169691Skan /// numeric_limits<unsigned long long> specialization. 93197403Sobrien template<> 93297403Sobrien struct numeric_limits<unsigned long long> 93397403Sobrien { 93497403Sobrien static const bool is_specialized = true; 93597403Sobrien 93697403Sobrien static unsigned long long min() throw() 93797403Sobrien { return 0; } 93897403Sobrien static unsigned long long max() throw() 939117397Skan { return __LONG_LONG_MAX__ * 2ULL + 1; } 94097403Sobrien 941132720Skan static const int digits = __glibcxx_digits (unsigned long long); 942132720Skan static const int digits10 = __glibcxx_digits10 (unsigned long long); 94397403Sobrien static const bool is_signed = false; 94497403Sobrien static const bool is_integer = true; 94597403Sobrien static const bool is_exact = true; 94697403Sobrien static const int radix = 2; 94797403Sobrien static unsigned long long epsilon() throw() 94897403Sobrien { return 0; } 94997403Sobrien static unsigned long long round_error() throw() 95097403Sobrien { return 0; } 95197403Sobrien 95297403Sobrien static const int min_exponent = 0; 95397403Sobrien static const int min_exponent10 = 0; 95497403Sobrien static const int max_exponent = 0; 95597403Sobrien static const int max_exponent10 = 0; 95697403Sobrien 95797403Sobrien static const bool has_infinity = false; 95897403Sobrien static const bool has_quiet_NaN = false; 95997403Sobrien static const bool has_signaling_NaN = false; 96097403Sobrien static const float_denorm_style has_denorm = denorm_absent; 96197403Sobrien static const bool has_denorm_loss = false; 96297403Sobrien 96397403Sobrien static unsigned long long infinity() throw() 96497403Sobrien { return static_cast<unsigned long long>(0); } 96597403Sobrien static unsigned long long quiet_NaN() throw() 96697403Sobrien { return static_cast<unsigned long long>(0); } 96797403Sobrien static unsigned long long signaling_NaN() throw() 96897403Sobrien { return static_cast<unsigned long long>(0); } 96997403Sobrien static unsigned long long denorm_min() throw() 97097403Sobrien { return static_cast<unsigned long long>(0); } 97197403Sobrien 972117397Skan static const bool is_iec559 = false; 97397403Sobrien static const bool is_bounded = true; 97497403Sobrien static const bool is_modulo = true; 97597403Sobrien 976132720Skan static const bool traps = __glibcxx_integral_traps; 97797403Sobrien static const bool tinyness_before = false; 97897403Sobrien static const float_round_style round_style = round_toward_zero; 97997403Sobrien }; 98097403Sobrien 981169691Skan /// numeric_limits<float> specialization. 98297403Sobrien template<> 98397403Sobrien struct numeric_limits<float> 98497403Sobrien { 98597403Sobrien static const bool is_specialized = true; 98697403Sobrien 98797403Sobrien static float min() throw() 988117397Skan { return __FLT_MIN__; } 98997403Sobrien static float max() throw() 990117397Skan { return __FLT_MAX__; } 99197403Sobrien 992117397Skan static const int digits = __FLT_MANT_DIG__; 993117397Skan static const int digits10 = __FLT_DIG__; 99497403Sobrien static const bool is_signed = true; 99597403Sobrien static const bool is_integer = false; 99697403Sobrien static const bool is_exact = false; 997117397Skan static const int radix = __FLT_RADIX__; 99897403Sobrien static float epsilon() throw() 999117397Skan { return __FLT_EPSILON__; } 100097403Sobrien static float round_error() throw() 1001117397Skan { return 0.5F; } 100297403Sobrien 1003117397Skan static const int min_exponent = __FLT_MIN_EXP__; 1004117397Skan static const int min_exponent10 = __FLT_MIN_10_EXP__; 1005117397Skan static const int max_exponent = __FLT_MAX_EXP__; 1006117397Skan static const int max_exponent10 = __FLT_MAX_10_EXP__; 100797403Sobrien 1008132720Skan static const bool has_infinity = __FLT_HAS_INFINITY__; 1009132720Skan static const bool has_quiet_NaN = __FLT_HAS_QUIET_NAN__; 1010117397Skan static const bool has_signaling_NaN = has_quiet_NaN; 1011117397Skan static const float_denorm_style has_denorm 1012169691Skan = bool(__FLT_HAS_DENORM__) ? denorm_present : denorm_absent; 1013132720Skan static const bool has_denorm_loss = __glibcxx_float_has_denorm_loss; 101497403Sobrien 101597403Sobrien static float infinity() throw() 1016117397Skan { return __builtin_huge_valf (); } 101797403Sobrien static float quiet_NaN() throw() 1018117397Skan { return __builtin_nanf (""); } 101997403Sobrien static float signaling_NaN() throw() 1020117397Skan { return __builtin_nansf (""); } 102197403Sobrien static float denorm_min() throw() 1022117397Skan { return __FLT_DENORM_MIN__; } 102397403Sobrien 1024117397Skan static const bool is_iec559 1025117397Skan = has_infinity && has_quiet_NaN && has_denorm == denorm_present; 1026117397Skan static const bool is_bounded = true; 1027117397Skan static const bool is_modulo = false; 102897403Sobrien 1029132720Skan static const bool traps = __glibcxx_float_traps; 1030132720Skan static const bool tinyness_before = __glibcxx_float_tinyness_before; 1031117397Skan static const float_round_style round_style = round_to_nearest; 103297403Sobrien }; 103397403Sobrien 1034132720Skan#undef __glibcxx_float_has_denorm_loss 1035132720Skan#undef __glibcxx_float_traps 1036132720Skan#undef __glibcxx_float_tinyness_before 103797403Sobrien 1038169691Skan /// numeric_limits<double> specialization. 103997403Sobrien template<> 104097403Sobrien struct numeric_limits<double> 104197403Sobrien { 104297403Sobrien static const bool is_specialized = true; 104397403Sobrien 104497403Sobrien static double min() throw() 1045117397Skan { return __DBL_MIN__; } 104697403Sobrien static double max() throw() 1047117397Skan { return __DBL_MAX__; } 104897403Sobrien 1049117397Skan static const int digits = __DBL_MANT_DIG__; 1050117397Skan static const int digits10 = __DBL_DIG__; 105197403Sobrien static const bool is_signed = true; 105297403Sobrien static const bool is_integer = false; 105397403Sobrien static const bool is_exact = false; 1054117397Skan static const int radix = __FLT_RADIX__; 105597403Sobrien static double epsilon() throw() 1056117397Skan { return __DBL_EPSILON__; } 105797403Sobrien static double round_error() throw() 1058117397Skan { return 0.5; } 105997403Sobrien 1060117397Skan static const int min_exponent = __DBL_MIN_EXP__; 1061117397Skan static const int min_exponent10 = __DBL_MIN_10_EXP__; 1062117397Skan static const int max_exponent = __DBL_MAX_EXP__; 1063117397Skan static const int max_exponent10 = __DBL_MAX_10_EXP__; 106497403Sobrien 1065132720Skan static const bool has_infinity = __DBL_HAS_INFINITY__; 1066132720Skan static const bool has_quiet_NaN = __DBL_HAS_QUIET_NAN__; 1067117397Skan static const bool has_signaling_NaN = has_quiet_NaN; 1068117397Skan static const float_denorm_style has_denorm 1069169691Skan = bool(__DBL_HAS_DENORM__) ? denorm_present : denorm_absent; 1070132720Skan static const bool has_denorm_loss = __glibcxx_double_has_denorm_loss; 107197403Sobrien 107297403Sobrien static double infinity() throw() 1073117397Skan { return __builtin_huge_val(); } 107497403Sobrien static double quiet_NaN() throw() 1075117397Skan { return __builtin_nan (""); } 107697403Sobrien static double signaling_NaN() throw() 1077117397Skan { return __builtin_nans (""); } 107897403Sobrien static double denorm_min() throw() 1079117397Skan { return __DBL_DENORM_MIN__; } 108097403Sobrien 1081117397Skan static const bool is_iec559 1082117397Skan = has_infinity && has_quiet_NaN && has_denorm == denorm_present; 1083117397Skan static const bool is_bounded = true; 1084117397Skan static const bool is_modulo = false; 108597403Sobrien 1086132720Skan static const bool traps = __glibcxx_double_traps; 1087132720Skan static const bool tinyness_before = __glibcxx_double_tinyness_before; 1088117397Skan static const float_round_style round_style = round_to_nearest; 108997403Sobrien }; 109097403Sobrien 1091132720Skan#undef __glibcxx_double_has_denorm_loss 1092132720Skan#undef __glibcxx_double_traps 1093132720Skan#undef __glibcxx_double_tinyness_before 1094117397Skan 1095169691Skan /// numeric_limits<long double> specialization. 109697403Sobrien template<> 109797403Sobrien struct numeric_limits<long double> 109897403Sobrien { 109997403Sobrien static const bool is_specialized = true; 110097403Sobrien 110197403Sobrien static long double min() throw() 1102117397Skan { return __LDBL_MIN__; } 110397403Sobrien static long double max() throw() 1104117397Skan { return __LDBL_MAX__; } 110597403Sobrien 1106117397Skan static const int digits = __LDBL_MANT_DIG__; 1107117397Skan static const int digits10 = __LDBL_DIG__; 110897403Sobrien static const bool is_signed = true; 110997403Sobrien static const bool is_integer = false; 111097403Sobrien static const bool is_exact = false; 1111117397Skan static const int radix = __FLT_RADIX__; 111297403Sobrien static long double epsilon() throw() 1113117397Skan { return __LDBL_EPSILON__; } 111497403Sobrien static long double round_error() throw() 1115117397Skan { return 0.5L; } 111697403Sobrien 1117117397Skan static const int min_exponent = __LDBL_MIN_EXP__; 1118117397Skan static const int min_exponent10 = __LDBL_MIN_10_EXP__; 1119117397Skan static const int max_exponent = __LDBL_MAX_EXP__; 1120117397Skan static const int max_exponent10 = __LDBL_MAX_10_EXP__; 112197403Sobrien 1122132720Skan static const bool has_infinity = __LDBL_HAS_INFINITY__; 1123132720Skan static const bool has_quiet_NaN = __LDBL_HAS_QUIET_NAN__; 1124117397Skan static const bool has_signaling_NaN = has_quiet_NaN; 1125117397Skan static const float_denorm_style has_denorm 1126169691Skan = bool(__LDBL_HAS_DENORM__) ? denorm_present : denorm_absent; 1127117397Skan static const bool has_denorm_loss 1128132720Skan = __glibcxx_long_double_has_denorm_loss; 112997403Sobrien 113097403Sobrien static long double infinity() throw() 1131117397Skan { return __builtin_huge_vall (); } 113297403Sobrien static long double quiet_NaN() throw() 1133117397Skan { return __builtin_nanl (""); } 113497403Sobrien static long double signaling_NaN() throw() 1135117397Skan { return __builtin_nansl (""); } 113697403Sobrien static long double denorm_min() throw() 1137117397Skan { return __LDBL_DENORM_MIN__; } 113897403Sobrien 1139117397Skan static const bool is_iec559 1140117397Skan = has_infinity && has_quiet_NaN && has_denorm == denorm_present; 1141117397Skan static const bool is_bounded = true; 1142117397Skan static const bool is_modulo = false; 114397403Sobrien 1144132720Skan static const bool traps = __glibcxx_long_double_traps; 1145132720Skan static const bool tinyness_before = __glibcxx_long_double_tinyness_before; 1146117397Skan static const float_round_style round_style = round_to_nearest; 114797403Sobrien }; 114897403Sobrien 1149132720Skan#undef __glibcxx_long_double_has_denorm_loss 1150132720Skan#undef __glibcxx_long_double_traps 1151132720Skan#undef __glibcxx_long_double_tinyness_before 1152117397Skan 1153169691Skan_GLIBCXX_END_NAMESPACE 115497403Sobrien 1155132720Skan#undef __glibcxx_signed 1156132720Skan#undef __glibcxx_min 1157132720Skan#undef __glibcxx_max 1158132720Skan#undef __glibcxx_digits 1159132720Skan#undef __glibcxx_digits10 1160117397Skan 1161132720Skan#endif // _GLIBCXX_NUMERIC_LIMITS 1162