Merged r156806 through r156977 into branch.
[official-gcc.git] / libstdc++-v3 / include / std / limits
bloba633d78bf034bf8cb4799048c3d07f9bab3e7e89
1 // The template and inlines for the numeric_limits classes. -*- C++ -*- 
3 // Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007,
4 // 2008, 2009, 2010  Free Software Foundation, Inc.
5 //
6 // This file is part of the GNU ISO C++ Library.  This library is free
7 // software; you can redistribute it and/or modify it under the
8 // terms of the GNU General Public License as published by the
9 // Free Software Foundation; either version 3, or (at your option)
10 // any later version.
12 // This library is distributed in the hope that it will be useful,
13 // but WITHOUT ANY WARRANTY; without even the implied warranty of
14 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 // GNU General Public License for more details.
17 // Under Section 7 of GPL version 3, you are granted additional
18 // permissions described in the GCC Runtime Library Exception, version
19 // 3.1, as published by the Free Software Foundation.
21 // You should have received a copy of the GNU General Public License and
22 // a copy of the GCC Runtime Library Exception along with this program;
23 // see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
24 // <http://www.gnu.org/licenses/>.
26 /** @file limits
27  *  This is a Standard C++ Library header.
28  */
30 // Note: this is not a conforming implementation.
31 // Written by Gabriel Dos Reis <gdr@codesourcery.com>
34 // ISO 14882:1998
35 // 18.2.1
38 #ifndef _GLIBCXX_NUMERIC_LIMITS
39 #define _GLIBCXX_NUMERIC_LIMITS 1
41 #pragma GCC system_header
43 #include <bits/c++config.h>
46 // The numeric_limits<> traits document implementation-defined aspects
47 // of fundamental arithmetic data types (integers and floating points).
48 // From Standard C++ point of view, there are 14 such types:
49 //   * integers
50 //         bool                                                 (1)
51 //         char, signed char, unsigned char, wchar_t            (4)
52 //         short, unsigned short                                (2)
53 //         int, unsigned                                        (2)
54 //         long, unsigned long                                  (2)
56 //   * floating points
57 //         float                                                (1)
58 //         double                                               (1)
59 //         long double                                          (1)
61 // GNU C++ understands (where supported by the host C-library)
62 //   * integer
63 //         long long, unsigned long long                        (2)
65 // which brings us to 16 fundamental arithmetic data types in GNU C++.
68 // Since a numeric_limits<> is a bit tricky to get right, we rely on
69 // an interface composed of macros which should be defined in config/os
70 // or config/cpu when they differ from the generic (read arbitrary)
71 // definitions given here.
74 // These values can be overridden in the target configuration file.
75 // The default values are appropriate for many 32-bit targets.
77 // GCC only intrinsically supports modulo integral types.  The only remaining
78 // integral exceptional values is division by zero.  Only targets that do not
79 // signal division by zero in some "hard to ignore" way should use false.
80 #ifndef __glibcxx_integral_traps
81 # define __glibcxx_integral_traps true
82 #endif
84 // float
87 // Default values.  Should be overridden in configuration files if necessary.
89 #ifndef __glibcxx_float_has_denorm_loss
90 #  define __glibcxx_float_has_denorm_loss false
91 #endif
92 #ifndef __glibcxx_float_traps
93 #  define __glibcxx_float_traps false
94 #endif
95 #ifndef __glibcxx_float_tinyness_before
96 #  define __glibcxx_float_tinyness_before false
97 #endif
99 // double
101 // Default values.  Should be overridden in configuration files if necessary.
103 #ifndef __glibcxx_double_has_denorm_loss
104 #  define __glibcxx_double_has_denorm_loss false
105 #endif
106 #ifndef __glibcxx_double_traps
107 #  define __glibcxx_double_traps false
108 #endif
109 #ifndef __glibcxx_double_tinyness_before
110 #  define __glibcxx_double_tinyness_before false
111 #endif
113 // long double
115 // Default values.  Should be overridden in configuration files if necessary.
117 #ifndef __glibcxx_long_double_has_denorm_loss
118 #  define __glibcxx_long_double_has_denorm_loss false
119 #endif
120 #ifndef __glibcxx_long_double_traps
121 #  define __glibcxx_long_double_traps false
122 #endif
123 #ifndef __glibcxx_long_double_tinyness_before
124 #  define __glibcxx_long_double_tinyness_before false
125 #endif
127 // You should not need to define any macros below this point.
129 #define __glibcxx_signed(T)     ((T)(-1) < 0)
131 #define __glibcxx_min(T) \
132   (__glibcxx_signed (T) ? (T)1 << __glibcxx_digits (T) : (T)0)
134 #define __glibcxx_max(T) \
135   (__glibcxx_signed (T) ? \
136    (((((T)1 << (__glibcxx_digits (T) - 1)) - 1) << 1) + 1) : ~(T)0)
138 #define __glibcxx_digits(T) \
139   (sizeof(T) * __CHAR_BIT__ - __glibcxx_signed (T))
141 // The fraction 643/2136 approximates log10(2) to 7 significant digits.
142 #define __glibcxx_digits10(T) \
143   (__glibcxx_digits (T) * 643 / 2136)
146 _GLIBCXX_BEGIN_NAMESPACE(std)
148   /**
149    *  @brief Describes the rounding style for floating-point types.
150    *
151    *  This is used in the std::numeric_limits class.
152   */
153   enum float_round_style
154   {
155     round_indeterminate       = -1,    ///< Self-explanatory.
156     round_toward_zero         = 0,     ///< Self-explanatory.
157     round_to_nearest          = 1,     ///< To the nearest representable value.
158     round_toward_infinity     = 2,     ///< Self-explanatory.
159     round_toward_neg_infinity = 3      ///< Self-explanatory.
160   };
162   /**
163    *  @brief Describes the denormalization for floating-point types.
164    *
165    *  These values represent the presence or absence of a variable number
166    *  of exponent bits.  This type is used in the std::numeric_limits class.
167   */
168   enum float_denorm_style
169   {
170     /// Indeterminate at compile time whether denormalized values are allowed.
171     denorm_indeterminate = -1,
172     /// The type does not allow denormalized values.
173     denorm_absent        = 0,
174     /// The type allows denormalized values.
175     denorm_present       = 1
176   };
178   /**
179    *  @brief Part of std::numeric_limits.
180    *
181    *  The @c static @c const members are usable as integral constant
182    *  expressions.
183    *
184    *  @note This is a separate class for purposes of efficiency; you
185    *        should only access these members as part of an instantiation
186    *        of the std::numeric_limits class.
187   */
188   struct __numeric_limits_base
189   {
190     /** This will be true for all fundamental types (which have
191         specializations), and false for everything else.  */
192     static const bool is_specialized = false;
194     /** The number of @c radix digits that be represented without change:  for
195         integer types, the number of non-sign bits in the mantissa; for
196         floating types, the number of @c radix digits in the mantissa.  */
197     static const int digits = 0;
198     /** The number of base 10 digits that can be represented without change. */
199     static const int digits10 = 0;
200     /** True if the type is signed.  */
201     static const bool is_signed = false;
202     /** True if the type is integer.
203      *  Is this supposed to be <em>if the type is integral?</em>
204     */
205     static const bool is_integer = false;
206     /** True if the type uses an exact representation. <em>All integer types are
207         exact, but not all exact types are integer.  For example, rational and
208         fixed-exponent representations are exact but not integer.</em>
209         [18.2.1.2]/15  */
210     static const bool is_exact = false;
211     /** For integer types, specifies the base of the representation.  For
212         floating types, specifies the base of the exponent representation.  */
213     static const int radix = 0;
215     /** The minimum negative integer such that @c radix raised to the power of
216         (one less than that integer) is a normalized floating point number.  */
217     static const int min_exponent = 0;
218     /** The minimum negative integer such that 10 raised to that power is in
219         the range of normalized floating point numbers.  */
220     static const int min_exponent10 = 0;
221     /** The maximum positive integer such that @c radix raised to the power of
222         (one less than that integer) is a representable finite floating point
223         number.  */
224     static const int max_exponent = 0;
225     /** The maximum positive integer such that 10 raised to that power is in
226         the range of representable finite floating point numbers.  */
227     static const int max_exponent10 = 0;
229     /** True if the type has a representation for positive infinity.  */
230     static const bool has_infinity = false;
231     /** True if the type has a representation for a quiet (non-signaling)
232         <em>Not a Number</em>.  */
233     static const bool has_quiet_NaN = false;
234     /** True if the type has a representation for a signaling
235         <em>Not a Number</em>.  */
236     static const bool has_signaling_NaN = false;
237     /** See std::float_denorm_style for more information.  */
238     static const float_denorm_style has_denorm = denorm_absent;
239     /** <em>True if loss of accuracy is detected as a denormalization loss,
240         rather than as an inexact result.</em> [18.2.1.2]/42  */
241     static const bool has_denorm_loss = false;
243     /** True if-and-only-if the type adheres to the IEC 559 standard, also
244         known as IEEE 754.  (Only makes sense for floating point types.)  */
245     static const bool is_iec559 = false;
246     /** <em>True if the set of values representable by the type is
247         finite.  All built-in types are bounded, this member would be
248         false for arbitrary precision types.</em> [18.2.1.2]/54  */
249     static const bool is_bounded = false;
250     /** True if the type is @e modulo, that is, if it is possible to add two
251         positive numbers and have a result that wraps around to a third number
252         that is less.  Typically false for floating types, true for unsigned
253         integers, and true for signed integers.  */
254     static const bool is_modulo = false;
256     /** True if trapping is implemented for this type.  */
257     static const bool traps = false;
258     /** True if tininess is detected before rounding.  (see IEC 559)  */
259     static const bool tinyness_before = false;
260     /** See std::float_round_style for more information.  This is only
261         meaningful for floating types; integer types will all be
262         round_toward_zero.  */
263     static const float_round_style round_style = round_toward_zero;
264   };
266   /**
267    *  @brief Properties of fundamental types.
268    *
269    *  This class allows a program to obtain information about the
270    *  representation of a fundamental type on a given platform.  For
271    *  non-fundamental types, the functions will return 0 and the data
272    *  members will all be @c false.
273    *
274    *  _GLIBCXX_RESOLVE_LIB_DEFECTS:  DRs 201 and 184 (hi Gaby!) are
275    *  noted, but not incorporated in this documented (yet).
276   */
277   template<typename _Tp>
278     struct numeric_limits : public __numeric_limits_base
279     {
280       /** The minimum finite value, or for floating types with
281           denormalization, the minimum positive normalized value.  */
282       static _Tp min() throw() { return static_cast<_Tp>(0); }
283       /** The maximum finite value.  */
284       static _Tp max() throw() { return static_cast<_Tp>(0); }
285       /** The @e machine @e epsilon:  the difference between 1 and the least
286           value greater than 1 that is representable.  */
287       static _Tp epsilon() throw() { return static_cast<_Tp>(0); }
288       /** The maximum rounding error measurement (see LIA-1).  */
289       static _Tp round_error() throw() { return static_cast<_Tp>(0); }
290       /** The representation of positive infinity, if @c has_infinity.  */
291       static _Tp infinity() throw()  { return static_cast<_Tp>(0); }
293       /** The representation of a quiet <em>Not a Number</em>, 
294           if @c has_quiet_NaN. */
295       static _Tp quiet_NaN() throw() { return static_cast<_Tp>(0); }
296       /** The representation of a signaling <em>Not a Number</em>, if
297           @c has_signaling_NaN. */
298       static _Tp signaling_NaN() throw() { return static_cast<_Tp>(0); }
299       /** The minimum positive denormalized value.  For types where
300           @c has_denorm is false, this is the minimum positive normalized
301           value.  */
302       static _Tp denorm_min() throw() { return static_cast<_Tp>(0); }
303     };
305 #ifdef __GXX_EXPERIMENTAL_CXX0X__
306   template<typename _Tp>
307     struct numeric_limits<const _Tp>
308     : public numeric_limits<_Tp> { };
310   template<typename _Tp>
311     struct numeric_limits<volatile _Tp>
312     : public numeric_limits<_Tp> { };
314   template<typename _Tp>
315     struct numeric_limits<const volatile _Tp>
316     : public numeric_limits<_Tp> { };
317 #endif
319   // Now there follow 16 explicit specializations.  Yes, 16.  Make sure
320   // you get the count right. (18 in c++0x mode)
322   /// numeric_limits<bool> specialization.
323   template<>
324     struct numeric_limits<bool>
325     {
326       static const bool is_specialized = true;
328       static bool min() throw()
329       { return false; }
330       static bool max() throw()
331       { return true; }
333       static const int digits = 1;
334       static const int digits10 = 0;
335       static const bool is_signed = false;
336       static const bool is_integer = true;
337       static const bool is_exact = true;
338       static const int radix = 2;
339       static bool epsilon() throw()
340       { return false; }
341       static bool round_error() throw()
342       { return false; }
344       static const int min_exponent = 0;
345       static const int min_exponent10 = 0;
346       static const int max_exponent = 0;
347       static const int max_exponent10 = 0;
349       static const bool has_infinity = false;
350       static const bool has_quiet_NaN = false;
351       static const bool has_signaling_NaN = false;
352       static const float_denorm_style has_denorm = denorm_absent;
353       static const bool has_denorm_loss = false;
355       static bool infinity() throw()
356       { return false; }
357       static bool quiet_NaN() throw()
358       { return false; }
359       static bool signaling_NaN() throw()
360       { return false; }
361       static bool denorm_min() throw()
362       { return false; }
364       static const bool is_iec559 = false;
365       static const bool is_bounded = true;
366       static const bool is_modulo = false;
368       // It is not clear what it means for a boolean type to trap.
369       // This is a DR on the LWG issue list.  Here, I use integer
370       // promotion semantics.
371       static const bool traps = __glibcxx_integral_traps;
372       static const bool tinyness_before = false;
373       static const float_round_style round_style = round_toward_zero;
374     };
376   /// numeric_limits<char> specialization.
377   template<>
378     struct numeric_limits<char>
379     {
380       static const bool is_specialized = true;
382       static char min() throw()
383       { return __glibcxx_min(char); }
384       static char max() throw()
385       { return __glibcxx_max(char); }
387       static const int digits = __glibcxx_digits (char);
388       static const int digits10 = __glibcxx_digits10 (char);
389       static const bool is_signed = __glibcxx_signed (char);
390       static const bool is_integer = true;
391       static const bool is_exact = true;
392       static const int radix = 2;
393       static char epsilon() throw()
394       { return 0; }
395       static char round_error() throw()
396       { return 0; }
398       static const int min_exponent = 0;
399       static const int min_exponent10 = 0;
400       static const int max_exponent = 0;
401       static const int max_exponent10 = 0;
403       static const bool has_infinity = false;
404       static const bool has_quiet_NaN = false;
405       static const bool has_signaling_NaN = false;
406       static const float_denorm_style has_denorm = denorm_absent;
407       static const bool has_denorm_loss = false;
409       static char infinity() throw()
410       { return char(); }
411       static char quiet_NaN() throw()
412       { return char(); }
413       static char signaling_NaN() throw()
414       { return char(); }
415       static char denorm_min() throw()
416       { return static_cast<char>(0); }
418       static const bool is_iec559 = false;
419       static const bool is_bounded = true;
420       static const bool is_modulo = true;
422       static const bool traps = __glibcxx_integral_traps;
423       static const bool tinyness_before = false;
424       static const float_round_style round_style = round_toward_zero;
425     };
427   /// numeric_limits<signed char> specialization.
428   template<>
429     struct numeric_limits<signed char>
430     {
431       static const bool is_specialized = true;
433       static signed char min() throw()
434       { return -__SCHAR_MAX__ - 1; }
435       static signed char max() throw()
436       { return __SCHAR_MAX__; }
438       static const int digits = __glibcxx_digits (signed char);
439       static const int digits10 = __glibcxx_digits10 (signed char);
440       static const bool is_signed = true;
441       static const bool is_integer = true;
442       static const bool is_exact = true;
443       static const int radix = 2;
444       static signed char epsilon() throw()
445       { return 0; }
446       static signed char round_error() throw()
447       { return 0; }
449       static const int min_exponent = 0;
450       static const int min_exponent10 = 0;
451       static const int max_exponent = 0;
452       static const int max_exponent10 = 0;
454       static const bool has_infinity = false;
455       static const bool has_quiet_NaN = false;
456       static const bool has_signaling_NaN = false;
457       static const float_denorm_style has_denorm = denorm_absent;
458       static const bool has_denorm_loss = false;
460       static signed char infinity() throw()
461       { return static_cast<signed char>(0); }
462       static signed char quiet_NaN() throw()
463       { return static_cast<signed char>(0); }
464       static signed char signaling_NaN() throw()
465       { return static_cast<signed char>(0); }
466       static signed char denorm_min() throw()
467       { return static_cast<signed char>(0); }
469       static const bool is_iec559 = false;
470       static const bool is_bounded = true;
471       static const bool is_modulo = true;
473       static const bool traps = __glibcxx_integral_traps;
474       static const bool tinyness_before = false;
475       static const float_round_style round_style = round_toward_zero;
476     };
478   /// numeric_limits<unsigned char> specialization.
479   template<>
480     struct numeric_limits<unsigned char>
481     {
482       static const bool is_specialized = true;
484       static unsigned char min() throw()
485       { return 0; }
486       static unsigned char max() throw()
487       { return __SCHAR_MAX__ * 2U + 1; }
489       static const int digits = __glibcxx_digits (unsigned char);
490       static const int digits10 = __glibcxx_digits10 (unsigned char);
491       static const bool is_signed = false;
492       static const bool is_integer = true;
493       static const bool is_exact = true;
494       static const int radix = 2;
495       static unsigned char epsilon() throw()
496       { return 0; }
497       static unsigned char round_error() throw()
498       { return 0; }
500       static const int min_exponent = 0;
501       static const int min_exponent10 = 0;
502       static const int max_exponent = 0;
503       static const int max_exponent10 = 0;
505       static const bool has_infinity = false;
506       static const bool has_quiet_NaN = false;
507       static const bool has_signaling_NaN = false;
508       static const float_denorm_style has_denorm = denorm_absent;
509       static const bool has_denorm_loss = false;
511       static unsigned char infinity() throw()
512       { return static_cast<unsigned char>(0); }
513       static unsigned char quiet_NaN() throw()
514       { return static_cast<unsigned char>(0); }
515       static unsigned char signaling_NaN() throw()
516       { return static_cast<unsigned char>(0); }
517       static unsigned char denorm_min() throw()
518       { return static_cast<unsigned char>(0); }
520       static const bool is_iec559 = false;
521       static const bool is_bounded = true;
522       static const bool is_modulo = true;
524       static const bool traps = __glibcxx_integral_traps;
525       static const bool tinyness_before = false;
526       static const float_round_style round_style = round_toward_zero;
527     };
529   /// numeric_limits<wchar_t> specialization.
530   template<>
531     struct numeric_limits<wchar_t>
532     {
533       static const bool is_specialized = true;
535       static wchar_t min() throw()
536       { return __glibcxx_min (wchar_t); }
537       static wchar_t max() throw()
538       { return __glibcxx_max (wchar_t); }
540       static const int digits = __glibcxx_digits (wchar_t);
541       static const int digits10 = __glibcxx_digits10 (wchar_t);
542       static const bool is_signed = __glibcxx_signed (wchar_t);
543       static const bool is_integer = true;
544       static const bool is_exact = true;
545       static const int radix = 2;
546       static wchar_t epsilon() throw()
547       { return 0; }
548       static wchar_t round_error() throw()
549       { return 0; }
551       static const int min_exponent = 0;
552       static const int min_exponent10 = 0;
553       static const int max_exponent = 0;
554       static const int max_exponent10 = 0;
556       static const bool has_infinity = false;
557       static const bool has_quiet_NaN = false;
558       static const bool has_signaling_NaN = false;
559       static const float_denorm_style has_denorm = denorm_absent;
560       static const bool has_denorm_loss = false;
562       static wchar_t infinity() throw()
563       { return wchar_t(); }
564       static wchar_t quiet_NaN() throw()
565       { return wchar_t(); }
566       static wchar_t signaling_NaN() throw()
567       { return wchar_t(); }
568       static wchar_t denorm_min() throw()
569       { return wchar_t(); }
571       static const bool is_iec559 = false;
572       static const bool is_bounded = true;
573       static const bool is_modulo = true;
575       static const bool traps = __glibcxx_integral_traps;
576       static const bool tinyness_before = false;
577       static const float_round_style round_style = round_toward_zero;
578     };
580 #ifdef __GXX_EXPERIMENTAL_CXX0X__
581   /// numeric_limits<char16_t> specialization.
582   template<>
583     struct numeric_limits<char16_t>
584     {
585       static const bool is_specialized = true;
587       static char16_t min() throw()
588       { return __glibcxx_min (char16_t); }
589       static char16_t max() throw()
590       { return __glibcxx_max (char16_t); }
592       static const int digits = __glibcxx_digits (char16_t);
593       static const int digits10 = __glibcxx_digits10 (char16_t);
594       static const bool is_signed = __glibcxx_signed (char16_t);
595       static const bool is_integer = true;
596       static const bool is_exact = true;
597       static const int radix = 2;
598       static char16_t epsilon() throw()
599       { return 0; }
600       static char16_t round_error() throw()
601       { return 0; }
603       static const int min_exponent = 0;
604       static const int min_exponent10 = 0;
605       static const int max_exponent = 0;
606       static const int max_exponent10 = 0;
608       static const bool has_infinity = false;
609       static const bool has_quiet_NaN = false;
610       static const bool has_signaling_NaN = false;
611       static const float_denorm_style has_denorm = denorm_absent;
612       static const bool has_denorm_loss = false;
614       static char16_t infinity() throw()
615       { return char16_t(); }
616       static char16_t quiet_NaN() throw()
617       { return char16_t(); }
618       static char16_t signaling_NaN() throw()
619       { return char16_t(); }
620       static char16_t denorm_min() throw()
621       { return char16_t(); }
623       static const bool is_iec559 = false;
624       static const bool is_bounded = true;
625       static const bool is_modulo = true;
627       static const bool traps = __glibcxx_integral_traps;
628       static const bool tinyness_before = false;
629       static const float_round_style round_style = round_toward_zero;
630     };
632   /// numeric_limits<char32_t> specialization.
633   template<>
634     struct numeric_limits<char32_t>
635     {
636       static const bool is_specialized = true;
638       static char32_t min() throw()
639       { return __glibcxx_min (char32_t); }
640       static char32_t max() throw()
641       { return __glibcxx_max (char32_t); }
643       static const int digits = __glibcxx_digits (char32_t);
644       static const int digits10 = __glibcxx_digits10 (char32_t);
645       static const bool is_signed = __glibcxx_signed (char32_t);
646       static const bool is_integer = true;
647       static const bool is_exact = true;
648       static const int radix = 2;
649       static char32_t epsilon() throw()
650       { return 0; }
651       static char32_t round_error() throw()
652       { return 0; }
654       static const int min_exponent = 0;
655       static const int min_exponent10 = 0;
656       static const int max_exponent = 0;
657       static const int max_exponent10 = 0;
659       static const bool has_infinity = false;
660       static const bool has_quiet_NaN = false;
661       static const bool has_signaling_NaN = false;
662       static const float_denorm_style has_denorm = denorm_absent;
663       static const bool has_denorm_loss = false;
665       static char32_t infinity() throw()
666       { return char32_t(); }
667       static char32_t quiet_NaN() throw()
668       { return char32_t(); }
669       static char32_t signaling_NaN() throw()
670       { return char32_t(); }
671       static char32_t denorm_min() throw()
672       { return char32_t(); }
674       static const bool is_iec559 = false;
675       static const bool is_bounded = true;
676       static const bool is_modulo = true;
678       static const bool traps = __glibcxx_integral_traps;
679       static const bool tinyness_before = false;
680       static const float_round_style round_style = round_toward_zero;
681     };
682 #endif
684   /// numeric_limits<short> specialization.
685   template<>
686     struct numeric_limits<short>
687     {
688       static const bool is_specialized = true;
690       static short min() throw()
691       { return -__SHRT_MAX__ - 1; }
692       static short max() throw()
693       { return __SHRT_MAX__; }
695       static const int digits = __glibcxx_digits (short);
696       static const int digits10 = __glibcxx_digits10 (short);
697       static const bool is_signed = true;
698       static const bool is_integer = true;
699       static const bool is_exact = true;
700       static const int radix = 2;
701       static short epsilon() throw()
702       { return 0; }
703       static short round_error() throw()
704       { return 0; }
706       static const int min_exponent = 0;
707       static const int min_exponent10 = 0;
708       static const int max_exponent = 0;
709       static const int max_exponent10 = 0;
711       static const bool has_infinity = false;
712       static const bool has_quiet_NaN = false;
713       static const bool has_signaling_NaN = false;
714       static const float_denorm_style has_denorm = denorm_absent;
715       static const bool has_denorm_loss = false;
717       static short infinity() throw()
718       { return short(); }
719       static short quiet_NaN() throw()
720       { return short(); }
721       static short signaling_NaN() throw()
722       { return short(); }
723       static short denorm_min() throw()
724       { return short(); }
726       static const bool is_iec559 = false;
727       static const bool is_bounded = true;
728       static const bool is_modulo = true;
730       static const bool traps = __glibcxx_integral_traps;
731       static const bool tinyness_before = false;
732       static const float_round_style round_style = round_toward_zero;
733     };
735   /// numeric_limits<unsigned short> specialization.
736   template<>
737     struct numeric_limits<unsigned short>
738     {
739       static const bool is_specialized = true;
741       static unsigned short min() throw()
742       { return 0; }
743       static unsigned short max() throw()
744       { return __SHRT_MAX__ * 2U + 1; }
746       static const int digits = __glibcxx_digits (unsigned short);
747       static const int digits10 = __glibcxx_digits10 (unsigned short);
748       static const bool is_signed = false;
749       static const bool is_integer = true;
750       static const bool is_exact = true;
751       static const int radix = 2;
752       static unsigned short epsilon() throw()
753       { return 0; }
754       static unsigned short round_error() throw()
755       { return 0; }
757       static const int min_exponent = 0;
758       static const int min_exponent10 = 0;
759       static const int max_exponent = 0;
760       static const int max_exponent10 = 0;
762       static const bool has_infinity = false;
763       static const bool has_quiet_NaN = false;
764       static const bool has_signaling_NaN = false;
765       static const float_denorm_style has_denorm = denorm_absent;
766       static const bool has_denorm_loss = false;
768       static unsigned short infinity() throw()
769       { return static_cast<unsigned short>(0); }
770       static unsigned short quiet_NaN() throw()
771       { return static_cast<unsigned short>(0); }
772       static unsigned short signaling_NaN() throw()
773       { return static_cast<unsigned short>(0); }
774       static unsigned short denorm_min() throw()
775       { return static_cast<unsigned short>(0); }
777       static const bool is_iec559 = false;
778       static const bool is_bounded = true;
779       static const bool is_modulo = true;
781       static const bool traps = __glibcxx_integral_traps;
782       static const bool tinyness_before = false;
783       static const float_round_style round_style = round_toward_zero;
784     };
786   /// numeric_limits<int> specialization.
787   template<>
788     struct numeric_limits<int>
789     {
790       static const bool is_specialized = true;
792       static int min() throw()
793       { return -__INT_MAX__ - 1; }
794       static int max() throw()
795       { return __INT_MAX__; }
797       static const int digits = __glibcxx_digits (int);
798       static const int digits10 = __glibcxx_digits10 (int);
799       static const bool is_signed = true;
800       static const bool is_integer = true;
801       static const bool is_exact = true;
802       static const int radix = 2;
803       static int epsilon() throw()
804       { return 0; }
805       static int round_error() throw()
806       { return 0; }
808       static const int min_exponent = 0;
809       static const int min_exponent10 = 0;
810       static const int max_exponent = 0;
811       static const int max_exponent10 = 0;
813       static const bool has_infinity = false;
814       static const bool has_quiet_NaN = false;
815       static const bool has_signaling_NaN = false;
816       static const float_denorm_style has_denorm = denorm_absent;
817       static const bool has_denorm_loss = false;
819       static int infinity() throw()
820       { return static_cast<int>(0); }
821       static int quiet_NaN() throw()
822       { return static_cast<int>(0); }
823       static int signaling_NaN() throw()
824       { return static_cast<int>(0); }
825       static int denorm_min() throw()
826       { return static_cast<int>(0); }
828       static const bool is_iec559 = false;
829       static const bool is_bounded = true;
830       static const bool is_modulo = true;
832       static const bool traps = __glibcxx_integral_traps;
833       static const bool tinyness_before = false;
834       static const float_round_style round_style = round_toward_zero;
835     };
837   /// numeric_limits<unsigned int> specialization.
838   template<>
839     struct numeric_limits<unsigned int>
840     {
841       static const bool is_specialized = true;
843       static unsigned int min() throw()
844       { return 0; }
845       static unsigned int max() throw()
846       { return __INT_MAX__ * 2U + 1; }
848       static const int digits = __glibcxx_digits (unsigned int);
849       static const int digits10 = __glibcxx_digits10 (unsigned int);
850       static const bool is_signed = false;
851       static const bool is_integer = true;
852       static const bool is_exact = true;
853       static const int radix = 2;
854       static unsigned int epsilon() throw()
855       { return 0; }
856       static unsigned int round_error() throw()
857       { return 0; }
859       static const int min_exponent = 0;
860       static const int min_exponent10 = 0;
861       static const int max_exponent = 0;
862       static const int max_exponent10 = 0;
864       static const bool has_infinity = false;
865       static const bool has_quiet_NaN = false;
866       static const bool has_signaling_NaN = false;
867       static const float_denorm_style has_denorm = denorm_absent;
868       static const bool has_denorm_loss = false;
870       static unsigned int infinity() throw()
871       { return static_cast<unsigned int>(0); }
872       static unsigned int quiet_NaN() throw()
873       { return static_cast<unsigned int>(0); }
874       static unsigned int signaling_NaN() throw()
875       { return static_cast<unsigned int>(0); }
876       static unsigned int denorm_min() throw()
877       { return static_cast<unsigned int>(0); }
879       static const bool is_iec559 = false;
880       static const bool is_bounded = true;
881       static const bool is_modulo = true;
883       static const bool traps = __glibcxx_integral_traps;
884       static const bool tinyness_before = false;
885       static const float_round_style round_style = round_toward_zero;
886     };
888   /// numeric_limits<long> specialization.
889   template<>
890     struct numeric_limits<long>
891     {
892       static const bool is_specialized = true;
894       static long min() throw()
895       { return -__LONG_MAX__ - 1; }
896       static long max() throw()
897       { return __LONG_MAX__; }
899       static const int digits = __glibcxx_digits (long);
900       static const int digits10 = __glibcxx_digits10 (long);
901       static const bool is_signed = true;
902       static const bool is_integer = true;
903       static const bool is_exact = true;
904       static const int radix = 2;
905       static long epsilon() throw()
906       { return 0; }
907       static long round_error() throw()
908       { return 0; }
910       static const int min_exponent = 0;
911       static const int min_exponent10 = 0;
912       static const int max_exponent = 0;
913       static const int max_exponent10 = 0;
915       static const bool has_infinity = false;
916       static const bool has_quiet_NaN = false;
917       static const bool has_signaling_NaN = false;
918       static const float_denorm_style has_denorm = denorm_absent;
919       static const bool has_denorm_loss = false;
921       static long infinity() throw()
922       { return static_cast<long>(0); }
923       static long quiet_NaN() throw()
924       { return static_cast<long>(0); }
925       static long signaling_NaN() throw()
926       { return static_cast<long>(0); }
927       static long denorm_min() throw()
928       { return static_cast<long>(0); }
930       static const bool is_iec559 = false;
931       static const bool is_bounded = true;
932       static const bool is_modulo = true;
934       static const bool traps = __glibcxx_integral_traps;
935       static const bool tinyness_before = false;
936       static const float_round_style round_style = round_toward_zero;
937     };
939   /// numeric_limits<unsigned long> specialization.
940   template<>
941     struct numeric_limits<unsigned long>
942     {
943       static const bool is_specialized = true;
945       static unsigned long min() throw()
946       { return 0; }
947       static unsigned long max() throw()
948       { return __LONG_MAX__ * 2UL + 1; }
950       static const int digits = __glibcxx_digits (unsigned long);
951       static const int digits10 = __glibcxx_digits10 (unsigned long);
952       static const bool is_signed = false;
953       static const bool is_integer = true;
954       static const bool is_exact = true;
955       static const int radix = 2;
956       static unsigned long epsilon() throw()
957       { return 0; }
958       static unsigned long round_error() throw()
959       { return 0; }
961       static const int min_exponent = 0;
962       static const int min_exponent10 = 0;
963       static const int max_exponent = 0;
964       static const int max_exponent10 = 0;
966       static const bool has_infinity = false;
967       static const bool has_quiet_NaN = false;
968       static const bool has_signaling_NaN = false;
969       static const float_denorm_style has_denorm = denorm_absent;
970       static const bool has_denorm_loss = false;
972       static unsigned long infinity() throw()
973       { return static_cast<unsigned long>(0); }
974       static unsigned long quiet_NaN() throw()
975       { return static_cast<unsigned long>(0); }
976       static unsigned long signaling_NaN() throw()
977       { return static_cast<unsigned long>(0); }
978       static unsigned long denorm_min() throw()
979       { return static_cast<unsigned long>(0); }
981       static const bool is_iec559 = false;
982       static const bool is_bounded = true;
983       static const bool is_modulo = true;
985       static const bool traps = __glibcxx_integral_traps;
986       static const bool tinyness_before = false;
987       static const float_round_style round_style = round_toward_zero;
988     };
990   /// numeric_limits<long long> specialization.
991   template<>
992     struct numeric_limits<long long>
993     {
994       static const bool is_specialized = true;
996       static long long min() throw()
997       { return -__LONG_LONG_MAX__ - 1; }
998       static long long max() throw()
999       { return __LONG_LONG_MAX__; }
1001       static const int digits = __glibcxx_digits (long long);
1002       static const int digits10 = __glibcxx_digits10 (long long);
1003       static const bool is_signed = true;
1004       static const bool is_integer = true;
1005       static const bool is_exact = true;
1006       static const int radix = 2;
1007       static long long epsilon() throw()
1008       { return 0; }
1009       static long long round_error() throw()
1010       { return 0; }
1012       static const int min_exponent = 0;
1013       static const int min_exponent10 = 0;
1014       static const int max_exponent = 0;
1015       static const int max_exponent10 = 0;
1017       static const bool has_infinity = false;
1018       static const bool has_quiet_NaN = false;
1019       static const bool has_signaling_NaN = false;
1020       static const float_denorm_style has_denorm = denorm_absent;
1021       static const bool has_denorm_loss = false;
1023       static long long infinity() throw()
1024       { return static_cast<long long>(0); }
1025       static long long quiet_NaN() throw()
1026       { return static_cast<long long>(0); }
1027       static long long signaling_NaN() throw()
1028       { return static_cast<long long>(0); }
1029       static long long denorm_min() throw()
1030       { return static_cast<long long>(0); }
1032       static const bool is_iec559 = false;
1033       static const bool is_bounded = true;
1034       static const bool is_modulo = true;
1036       static const bool traps = __glibcxx_integral_traps;
1037       static const bool tinyness_before = false;
1038       static const float_round_style round_style = round_toward_zero;
1039     };
1041   /// numeric_limits<unsigned long long> specialization.
1042   template<>
1043     struct numeric_limits<unsigned long long>
1044     {
1045       static const bool is_specialized = true;
1047       static unsigned long long min() throw()
1048       { return 0; }
1049       static unsigned long long max() throw()
1050       { return __LONG_LONG_MAX__ * 2ULL + 1; }
1052       static const int digits = __glibcxx_digits (unsigned long long);
1053       static const int digits10 = __glibcxx_digits10 (unsigned long long);
1054       static const bool is_signed = false;
1055       static const bool is_integer = true;
1056       static const bool is_exact = true;
1057       static const int radix = 2;
1058       static unsigned long long epsilon() throw()
1059       { return 0; }
1060       static unsigned long long round_error() throw()
1061       { return 0; }
1063       static const int min_exponent = 0;
1064       static const int min_exponent10 = 0;
1065       static const int max_exponent = 0;
1066       static const int max_exponent10 = 0;
1068       static const bool has_infinity = false;
1069       static const bool has_quiet_NaN = false;
1070       static const bool has_signaling_NaN = false;
1071       static const float_denorm_style has_denorm = denorm_absent;
1072       static const bool has_denorm_loss = false;
1074       static unsigned long long infinity() throw()
1075       { return static_cast<unsigned long long>(0); }
1076       static unsigned long long quiet_NaN() throw()
1077       { return static_cast<unsigned long long>(0); }
1078       static unsigned long long signaling_NaN() throw()
1079       { return static_cast<unsigned long long>(0); }
1080       static unsigned long long denorm_min() throw()
1081       { return static_cast<unsigned long long>(0); }
1083       static const bool is_iec559 = false;
1084       static const bool is_bounded = true;
1085       static const bool is_modulo = true;
1087       static const bool traps = __glibcxx_integral_traps;
1088       static const bool tinyness_before = false;
1089       static const float_round_style round_style = round_toward_zero;
1090     };
1092   /// numeric_limits<float> specialization.
1093   template<>
1094     struct numeric_limits<float>
1095     {
1096       static const bool is_specialized = true;
1098       static float min() throw()
1099       { return __FLT_MIN__; }
1100       static float max() throw()
1101       { return __FLT_MAX__; }
1103       static const int digits = __FLT_MANT_DIG__;
1104       static const int digits10 = __FLT_DIG__;
1105       static const bool is_signed = true;
1106       static const bool is_integer = false;
1107       static const bool is_exact = false;
1108       static const int radix = __FLT_RADIX__;
1109       static float epsilon() throw()
1110       { return __FLT_EPSILON__; }
1111       static float round_error() throw()
1112       { return 0.5F; }
1114       static const int min_exponent = __FLT_MIN_EXP__;
1115       static const int min_exponent10 = __FLT_MIN_10_EXP__;
1116       static const int max_exponent = __FLT_MAX_EXP__;
1117       static const int max_exponent10 = __FLT_MAX_10_EXP__;
1119       static const bool has_infinity = __FLT_HAS_INFINITY__;
1120       static const bool has_quiet_NaN = __FLT_HAS_QUIET_NAN__;
1121       static const bool has_signaling_NaN = has_quiet_NaN;
1122       static const float_denorm_style has_denorm
1123         = bool(__FLT_HAS_DENORM__) ? denorm_present : denorm_absent;
1124       static const bool has_denorm_loss = __glibcxx_float_has_denorm_loss;
1126       static float infinity() throw()
1127       { return __builtin_huge_valf (); }
1128       static float quiet_NaN() throw()
1129       { return __builtin_nanf (""); }
1130       static float signaling_NaN() throw()
1131       { return __builtin_nansf (""); }
1132       static float denorm_min() throw()
1133       { return __FLT_DENORM_MIN__; }
1135       static const bool is_iec559
1136         = has_infinity && has_quiet_NaN && has_denorm == denorm_present;
1137       static const bool is_bounded = true;
1138       static const bool is_modulo = false;
1140       static const bool traps = __glibcxx_float_traps;
1141       static const bool tinyness_before = __glibcxx_float_tinyness_before;
1142       static const float_round_style round_style = round_to_nearest;
1143     };
1145 #undef __glibcxx_float_has_denorm_loss
1146 #undef __glibcxx_float_traps
1147 #undef __glibcxx_float_tinyness_before
1149   /// numeric_limits<double> specialization.
1150   template<>
1151     struct numeric_limits<double>
1152     {
1153       static const bool is_specialized = true;
1155       static double min() throw()
1156       { return __DBL_MIN__; }
1157       static double max() throw()
1158       { return __DBL_MAX__; }
1160       static const int digits = __DBL_MANT_DIG__;
1161       static const int digits10 = __DBL_DIG__;
1162       static const bool is_signed = true;
1163       static const bool is_integer = false;
1164       static const bool is_exact = false;
1165       static const int radix = __FLT_RADIX__;
1166       static double epsilon() throw()
1167       { return __DBL_EPSILON__; }
1168       static double round_error() throw()
1169       { return 0.5; }
1171       static const int min_exponent = __DBL_MIN_EXP__;
1172       static const int min_exponent10 = __DBL_MIN_10_EXP__;
1173       static const int max_exponent = __DBL_MAX_EXP__;
1174       static const int max_exponent10 = __DBL_MAX_10_EXP__;
1176       static const bool has_infinity = __DBL_HAS_INFINITY__;
1177       static const bool has_quiet_NaN = __DBL_HAS_QUIET_NAN__;
1178       static const bool has_signaling_NaN = has_quiet_NaN;
1179       static const float_denorm_style has_denorm
1180         = bool(__DBL_HAS_DENORM__) ? denorm_present : denorm_absent;
1181       static const bool has_denorm_loss = __glibcxx_double_has_denorm_loss;
1183       static double infinity() throw()
1184       { return __builtin_huge_val(); }
1185       static double quiet_NaN() throw()
1186       { return __builtin_nan (""); }
1187       static double signaling_NaN() throw()
1188       { return __builtin_nans (""); }
1189       static double denorm_min() throw()
1190       { return __DBL_DENORM_MIN__; }
1192       static const bool is_iec559
1193         = has_infinity && has_quiet_NaN && has_denorm == denorm_present;
1194       static const bool is_bounded = true;
1195       static const bool is_modulo = false;
1197       static const bool traps = __glibcxx_double_traps;
1198       static const bool tinyness_before = __glibcxx_double_tinyness_before;
1199       static const float_round_style round_style = round_to_nearest;
1200     };
1202 #undef __glibcxx_double_has_denorm_loss
1203 #undef __glibcxx_double_traps
1204 #undef __glibcxx_double_tinyness_before
1206   /// numeric_limits<long double> specialization.
1207   template<>
1208     struct numeric_limits<long double>
1209     {
1210       static const bool is_specialized = true;
1212       static long double min() throw()
1213       { return __LDBL_MIN__; }
1214       static long double max() throw()
1215       { return __LDBL_MAX__; }
1217       static const int digits = __LDBL_MANT_DIG__;
1218       static const int digits10 = __LDBL_DIG__;
1219       static const bool is_signed = true;
1220       static const bool is_integer = false;
1221       static const bool is_exact = false;
1222       static const int radix = __FLT_RADIX__;
1223       static long double epsilon() throw()
1224       { return __LDBL_EPSILON__; }
1225       static long double round_error() throw()
1226       { return 0.5L; }
1228       static const int min_exponent = __LDBL_MIN_EXP__;
1229       static const int min_exponent10 = __LDBL_MIN_10_EXP__;
1230       static const int max_exponent = __LDBL_MAX_EXP__;
1231       static const int max_exponent10 = __LDBL_MAX_10_EXP__;
1233       static const bool has_infinity = __LDBL_HAS_INFINITY__;
1234       static const bool has_quiet_NaN = __LDBL_HAS_QUIET_NAN__;
1235       static const bool has_signaling_NaN = has_quiet_NaN;
1236       static const float_denorm_style has_denorm
1237         = bool(__LDBL_HAS_DENORM__) ? denorm_present : denorm_absent;
1238       static const bool has_denorm_loss
1239         = __glibcxx_long_double_has_denorm_loss;
1241       static long double infinity() throw()
1242       { return __builtin_huge_vall (); }
1243       static long double quiet_NaN() throw()
1244       { return __builtin_nanl (""); }
1245       static long double signaling_NaN() throw()
1246       { return __builtin_nansl (""); }
1247       static long double denorm_min() throw()
1248       { return __LDBL_DENORM_MIN__; }
1250       static const bool is_iec559
1251         = has_infinity && has_quiet_NaN && has_denorm == denorm_present;
1252       static const bool is_bounded = true;
1253       static const bool is_modulo = false;
1255       static const bool traps = __glibcxx_long_double_traps;
1256       static const bool tinyness_before = __glibcxx_long_double_tinyness_before;
1257       static const float_round_style round_style = round_to_nearest;
1258     };
1260 #undef __glibcxx_long_double_has_denorm_loss
1261 #undef __glibcxx_long_double_traps
1262 #undef __glibcxx_long_double_tinyness_before
1264 _GLIBCXX_END_NAMESPACE
1266 #undef __glibcxx_signed
1267 #undef __glibcxx_min
1268 #undef __glibcxx_max
1269 #undef __glibcxx_digits
1270 #undef __glibcxx_digits10
1272 #endif // _GLIBCXX_NUMERIC_LIMITS