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