# limits

Go to the documentation of this file.

    00001 // The template and inlines for the numeric_limits classes. -*- C++ -*-
    00002
    00003 // Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008
    00004 // Free Software Foundation, Inc.
    00005 //
    00006 // This file is part of the GNU ISO C++ Library.  This library is free
    00007 // software; you can redistribute it and/or modify it under the
    00008 // terms of the GNU General Public License as published by the
    00009 // Free Software Foundation; either version 2, or (at your option)
    00010 // any later version.
    00011
    00012 // This library is distributed in the hope that it will be useful,
    00013 // but WITHOUT ANY WARRANTY; without even the implied warranty of
    00014 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    00015 // GNU General Public License for more details.
    00016
    00017 // You should have received a copy of the GNU General Public License
    00018 // along with this library; see the file COPYING.  If not, write to
    00019 // the Free Software Foundation, 51 Franklin Street, Fifth Floor,
    00020 // Boston, MA 02110-1301, USA.
    00021
    00022 // As a special exception, you may use this file as part of a free software
    00023 // library without restriction.  Specifically, if other files instantiate
    00024 // templates or use macros or inline functions from this file, or you compile
    00025 // this file and link it with other files to produce an executable, this
    00026 // file does not by itself cause the resulting executable to be covered by
    00027 // the GNU General Public License.  This exception does not however
    00028 // invalidate any other reasons why the executable file might be covered by
    00029 // the GNU General Public License.
    00030
    00031 /** @file limits
    00032  *  This is a Standard C++ Library header.
    00033  */
    00034
    00035 // Note: this is not a conforming implementation.
    00036 // Written by Gabriel Dos Reis <gdr@codesourcery.com>
    00037
    00038 //
    00039 // ISO 14882:1998
    00040 // 18.2.1
    00041 //
    00042
    00043 #ifndef _GLIBCXX_NUMERIC_LIMITS
    00044 #define _GLIBCXX_NUMERIC_LIMITS 1
    00045
    00046 #pragma GCC system_header
    00047
    00048 #include <bits/c++config.h>
    00049
    00050 //
    00051 // The numeric_limits<> traits document implementation-defined aspects
    00052 // of fundamental arithmetic data types (integers and floating points).
    00053 // From Standard C++ point of view, there are 13 such types:
    00054 //   * integers
    00055 //         bool                             (1)
    00056 //         char, signed char, unsigned char         (3)
    00057 //         short, unsigned short                (2)
    00058 //         int, unsigned                    (2)
    00059 //         long, unsigned long                  (2)
    00060 //
    00061 //   * floating points
    00062 //         float                        (1)
    00063 //         double                       (1)
    00064 //         long double                      (1)
    00065 //
    00066 // GNU C++ understands (where supported by the host C-library)
    00067 //   * integer
    00068 //         long long, unsigned long long            (2)
    00069 //
    00070 // which brings us to 15 fundamental arithmetic data types in GNU C++.
    00071 //
    00072 //
    00073 // Since a numeric_limits<> is a bit tricky to get right, we rely on
    00074 // an interface composed of macros which should be defined in config/os
    00075 // or config/cpu when they differ from the generic (read arbitrary)
    00076 // definitions given here.
    00077 //
    00078
    00079 // These values can be overridden in the target configuration file.
    00080 // The default values are appropriate for many 32-bit targets.
    00081
    00082 // GCC only intrinsically supports modulo integral types.  The only remaining
    00083 // integral exceptional values is division by zero.  Only targets that do not
    00084 // signal division by zero in some "hard to ignore" way should use false.
    00085 #ifndef __glibcxx_integral_traps
    00086 # define __glibcxx_integral_traps true
    00087 #endif
    00088
    00089 // float
    00090 //
    00091
    00092 // Default values.  Should be overridden in configuration files if necessary.
    00093
    00094 #ifndef __glibcxx_float_has_denorm_loss
    00095 #  define __glibcxx_float_has_denorm_loss false
    00096 #endif
    00097 #ifndef __glibcxx_float_traps
    00098 #  define __glibcxx_float_traps false
    00099 #endif
    00100 #ifndef __glibcxx_float_tinyness_before
    00101 #  define __glibcxx_float_tinyness_before false
    00102 #endif
    00103
    00104 // double
    00105
    00106 // Default values.  Should be overridden in configuration files if necessary.
    00107
    00108 #ifndef __glibcxx_double_has_denorm_loss
    00109 #  define __glibcxx_double_has_denorm_loss false
    00110 #endif
    00111 #ifndef __glibcxx_double_traps
    00112 #  define __glibcxx_double_traps false
    00113 #endif
    00114 #ifndef __glibcxx_double_tinyness_before
    00115 #  define __glibcxx_double_tinyness_before false
    00116 #endif
    00117
    00118 // long double
    00119
    00120 // Default values.  Should be overridden in configuration files if necessary.
    00121
    00122 #ifndef __glibcxx_long_double_has_denorm_loss
    00123 #  define __glibcxx_long_double_has_denorm_loss false
    00124 #endif
    00125 #ifndef __glibcxx_long_double_traps
    00126 #  define __glibcxx_long_double_traps false
    00127 #endif
    00128 #ifndef __glibcxx_long_double_tinyness_before
    00129 #  define __glibcxx_long_double_tinyness_before false
    00130 #endif
    00131
    00132 // You should not need to define any macros below this point.
    00133
    00134 #define __glibcxx_signed(T) ((T)(-1) < 0)
    00135
    00136 #define __glibcxx_min(T) \
    00137   (__glibcxx_signed (T) ? (T)1 << __glibcxx_digits (T) : (T)0)
    00138
    00139 #define __glibcxx_max(T) \
    00140   (__glibcxx_signed (T) ? \
    00141    (((((T)1 << (__glibcxx_digits (T) - 1)) - 1) << 1) + 1) : ~(T)0)
    00142
    00143 #define __glibcxx_digits(T) \
    00144   (sizeof(T) * __CHAR_BIT__ - __glibcxx_signed (T))
    00145
    00146 // The fraction 643/2136 approximates log10(2) to 7 significant digits.
    00147 #define __glibcxx_digits10(T) \
    00148   (__glibcxx_digits (T) * 643 / 2136)
    00149
    00150
    00151 _GLIBCXX_BEGIN_NAMESPACE(std)
    00152
    00153   /**
    00154    *  @brief Describes the rounding style for floating-point types.
    00155    *
    00156    *  This is used in the std::numeric_limits class.
    00157   */
    00158   enum float_round_style
    00159   {
    00160     round_indeterminate       = -1,    ///< Self-explanatory.
    00161     round_toward_zero         = 0,     ///< Self-explanatory.
    00162     round_to_nearest          = 1,     ///< To the nearest representable value.
    00163     round_toward_infinity     = 2,     ///< Self-explanatory.
    00164     round_toward_neg_infinity = 3      ///< Self-explanatory.
    00165   };
    00166
    00167   /**
    00168    *  @brief Describes the denormalization for floating-point types.
    00169    *
    00170    *  These values represent the presence or absence of a variable number
    00171    *  of exponent bits.  This type is used in the std::numeric_limits class.
    00172   */
    00173   enum float_denorm_style
    00174   {
    00175     /// Indeterminate at compile time whether denormalized values are allowed.
    00176     denorm_indeterminate = -1,
    00177     /// The type does not allow denormalized values.
    00178     denorm_absent        = 0,
    00179     /// The type allows denormalized values.
    00180     denorm_present       = 1
    00181   };
    00182
    00183   /**
    00184    *  @brief Part of std::numeric_limits.
    00185    *
    00186    *  The @c static @c const members are usable as integral constant
    00187    *  expressions.
    00188    *
    00189    *  @note This is a separate class for purposes of efficiency; you
    00190    *        should only access these members as part of an instantiation
    00191    *        of the std::numeric_limits class.
    00192   */
    00193   struct __numeric_limits_base
    00194   {
    00195     /** This will be true for all fundamental types (which have
    00196         specializations), and false for everything else.  */
    00197     static const bool is_specialized = false;
    00198
    00199     /** The number of @c radix digits that be represented without change:  for
    00200         integer types, the number of non-sign bits in the mantissa; for
    00201         floating types, the number of @c radix digits in the mantissa.  */
    00202     static const int digits = 0;
    00203     /** The number of base 10 digits that can be represented without change. */
    00204     static const int digits10 = 0;
    00205     /** True if the type is signed.  */
    00206     static const bool is_signed = false;
    00207     /** True if the type is integer.
    00208      *  Is this supposed to be "if the type is integral"?
    00209     */
    00210     static const bool is_integer = false;
    00211     /** True if the type uses an exact representation.  "All integer types are
    00212         exact, but not all exact types are integer.  For example, rational and
    00213         fixed-exponent representations are exact but not integer."
    00214         [18.2.1.2]/15  */
    00215     static const bool is_exact = false;
    00216     /** For integer types, specifies the base of the representation.  For
    00217         floating types, specifies the base of the exponent representation.  */
    00218     static const int radix = 0;
    00219
    00220     /** The minimum negative integer such that @c radix raised to the power of
    00221         (one less than that integer) is a normalized floating point number.  */
    00222     static const int min_exponent = 0;
    00223     /** The minimum negative integer such that 10 raised to that power is in
    00224         the range of normalized floating point numbers.  */
    00225     static const int min_exponent10 = 0;
    00226     /** The maximum positive integer such that @c radix raised to the power of
    00227         (one less than that integer) is a representable finite floating point
    00228     number.  */
    00229     static const int max_exponent = 0;
    00230     /** The maximum positive integer such that 10 raised to that power is in
    00231         the range of representable finite floating point numbers.  */
    00232     static const int max_exponent10 = 0;
    00233
    00234     /** True if the type has a representation for positive infinity.  */
    00235     static const bool has_infinity = false;
    00236     /** True if the type has a representation for a quiet (non-signaling)
    00237         "Not a Number."  */
    00238     static const bool has_quiet_NaN = false;
    00239     /** True if the type has a representation for a signaling
    00240         "Not a Number."  */
    00241     static const bool has_signaling_NaN = false;
    00242     /** See std::float_denorm_style for more information.  */
    00243     static const float_denorm_style has_denorm = denorm_absent;
    00244     /** "True if loss of accuracy is detected as a denormalization loss,
    00245         rather than as an inexact result." [18.2.1.2]/42  */
    00246     static const bool has_denorm_loss = false;
    00247
    00248     /** True if-and-only-if the type adheres to the IEC 559 standard, also
    00249         known as IEEE 754.  (Only makes sense for floating point types.)  */
    00250     static const bool is_iec559 = false;
    00251     /** "True if the set of values representable by the type is finite.   All
    00252         built-in types are bounded, this member would be false for arbitrary
    00253     precision types." [18.2.1.2]/54  */
    00254     static const bool is_bounded = false;
    00255     /** True if the type is @e modulo, that is, if it is possible to add two
    00256         positive numbers and have a result that wraps around to a third number
    00257         that is less.  Typically false for floating types, true for unsigned
    00258         integers, and true for signed integers.  */
    00259     static const bool is_modulo = false;
    00260
    00261     /** True if trapping is implemented for this type.  */
    00262     static const bool traps = false;
    00263     /** True if tininess is detected before rounding.  (see IEC 559)  */
    00264     static const bool tinyness_before = false;
    00265     /** See std::float_round_style for more information.  This is only
    00266         meaningful for floating types; integer types will all be
    00267     round_toward_zero.  */
    00268     static const float_round_style round_style = round_toward_zero;
    00269   };
    00270
    00271   /**
    00272    *  @brief Properties of fundamental types.
    00273    *
    00274    *  This class allows a program to obtain information about the
    00275    *  representation of a fundamental type on a given platform.  For
    00276    *  non-fundamental types, the functions will return 0 and the data
    00277    *  members will all be @c false.
    00278    *
    00279    *  _GLIBCXX_RESOLVE_LIB_DEFECTS:  DRs 201 and 184 (hi Gaby!) are
    00280    *  noted, but not incorporated in this documented (yet).
    00281   */
    00282   template<typename _Tp>
    00283     struct numeric_limits : public __numeric_limits_base
    00284     {
    00285       /** The minimum finite value, or for floating types with
    00286           denormalization, the minimum positive normalized value.  */
    00287       static _Tp min() throw() { return static_cast<_Tp>(0); }
    00288       /** The maximum finite value.  */
    00289       static _Tp max() throw() { return static_cast<_Tp>(0); }
    00290       /** The @e machine @e epsilon:  the difference between 1 and the least
    00291           value greater than 1 that is representable.  */
    00292       static _Tp epsilon() throw() { return static_cast<_Tp>(0); }
    00293       /** The maximum rounding error measurement (see LIA-1).  */
    00294       static _Tp round_error() throw() { return static_cast<_Tp>(0); }
    00295       /** The representation of positive infinity, if @c has_infinity.  */
    00296       static _Tp infinity() throw()  { return static_cast<_Tp>(0); }
    00297       /** The representation of a quiet "Not a Number," if @c has_quiet_NaN. */
    00298       static _Tp quiet_NaN() throw() { return static_cast<_Tp>(0); }
    00299       /** The representation of a signaling "Not a Number," if
    00300           @c has_signaling_NaN. */
    00301       static _Tp signaling_NaN() throw() { return static_cast<_Tp>(0); }
    00302       /** The minimum positive denormalized value.  For types where
    00303           @c has_denorm is false, this is the minimum positive normalized
    00304       value.  */
    00305       static _Tp denorm_min() throw() { return static_cast<_Tp>(0); }
    00306     };
    00307
    00308   // Now there follow 15 explicit specializations.  Yes, 15.  Make sure
    00309   // you get the count right.
    00310
    00311   /// numeric_limits<bool> specialization.
    00312   template<>
    00313     struct numeric_limits<bool>
    00314     {
    00315       static const bool is_specialized = true;
    00316
    00317       static bool min() throw()
    00318       { return false; }
    00319       static bool max() throw()
    00320       { return true; }
    00321
    00322       static const int digits = 1;
    00323       static const int digits10 = 0;
    00324       static const bool is_signed = false;
    00325       static const bool is_integer = true;
    00326       static const bool is_exact = true;
    00327       static const int radix = 2;
    00328       static bool epsilon() throw()
    00329       { return false; }
    00330       static bool round_error() throw()
    00331       { return false; }
    00332
    00333       static const int min_exponent = 0;
    00334       static const int min_exponent10 = 0;
    00335       static const int max_exponent = 0;
    00336       static const int max_exponent10 = 0;
    00337
    00338       static const bool has_infinity = false;
    00339       static const bool has_quiet_NaN = false;
    00340       static const bool has_signaling_NaN = false;
    00341       static const float_denorm_style has_denorm = denorm_absent;
    00342       static const bool has_denorm_loss = false;
    00343
    00344       static bool infinity() throw()
    00345       { return false; }
    00346       static bool quiet_NaN() throw()
    00347       { return false; }
    00348       static bool signaling_NaN() throw()
    00349       { return false; }
    00350       static bool denorm_min() throw()
    00351       { return false; }
    00352
    00353       static const bool is_iec559 = false;
    00354       static const bool is_bounded = true;
    00355       static const bool is_modulo = false;
    00356
    00357       // It is not clear what it means for a boolean type to trap.
    00358       // This is a DR on the LWG issue list.  Here, I use integer
    00359       // promotion semantics.
    00360       static const bool traps = __glibcxx_integral_traps;
    00361       static const bool tinyness_before = false;
    00362       static const float_round_style round_style = round_toward_zero;
    00363     };
    00364
    00365   /// numeric_limits<char> specialization.
    00366   template<>
    00367     struct numeric_limits<char>
    00368     {
    00369       static const bool is_specialized = true;
    00370
    00371       static char min() throw()
    00372       { return __glibcxx_min(char); }
    00373       static char max() throw()
    00374       { return __glibcxx_max(char); }
    00375
    00376       static const int digits = __glibcxx_digits (char);
    00377       static const int digits10 = __glibcxx_digits10 (char);
    00378       static const bool is_signed = __glibcxx_signed (char);
    00379       static const bool is_integer = true;
    00380       static const bool is_exact = true;
    00381       static const int radix = 2;
    00382       static char epsilon() throw()
    00383       { return 0; }
    00384       static char round_error() throw()
    00385       { return 0; }
    00386
    00387       static const int min_exponent = 0;
    00388       static const int min_exponent10 = 0;
    00389       static const int max_exponent = 0;
    00390       static const int max_exponent10 = 0;
    00391
    00392       static const bool has_infinity = false;
    00393       static const bool has_quiet_NaN = false;
    00394       static const bool has_signaling_NaN = false;
    00395       static const float_denorm_style has_denorm = denorm_absent;
    00396       static const bool has_denorm_loss = false;
    00397
    00398       static char infinity() throw()
    00399       { return char(); }
    00400       static char quiet_NaN() throw()
    00401       { return char(); }
    00402       static char signaling_NaN() throw()
    00403       { return char(); }
    00404       static char denorm_min() throw()
    00405       { return static_cast<char>(0); }
    00406
    00407       static const bool is_iec559 = false;
    00408       static const bool is_bounded = true;
    00409       static const bool is_modulo = true;
    00410
    00411       static const bool traps = __glibcxx_integral_traps;
    00412       static const bool tinyness_before = false;
    00413       static const float_round_style round_style = round_toward_zero;
    00414     };
    00415
    00416   /// numeric_limits<signed char> specialization.
    00417   template<>
    00418     struct numeric_limits<signed char>
    00419     {
    00420       static const bool is_specialized = true;
    00421
    00422       static signed char min() throw()
    00423       { return -__SCHAR_MAX__ - 1; }
    00424       static signed char max() throw()
    00425       { return __SCHAR_MAX__; }
    00426
    00427       static const int digits = __glibcxx_digits (signed char);
    00428       static const int digits10 = __glibcxx_digits10 (signed char);
    00429       static const bool is_signed = true;
    00430       static const bool is_integer = true;
    00431       static const bool is_exact = true;
    00432       static const int radix = 2;
    00433       static signed char epsilon() throw()
    00434       { return 0; }
    00435       static signed char round_error() throw()
    00436       { return 0; }
    00437
    00438       static const int min_exponent = 0;
    00439       static const int min_exponent10 = 0;
    00440       static const int max_exponent = 0;
    00441       static const int max_exponent10 = 0;
    00442
    00443       static const bool has_infinity = false;
    00444       static const bool has_quiet_NaN = false;
    00445       static const bool has_signaling_NaN = false;
    00446       static const float_denorm_style has_denorm = denorm_absent;
    00447       static const bool has_denorm_loss = false;
    00448
    00449       static signed char infinity() throw()
    00450       { return static_cast<signed char>(0); }
    00451       static signed char quiet_NaN() throw()
    00452       { return static_cast<signed char>(0); }
    00453       static signed char signaling_NaN() throw()
    00454       { return static_cast<signed char>(0); }
    00455       static signed char denorm_min() throw()
    00456       { return static_cast<signed char>(0); }
    00457
    00458       static const bool is_iec559 = false;
    00459       static const bool is_bounded = true;
    00460       static const bool is_modulo = true;
    00461
    00462       static const bool traps = __glibcxx_integral_traps;
    00463       static const bool tinyness_before = false;
    00464       static const float_round_style round_style = round_toward_zero;
    00465     };
    00466
    00467   /// numeric_limits<unsigned char> specialization.
    00468   template<>
    00469     struct numeric_limits<unsigned char>
    00470     {
    00471       static const bool is_specialized = true;
    00472
    00473       static unsigned char min() throw()
    00474       { return 0; }
    00475       static unsigned char max() throw()
    00476       { return __SCHAR_MAX__ * 2U + 1; }
    00477
    00478       static const int digits = __glibcxx_digits (unsigned char);
    00479       static const int digits10 = __glibcxx_digits10 (unsigned char);
    00480       static const bool is_signed = false;
    00481       static const bool is_integer = true;
    00482       static const bool is_exact = true;
    00483       static const int radix = 2;
    00484       static unsigned char epsilon() throw()
    00485       { return 0; }
    00486       static unsigned char round_error() throw()
    00487       { return 0; }
    00488
    00489       static const int min_exponent = 0;
    00490       static const int min_exponent10 = 0;
    00491       static const int max_exponent = 0;
    00492       static const int max_exponent10 = 0;
    00493
    00494       static const bool has_infinity = false;
    00495       static const bool has_quiet_NaN = false;
    00496       static const bool has_signaling_NaN = false;
    00497       static const float_denorm_style has_denorm = denorm_absent;
    00498       static const bool has_denorm_loss = false;
    00499
    00500       static unsigned char infinity() throw()
    00501       { return static_cast<unsigned char>(0); }
    00502       static unsigned char quiet_NaN() throw()
    00503       { return static_cast<unsigned char>(0); }
    00504       static unsigned char signaling_NaN() throw()
    00505       { return static_cast<unsigned char>(0); }
    00506       static unsigned char denorm_min() throw()
    00507       { return static_cast<unsigned char>(0); }
    00508
    00509       static const bool is_iec559 = false;
    00510       static const bool is_bounded = true;
    00511       static const bool is_modulo = true;
    00512
    00513       static const bool traps = __glibcxx_integral_traps;
    00514       static const bool tinyness_before = false;
    00515       static const float_round_style round_style = round_toward_zero;
    00516     };
    00517
    00518   /// numeric_limits<wchar_t> specialization.
    00519   template<>
    00520     struct numeric_limits<wchar_t>
    00521     {
    00522       static const bool is_specialized = true;
    00523
    00524       static wchar_t min() throw()
    00525       { return __glibcxx_min (wchar_t); }
    00526       static wchar_t max() throw()
    00527       { return __glibcxx_max (wchar_t); }
    00528
    00529       static const int digits = __glibcxx_digits (wchar_t);
    00530       static const int digits10 = __glibcxx_digits10 (wchar_t);
    00531       static const bool is_signed = __glibcxx_signed (wchar_t);
    00532       static const bool is_integer = true;
    00533       static const bool is_exact = true;
    00534       static const int radix = 2;
    00535       static wchar_t epsilon() throw()
    00536       { return 0; }
    00537       static wchar_t round_error() throw()
    00538       { return 0; }
    00539
    00540       static const int min_exponent = 0;
    00541       static const int min_exponent10 = 0;
    00542       static const int max_exponent = 0;
    00543       static const int max_exponent10 = 0;
    00544
    00545       static const bool has_infinity = false;
    00546       static const bool has_quiet_NaN = false;
    00547       static const bool has_signaling_NaN = false;
    00548       static const float_denorm_style has_denorm = denorm_absent;
    00549       static const bool has_denorm_loss = false;
    00550
    00551       static wchar_t infinity() throw()
    00552       { return wchar_t(); }
    00553       static wchar_t quiet_NaN() throw()
    00554       { return wchar_t(); }
    00555       static wchar_t signaling_NaN() throw()
    00556       { return wchar_t(); }
    00557       static wchar_t denorm_min() throw()
    00558       { return wchar_t(); }
    00559
    00560       static const bool is_iec559 = false;
    00561       static const bool is_bounded = true;
    00562       static const bool is_modulo = true;
    00563
    00564       static const bool traps = __glibcxx_integral_traps;
    00565       static const bool tinyness_before = false;
    00566       static const float_round_style round_style = round_toward_zero;
    00567     };
    00568
    00569   /// numeric_limits<short> specialization.
    00570   template<>
    00571     struct numeric_limits<short>
    00572     {
    00573       static const bool is_specialized = true;
    00574
    00575       static short min() throw()
    00576       { return -__SHRT_MAX__ - 1; }
    00577       static short max() throw()
    00578       { return __SHRT_MAX__; }
    00579
    00580       static const int digits = __glibcxx_digits (short);
    00581       static const int digits10 = __glibcxx_digits10 (short);
    00582       static const bool is_signed = true;
    00583       static const bool is_integer = true;
    00584       static const bool is_exact = true;
    00585       static const int radix = 2;
    00586       static short epsilon() throw()
    00587       { return 0; }
    00588       static short round_error() throw()
    00589       { return 0; }
    00590
    00591       static const int min_exponent = 0;
    00592       static const int min_exponent10 = 0;
    00593       static const int max_exponent = 0;
    00594       static const int max_exponent10 = 0;
    00595
    00596       static const bool has_infinity = false;
    00597       static const bool has_quiet_NaN = false;
    00598       static const bool has_signaling_NaN = false;
    00599       static const float_denorm_style has_denorm = denorm_absent;
    00600       static const bool has_denorm_loss = false;
    00601
    00602       static short infinity() throw()
    00603       { return short(); }
    00604       static short quiet_NaN() throw()
    00605       { return short(); }
    00606       static short signaling_NaN() throw()
    00607       { return short(); }
    00608       static short denorm_min() throw()
    00609       { return short(); }
    00610
    00611       static const bool is_iec559 = false;
    00612       static const bool is_bounded = true;
    00613       static const bool is_modulo = true;
    00614
    00615       static const bool traps = __glibcxx_integral_traps;
    00616       static const bool tinyness_before = false;
    00617       static const float_round_style round_style = round_toward_zero;
    00618     };
    00619
    00620   /// numeric_limits<unsigned short> specialization.
    00621   template<>
    00622     struct numeric_limits<unsigned short>
    00623     {
    00624       static const bool is_specialized = true;
    00625
    00626       static unsigned short min() throw()
    00627       { return 0; }
    00628       static unsigned short max() throw()
    00629       { return __SHRT_MAX__ * 2U + 1; }
    00630
    00631       static const int digits = __glibcxx_digits (unsigned short);
    00632       static const int digits10 = __glibcxx_digits10 (unsigned short);
    00633       static const bool is_signed = false;
    00634       static const bool is_integer = true;
    00635       static const bool is_exact = true;
    00636       static const int radix = 2;
    00637       static unsigned short epsilon() throw()
    00638       { return 0; }
    00639       static unsigned short round_error() throw()
    00640       { return 0; }
    00641
    00642       static const int min_exponent = 0;
    00643       static const int min_exponent10 = 0;
    00644       static const int max_exponent = 0;
    00645       static const int max_exponent10 = 0;
    00646
    00647       static const bool has_infinity = false;
    00648       static const bool has_quiet_NaN = false;
    00649       static const bool has_signaling_NaN = false;
    00650       static const float_denorm_style has_denorm = denorm_absent;
    00651       static const bool has_denorm_loss = false;
    00652
    00653       static unsigned short infinity() throw()
    00654       { return static_cast<unsigned short>(0); }
    00655       static unsigned short quiet_NaN() throw()
    00656       { return static_cast<unsigned short>(0); }
    00657       static unsigned short signaling_NaN() throw()
    00658       { return static_cast<unsigned short>(0); }
    00659       static unsigned short denorm_min() throw()
    00660       { return static_cast<unsigned short>(0); }
    00661
    00662       static const bool is_iec559 = false;
    00663       static const bool is_bounded = true;
    00664       static const bool is_modulo = true;
    00665
    00666       static const bool traps = __glibcxx_integral_traps;
    00667       static const bool tinyness_before = false;
    00668       static const float_round_style round_style = round_toward_zero;
    00669     };
    00670
    00671   /// numeric_limits<int> specialization.
    00672   template<>
    00673     struct numeric_limits<int>
    00674     {
    00675       static const bool is_specialized = true;
    00676
    00677       static int min() throw()
    00678       { return -__INT_MAX__ - 1; }
    00679       static int max() throw()
    00680       { return __INT_MAX__; }
    00681
    00682       static const int digits = __glibcxx_digits (int);
    00683       static const int digits10 = __glibcxx_digits10 (int);
    00684       static const bool is_signed = true;
    00685       static const bool is_integer = true;
    00686       static const bool is_exact = true;
    00687       static const int radix = 2;
    00688       static int epsilon() throw()
    00689       { return 0; }
    00690       static int round_error() throw()
    00691       { return 0; }
    00692
    00693       static const int min_exponent = 0;
    00694       static const int min_exponent10 = 0;
    00695       static const int max_exponent = 0;
    00696       static const int max_exponent10 = 0;
    00697
    00698       static const bool has_infinity = false;
    00699       static const bool has_quiet_NaN = false;
    00700       static const bool has_signaling_NaN = false;
    00701       static const float_denorm_style has_denorm = denorm_absent;
    00702       static const bool has_denorm_loss = false;
    00703
    00704       static int infinity() throw()
    00705       { return static_cast<int>(0); }
    00706       static int quiet_NaN() throw()
    00707       { return static_cast<int>(0); }
    00708       static int signaling_NaN() throw()
    00709       { return static_cast<int>(0); }
    00710       static int denorm_min() throw()
    00711       { return static_cast<int>(0); }
    00712
    00713       static const bool is_iec559 = false;
    00714       static const bool is_bounded = true;
    00715       static const bool is_modulo = true;
    00716
    00717       static const bool traps = __glibcxx_integral_traps;
    00718       static const bool tinyness_before = false;
    00719       static const float_round_style round_style = round_toward_zero;
    00720     };
    00721
    00722   /// numeric_limits<unsigned int> specialization.
    00723   template<>
    00724     struct numeric_limits<unsigned int>
    00725     {
    00726       static const bool is_specialized = true;
    00727
    00728       static unsigned int min() throw()
    00729       { return 0; }
    00730       static unsigned int max() throw()
    00731       { return __INT_MAX__ * 2U + 1; }
    00732
    00733       static const int digits = __glibcxx_digits (unsigned int);
    00734       static const int digits10 = __glibcxx_digits10 (unsigned int);
    00735       static const bool is_signed = false;
    00736       static const bool is_integer = true;
    00737       static const bool is_exact = true;
    00738       static const int radix = 2;
    00739       static unsigned int epsilon() throw()
    00740       { return 0; }
    00741       static unsigned int round_error() throw()
    00742       { return 0; }
    00743
    00744       static const int min_exponent = 0;
    00745       static const int min_exponent10 = 0;
    00746       static const int max_exponent = 0;
    00747       static const int max_exponent10 = 0;
    00748
    00749       static const bool has_infinity = false;
    00750       static const bool has_quiet_NaN = false;
    00751       static const bool has_signaling_NaN = false;
    00752       static const float_denorm_style has_denorm = denorm_absent;
    00753       static const bool has_denorm_loss = false;
    00754
    00755       static unsigned int infinity() throw()
    00756       { return static_cast<unsigned int>(0); }
    00757       static unsigned int quiet_NaN() throw()
    00758       { return static_cast<unsigned int>(0); }
    00759       static unsigned int signaling_NaN() throw()
    00760       { return static_cast<unsigned int>(0); }
    00761       static unsigned int denorm_min() throw()
    00762       { return static_cast<unsigned int>(0); }
    00763
    00764       static const bool is_iec559 = false;
    00765       static const bool is_bounded = true;
    00766       static const bool is_modulo = true;
    00767
    00768       static const bool traps = __glibcxx_integral_traps;
    00769       static const bool tinyness_before = false;
    00770       static const float_round_style round_style = round_toward_zero;
    00771     };
    00772
    00773   /// numeric_limits<long> specialization.
    00774   template<>
    00775     struct numeric_limits<long>
    00776     {
    00777       static const bool is_specialized = true;
    00778
    00779       static long min() throw()
    00780       { return -__LONG_MAX__ - 1; }
    00781       static long max() throw()
    00782       { return __LONG_MAX__; }
    00783
    00784       static const int digits = __glibcxx_digits (long);
    00785       static const int digits10 = __glibcxx_digits10 (long);
    00786       static const bool is_signed = true;
    00787       static const bool is_integer = true;
    00788       static const bool is_exact = true;
    00789       static const int radix = 2;
    00790       static long epsilon() throw()
    00791       { return 0; }
    00792       static long round_error() throw()
    00793       { return 0; }
    00794
    00795       static const int min_exponent = 0;
    00796       static const int min_exponent10 = 0;
    00797       static const int max_exponent = 0;
    00798       static const int max_exponent10 = 0;
    00799
    00800       static const bool has_infinity = false;
    00801       static const bool has_quiet_NaN = false;
    00802       static const bool has_signaling_NaN = false;
    00803       static const float_denorm_style has_denorm = denorm_absent;
    00804       static const bool has_denorm_loss = false;
    00805
    00806       static long infinity() throw()
    00807       { return static_cast<long>(0); }
    00808       static long quiet_NaN() throw()
    00809       { return static_cast<long>(0); }
    00810       static long signaling_NaN() throw()
    00811       { return static_cast<long>(0); }
    00812       static long denorm_min() throw()
    00813       { return static_cast<long>(0); }
    00814
    00815       static const bool is_iec559 = false;
    00816       static const bool is_bounded = true;
    00817       static const bool is_modulo = true;
    00818
    00819       static const bool traps = __glibcxx_integral_traps;
    00820       static const bool tinyness_before = false;
    00821       static const float_round_style round_style = round_toward_zero;
    00822     };
    00823
    00824   /// numeric_limits<unsigned long> specialization.
    00825   template<>
    00826     struct numeric_limits<unsigned long>
    00827     {
    00828       static const bool is_specialized = true;
    00829
    00830       static unsigned long min() throw()
    00831       { return 0; }
    00832       static unsigned long max() throw()
    00833       { return __LONG_MAX__ * 2UL + 1; }
    00834
    00835       static const int digits = __glibcxx_digits (unsigned long);
    00836       static const int digits10 = __glibcxx_digits10 (unsigned long);
    00837       static const bool is_signed = false;
    00838       static const bool is_integer = true;
    00839       static const bool is_exact = true;
    00840       static const int radix = 2;
    00841       static unsigned long epsilon() throw()
    00842       { return 0; }
    00843       static unsigned long round_error() throw()
    00844       { return 0; }
    00845
    00846       static const int min_exponent = 0;
    00847       static const int min_exponent10 = 0;
    00848       static const int max_exponent = 0;
    00849       static const int max_exponent10 = 0;
    00850
    00851       static const bool has_infinity = false;
    00852       static const bool has_quiet_NaN = false;
    00853       static const bool has_signaling_NaN = false;
    00854       static const float_denorm_style has_denorm = denorm_absent;
    00855       static const bool has_denorm_loss = false;
    00856
    00857       static unsigned long infinity() throw()
    00858       { return static_cast<unsigned long>(0); }
    00859       static unsigned long quiet_NaN() throw()
    00860       { return static_cast<unsigned long>(0); }
    00861       static unsigned long signaling_NaN() throw()
    00862       { return static_cast<unsigned long>(0); }
    00863       static unsigned long denorm_min() throw()
    00864       { return static_cast<unsigned long>(0); }
    00865
    00866       static const bool is_iec559 = false;
    00867       static const bool is_bounded = true;
    00868       static const bool is_modulo = true;
    00869
    00870       static const bool traps = __glibcxx_integral_traps;
    00871       static const bool tinyness_before = false;
    00872       static const float_round_style round_style = round_toward_zero;
    00873     };
    00874
    00875   /// numeric_limits<long long> specialization.
    00876   template<>
    00877     struct numeric_limits<long long>
    00878     {
    00879       static const bool is_specialized = true;
    00880
    00881       static long long min() throw()
    00882       { return -__LONG_LONG_MAX__ - 1; }
    00883       static long long max() throw()
    00884       { return __LONG_LONG_MAX__; }
    00885
    00886       static const int digits = __glibcxx_digits (long long);
    00887       static const int digits10 = __glibcxx_digits10 (long long);
    00888       static const bool is_signed = true;
    00889       static const bool is_integer = true;
    00890       static const bool is_exact = true;
    00891       static const int radix = 2;
    00892       static long long epsilon() throw()
    00893       { return 0; }
    00894       static long long round_error() throw()
    00895       { return 0; }
    00896
    00897       static const int min_exponent = 0;
    00898       static const int min_exponent10 = 0;
    00899       static const int max_exponent = 0;
    00900       static const int max_exponent10 = 0;
    00901
    00902       static const bool has_infinity = false;
    00903       static const bool has_quiet_NaN = false;
    00904       static const bool has_signaling_NaN = false;
    00905       static const float_denorm_style has_denorm = denorm_absent;
    00906       static const bool has_denorm_loss = false;
    00907
    00908       static long long infinity() throw()
    00909       { return static_cast<long long>(0); }
    00910       static long long quiet_NaN() throw()
    00911       { return static_cast<long long>(0); }
    00912       static long long signaling_NaN() throw()
    00913       { return static_cast<long long>(0); }
    00914       static long long denorm_min() throw()
    00915       { return static_cast<long long>(0); }
    00916
    00917       static const bool is_iec559 = false;
    00918       static const bool is_bounded = true;
    00919       static const bool is_modulo = true;
    00920
    00921       static const bool traps = __glibcxx_integral_traps;
    00922       static const bool tinyness_before = false;
    00923       static const float_round_style round_style = round_toward_zero;
    00924     };
    00925
    00926   /// numeric_limits<unsigned long long> specialization.
    00927   template<>
    00928     struct numeric_limits<unsigned long long>
    00929     {
    00930       static const bool is_specialized = true;
    00931
    00932       static unsigned long long min() throw()
    00933       { return 0; }
    00934       static unsigned long long max() throw()
    00935       { return __LONG_LONG_MAX__ * 2ULL + 1; }
    00936
    00937       static const int digits = __glibcxx_digits (unsigned long long);
    00938       static const int digits10 = __glibcxx_digits10 (unsigned long long);
    00939       static const bool is_signed = false;
    00940       static const bool is_integer = true;
    00941       static const bool is_exact = true;
    00942       static const int radix = 2;
    00943       static unsigned long long epsilon() throw()
    00944       { return 0; }
    00945       static unsigned long long round_error() throw()
    00946       { return 0; }
    00947
    00948       static const int min_exponent = 0;
    00949       static const int min_exponent10 = 0;
    00950       static const int max_exponent = 0;
    00951       static const int max_exponent10 = 0;
    00952
    00953       static const bool has_infinity = false;
    00954       static const bool has_quiet_NaN = false;
    00955       static const bool has_signaling_NaN = false;
    00956       static const float_denorm_style has_denorm = denorm_absent;
    00957       static const bool has_denorm_loss = false;
    00958
    00959       static unsigned long long infinity() throw()
    00960       { return static_cast<unsigned long long>(0); }
    00961       static unsigned long long quiet_NaN() throw()
    00962       { return static_cast<unsigned long long>(0); }
    00963       static unsigned long long signaling_NaN() throw()
    00964       { return static_cast<unsigned long long>(0); }
    00965       static unsigned long long denorm_min() throw()
    00966       { return static_cast<unsigned long long>(0); }
    00967
    00968       static const bool is_iec559 = false;
    00969       static const bool is_bounded = true;
    00970       static const bool is_modulo = true;
    00971
    00972       static const bool traps = __glibcxx_integral_traps;
    00973       static const bool tinyness_before = false;
    00974       static const float_round_style round_style = round_toward_zero;
    00975     };
    00976
    00977   /// numeric_limits<float> specialization.
    00978   template<>
    00979     struct numeric_limits<float>
    00980     {
    00981       static const bool is_specialized = true;
    00982
    00983       static float min() throw()
    00984       { return __FLT_MIN__; }
    00985       static float max() throw()
    00986       { return __FLT_MAX__; }
    00987
    00988       static const int digits = __FLT_MANT_DIG__;
    00989       static const int digits10 = __FLT_DIG__;
    00990       static const bool is_signed = true;
    00991       static const bool is_integer = false;
    00992       static const bool is_exact = false;
    00993       static const int radix = __FLT_RADIX__;
    00994       static float epsilon() throw()
    00995       { return __FLT_EPSILON__; }
    00996       static float round_error() throw()
    00997       { return 0.5F; }
    00998
    00999       static const int min_exponent = __FLT_MIN_EXP__;
    01000       static const int min_exponent10 = __FLT_MIN_10_EXP__;
    01001       static const int max_exponent = __FLT_MAX_EXP__;
    01002       static const int max_exponent10 = __FLT_MAX_10_EXP__;
    01003
    01004       static const bool has_infinity = __FLT_HAS_INFINITY__;
    01005       static const bool has_quiet_NaN = __FLT_HAS_QUIET_NAN__;
    01006       static const bool has_signaling_NaN = has_quiet_NaN;
    01007       static const float_denorm_style has_denorm
    01008     = bool(__FLT_HAS_DENORM__) ? denorm_present : denorm_absent;
    01009       static const bool has_denorm_loss = __glibcxx_float_has_denorm_loss;
    01010
    01011       static float infinity() throw()
    01012       { return __builtin_huge_valf (); }
    01013       static float quiet_NaN() throw()
    01014       { return __builtin_nanf (""); }
    01015       static float signaling_NaN() throw()
    01016       { return __builtin_nansf (""); }
    01017       static float denorm_min() throw()
    01018       { return __FLT_DENORM_MIN__; }
    01019
    01020       static const bool is_iec559
    01021     = has_infinity && has_quiet_NaN && has_denorm == denorm_present;
    01022       static const bool is_bounded = true;
    01023       static const bool is_modulo = false;
    01024
    01025       static const bool traps = __glibcxx_float_traps;
    01026       static const bool tinyness_before = __glibcxx_float_tinyness_before;
    01027       static const float_round_style round_style = round_to_nearest;
    01028     };
    01029
    01030 #undef __glibcxx_float_has_denorm_loss
    01031 #undef __glibcxx_float_traps
    01032 #undef __glibcxx_float_tinyness_before
    01033
    01034   /// numeric_limits<double> specialization.
    01035   template<>
    01036     struct numeric_limits<double>
    01037     {
    01038       static const bool is_specialized = true;
    01039
    01040       static double min() throw()
    01041       { return __DBL_MIN__; }
    01042       static double max() throw()
    01043       { return __DBL_MAX__; }
    01044
    01045       static const int digits = __DBL_MANT_DIG__;
    01046       static const int digits10 = __DBL_DIG__;
    01047       static const bool is_signed = true;
    01048       static const bool is_integer = false;
    01049       static const bool is_exact = false;
    01050       static const int radix = __FLT_RADIX__;
    01051       static double epsilon() throw()
    01052       { return __DBL_EPSILON__; }
    01053       static double round_error() throw()
    01054       { return 0.5; }
    01055
    01056       static const int min_exponent = __DBL_MIN_EXP__;
    01057       static const int min_exponent10 = __DBL_MIN_10_EXP__;
    01058       static const int max_exponent = __DBL_MAX_EXP__;
    01059       static const int max_exponent10 = __DBL_MAX_10_EXP__;
    01060
    01061       static const bool has_infinity = __DBL_HAS_INFINITY__;
    01062       static const bool has_quiet_NaN = __DBL_HAS_QUIET_NAN__;
    01063       static const bool has_signaling_NaN = has_quiet_NaN;
    01064       static const float_denorm_style has_denorm
    01065     = bool(__DBL_HAS_DENORM__) ? denorm_present : denorm_absent;
    01066       static const bool has_denorm_loss = __glibcxx_double_has_denorm_loss;
    01067
    01068       static double infinity() throw()
    01069       { return __builtin_huge_val(); }
    01070       static double quiet_NaN() throw()
    01071       { return __builtin_nan (""); }
    01072       static double signaling_NaN() throw()
    01073       { return __builtin_nans (""); }
    01074       static double denorm_min() throw()
    01075       { return __DBL_DENORM_MIN__; }
    01076
    01077       static const bool is_iec559
    01078     = has_infinity && has_quiet_NaN && has_denorm == denorm_present;
    01079       static const bool is_bounded = true;
    01080       static const bool is_modulo = false;
    01081
    01082       static const bool traps = __glibcxx_double_traps;
    01083       static const bool tinyness_before = __glibcxx_double_tinyness_before;
    01084       static const float_round_style round_style = round_to_nearest;
    01085     };
    01086
    01087 #undef __glibcxx_double_has_denorm_loss
    01088 #undef __glibcxx_double_traps
    01089 #undef __glibcxx_double_tinyness_before
    01090
    01091   /// numeric_limits<long double> specialization.
    01092   template<>
    01093     struct numeric_limits<long double>
    01094     {
    01095       static const bool is_specialized = true;
    01096
    01097       static long double min() throw()
    01098       { return __LDBL_MIN__; }
    01099       static long double max() throw()
    01100       { return __LDBL_MAX__; }
    01101
    01102       static const int digits = __LDBL_MANT_DIG__;
    01103       static const int digits10 = __LDBL_DIG__;
    01104       static const bool is_signed = true;
    01105       static const bool is_integer = false;
    01106       static const bool is_exact = false;
    01107       static const int radix = __FLT_RADIX__;
    01108       static long double epsilon() throw()
    01109       { return __LDBL_EPSILON__; }
    01110       static long double round_error() throw()
    01111       { return 0.5L; }
    01112
    01113       static const int min_exponent = __LDBL_MIN_EXP__;
    01114       static const int min_exponent10 = __LDBL_MIN_10_EXP__;
    01115       static const int max_exponent = __LDBL_MAX_EXP__;
    01116       static const int max_exponent10 = __LDBL_MAX_10_EXP__;
    01117
    01118       static const bool has_infinity = __LDBL_HAS_INFINITY__;
    01119       static const bool has_quiet_NaN = __LDBL_HAS_QUIET_NAN__;
    01120       static const bool has_signaling_NaN = has_quiet_NaN;
    01121       static const float_denorm_style has_denorm
    01122     = bool(__LDBL_HAS_DENORM__) ? denorm_present : denorm_absent;
    01123       static const bool has_denorm_loss
    01124     = __glibcxx_long_double_has_denorm_loss;
    01125
    01126       static long double infinity() throw()
    01127       { return __builtin_huge_vall (); }
    01128       static long double quiet_NaN() throw()
    01129       { return __builtin_nanl (""); }
    01130       static long double signaling_NaN() throw()
    01131       { return __builtin_nansl (""); }
    01132       static long double denorm_min() throw()
    01133       { return __LDBL_DENORM_MIN__; }
    01134
    01135       static const bool is_iec559
    01136     = has_infinity && has_quiet_NaN && has_denorm == denorm_present;
    01137       static const bool is_bounded = true;
    01138       static const bool is_modulo = false;
    01139
    01140       static const bool traps = __glibcxx_long_double_traps;
    01141       static const bool tinyness_before = __glibcxx_long_double_tinyness_before;
    01142       static const float_round_style round_style = round_to_nearest;
    01143     };
    01144
    01145 #undef __glibcxx_long_double_has_denorm_loss
    01146 #undef __glibcxx_long_double_traps
    01147 #undef __glibcxx_long_double_tinyness_before
    01148
    01149 _GLIBCXX_END_NAMESPACE
    01150
    01151 #undef __glibcxx_signed
    01152 #undef __glibcxx_min
    01153 #undef __glibcxx_max
    01154 #undef __glibcxx_digits
    01155 #undef __glibcxx_digits10
    01156
    01157 #endif // _GLIBCXX_NUMERIC_LIMITS