Merge branch 'master' of ssh://crater.dragonflybsd.org/repository/git/dragonfly
[dragonfly.git] / contrib / gcc-3.4 / libstdc++-v3 / include / std / std_limits.h
blob7f96647f95def60008a4f4603eeb9db8fd8a2dce
1 // The template and inlines for the -*- C++ -*- numeric_limits classes.
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.
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.
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, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
19 // USA.
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.
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 /** @file limits
39 * This is a Standard C++ Library header. You should @c #include this header
40 * in your programs, rather than any of the "st[dl]_*.h" implementation files.
43 #ifndef _GLIBCXX_NUMERIC_LIMITS
44 #define _GLIBCXX_NUMERIC_LIMITS 1
46 #pragma GCC system_header
48 #include <bits/c++config.h>
51 // The numeric_limits<> traits document implementation-defined aspects
52 // of fundamental arithmetic data types (integers and floating points).
53 // From Standard C++ point of view, there are 13 such types:
54 // * integers
55 // bool (1)
56 // char, signed char, unsigned char (3)
57 // short, unsigned short (2)
58 // int, unsigned (2)
59 // long, unsigned long (2)
61 // * floating points
62 // float (1)
63 // double (1)
64 // long double (1)
66 // GNU C++ undertstands (where supported by the host C-library)
67 // * integer
68 // long long, unsigned long long (2)
70 // which brings us to 15 fundamental arithmetic data types in GNU C++.
73 // Since a numeric_limits<> is a bit tricky to get right, we rely on
74 // an interface composed of macros which should be defined in config/os
75 // or config/cpu when they differ from the generic (read arbitrary)
76 // definitions given here.
79 // These values can be overridden in the target configuration file.
80 // The default values are appropriate for many 32-bit targets.
82 // GCC only intrinsicly supports modulo integral types. The only remaining
83 // integral exceptional values is division by zero. Only targets that do not
84 // signal division by zero in some "hard to ignore" way should use false.
85 #ifndef __glibcxx_integral_traps
86 # define __glibcxx_integral_traps true
87 #endif
89 // float
92 // Default values. Should be overriden in configuration files if necessary.
94 #ifndef __glibcxx_float_has_denorm_loss
95 # define __glibcxx_float_has_denorm_loss false
96 #endif
97 #ifndef __glibcxx_float_traps
98 # define __glibcxx_float_traps false
99 #endif
100 #ifndef __glibcxx_float_tinyness_before
101 # define __glibcxx_float_tinyness_before false
102 #endif
104 // double
106 // Default values. Should be overriden in configuration files if necessary.
108 #ifndef __glibcxx_double_has_denorm_loss
109 # define __glibcxx_double_has_denorm_loss false
110 #endif
111 #ifndef __glibcxx_double_traps
112 # define __glibcxx_double_traps false
113 #endif
114 #ifndef __glibcxx_double_tinyness_before
115 # define __glibcxx_double_tinyness_before false
116 #endif
118 // long double
120 // Default values. Should be overriden in configuration files if necessary.
122 #ifndef __glibcxx_long_double_has_denorm_loss
123 # define __glibcxx_long_double_has_denorm_loss false
124 #endif
125 #ifndef __glibcxx_long_double_traps
126 # define __glibcxx_long_double_traps false
127 #endif
128 #ifndef __glibcxx_long_double_tinyness_before
129 # define __glibcxx_long_double_tinyness_before false
130 #endif
132 // You should not need to define any macros below this point.
134 #define __glibcxx_signed(T) ((T)(-1) < 0)
136 #define __glibcxx_min(T) \
137 (__glibcxx_signed (T) ? (T)1 << __glibcxx_digits (T) : (T)0)
139 #define __glibcxx_max(T) \
140 (__glibcxx_signed (T) ? ((T)1 << __glibcxx_digits (T)) - 1 : ~(T)0)
142 #define __glibcxx_digits(T) \
143 (sizeof(T) * __CHAR_BIT__ - __glibcxx_signed (T))
145 // The fraction 643/2136 approximates log10(2) to 7 significant digits.
146 #define __glibcxx_digits10(T) \
147 (__glibcxx_digits (T) * 643 / 2136)
150 namespace std
153 * @brief Describes the rounding style for floating-point types.
155 * This is used in the std::numeric_limits class.
157 enum float_round_style
159 round_indeterminate = -1, ///< Self-explanatory.
160 round_toward_zero = 0, ///< Self-explanatory.
161 round_to_nearest = 1, ///< To the nearest representable value.
162 round_toward_infinity = 2, ///< Self-explanatory.
163 round_toward_neg_infinity = 3 ///< Self-explanatory.
167 * @brief Describes the denormalization for floating-point types.
169 * These values represent the presence or absence of a variable number
170 * of exponent bits. This type is used in the std::numeric_limits class.
172 enum float_denorm_style
174 /// Indeterminate at compile time whether denormalized values are allowed.
175 denorm_indeterminate = -1,
176 /// The type does not allow denormalized values.
177 denorm_absent = 0,
178 /// The type allows denormalized values.
179 denorm_present = 1
183 * @brief Part of std::numeric_limits.
185 * The @c static @c const members are usable as integral constant
186 * expressions.
188 * @note This is a seperate class for purposes of efficiency; you
189 * should only access these members as part of an instantiation
190 * of the std::numeric_limits class.
192 struct __numeric_limits_base
194 /** This will be true for all fundamental types (which have
195 specializations), and false for everything else. */
196 static const bool is_specialized = false;
198 /** The number of @c radix digits that be represented without change: for
199 integer types, the number of non-sign bits in the mantissa; for
200 floating types, the number of @c radix digits in the mantissa. */
201 static const int digits = 0;
202 /** The number of base 10 digits that can be represented without change. */
203 static const int digits10 = 0;
204 /** True if the type is signed. */
205 static const bool is_signed = false;
206 /** True if the type is integer.
207 * @if maint
208 * Is this supposed to be "if the type is integral"?
209 * @endif
211 static const bool is_integer = false;
212 /** True if the type uses an exact representation. "All integer types are
213 exact, but not all exact types are integer. For example, rational and
214 fixed-exponent representations are exact but not integer."
215 [18.2.1.2]/15 */
216 static const bool is_exact = false;
217 /** For integer types, specifies the base of the representation. For
218 floating types, specifies the base of the exponent representation. */
219 static const int radix = 0;
221 /** The minimum negative integer such that @c radix raised to the power of
222 (one less than that integer) is a normalized floating point number. */
223 static const int min_exponent = 0;
224 /** The minimum negative integer such that 10 raised to that power is in
225 the range of normalized floating point numbers. */
226 static const int min_exponent10 = 0;
227 /** The maximum positive integer such that @c radix raised to the power of
228 (one less than that integer) is a representable finite floating point
229 number. */
230 static const int max_exponent = 0;
231 /** The maximum positive integer such that 10 raised to that power is in
232 the range of representable finite floating point numbers. */
233 static const int max_exponent10 = 0;
235 /** True if the type has a representation for positive infinity. */
236 static const bool has_infinity = false;
237 /** True if the type has a representation for a quiet (non-signaling)
238 "Not a Number." */
239 static const bool has_quiet_NaN = false;
240 /** True if the type has a representation for a signaling
241 "Not a Number." */
242 static const bool has_signaling_NaN = false;
243 /** See std::float_denorm_style for more information. */
244 static const float_denorm_style has_denorm = denorm_absent;
245 /** "True if loss of accuracy is detected as a denormalization loss,
246 rather than as an inexact result." [18.2.1.2]/42 */
247 static const bool has_denorm_loss = false;
249 /** True if-and-only-if the type adheres to the IEC 559 standard, also
250 known as IEEE 754. (Only makes sense for floating point types.) */
251 static const bool is_iec559 = false;
252 /** "True if the set of values representable by the type is finite. All
253 built-in types are bounded, this member would be false for arbitrary
254 precision types." [18.2.1.2]/54 */
255 static const bool is_bounded = false;
256 /** True if the type is @e modulo, that is, if it is possible to add two
257 positive numbers and have a result that wraps around to a third number
258 that is less. Typically false for floating types, true for unsigned
259 integers, and true for signed integers. */
260 static const bool is_modulo = false;
262 /** True if trapping is implemented for this type. */
263 static const bool traps = false;
264 /** True if tinyness is detected before rounding. (see IEC 559) */
265 static const bool tinyness_before = false;
266 /** See std::float_round_style for more information. This is only
267 meaningful for floating types; integer types will all be
268 round_toward_zero. */
269 static const float_round_style round_style = round_toward_zero;
273 * @brief Properties of fundamental types.
275 * This class allows a program to obtain information about the
276 * representation of a fundamental type on a given platform. For
277 * non-fundamental types, the functions will return 0 and the data
278 * members will all be @c false.
280 * @if maint
281 * _GLIBCXX_RESOLVE_LIB_DEFECTS: DRs 201 and 184 (hi Gaby!) are
282 * noted, but not incorporated in this documented (yet).
283 * @endif
285 template<typename _Tp>
286 struct numeric_limits : public __numeric_limits_base
288 /** The minimum finite value, or for floating types with
289 denormalization, the minimum positive normalized value. */
290 static _Tp min() throw() { return static_cast<_Tp>(0); }
291 /** The maximum finite value. */
292 static _Tp max() throw() { return static_cast<_Tp>(0); }
293 /** The @e machine @e epsilon: the difference between 1 and the least
294 value greater than 1 that is representable. */
295 static _Tp epsilon() throw() { return static_cast<_Tp>(0); }
296 /** The maximum rounding error measurement (see LIA-1). */
297 static _Tp round_error() throw() { return static_cast<_Tp>(0); }
298 /** The representation of positive infinity, if @c has_infinity. */
299 static _Tp infinity() throw() { return static_cast<_Tp>(0); }
300 /** The representation of a quiet "Not a Number," if @c has_quiet_NaN. */
301 static _Tp quiet_NaN() throw() { return static_cast<_Tp>(0); }
302 /** The representation of a signaling "Not a Number," if
303 @c has_signaling_NaN. */
304 static _Tp signaling_NaN() throw() { return static_cast<_Tp>(0); }
305 /** The minimum positive denormalized value. For types where
306 @c has_denorm is false, this is the minimum positive normalized
307 value. */
308 static _Tp denorm_min() throw() { return static_cast<_Tp>(0); }
311 // Now there follow 15 explicit specializations. Yes, 15. Make sure
312 // you get the count right.
313 template<>
314 struct numeric_limits<bool>
316 static const bool is_specialized = true;
318 static bool min() throw()
319 { return false; }
320 static bool max() throw()
321 { return true; }
323 static const int digits = 1;
324 static const int digits10 = 0;
325 static const bool is_signed = false;
326 static const bool is_integer = true;
327 static const bool is_exact = true;
328 static const int radix = 2;
329 static bool epsilon() throw()
330 { return false; }
331 static bool round_error() throw()
332 { return false; }
334 static const int min_exponent = 0;
335 static const int min_exponent10 = 0;
336 static const int max_exponent = 0;
337 static const int max_exponent10 = 0;
339 static const bool has_infinity = false;
340 static const bool has_quiet_NaN = false;
341 static const bool has_signaling_NaN = false;
342 static const float_denorm_style has_denorm = denorm_absent;
343 static const bool has_denorm_loss = false;
345 static bool infinity() throw()
346 { return false; }
347 static bool quiet_NaN() throw()
348 { return false; }
349 static bool signaling_NaN() throw()
350 { return false; }
351 static bool denorm_min() throw()
352 { return false; }
354 static const bool is_iec559 = false;
355 static const bool is_bounded = true;
356 static const bool is_modulo = false;
358 // It is not clear what it means for a boolean type to trap.
359 // This is a DR on the LWG issue list. Here, I use integer
360 // promotion semantics.
361 static const bool traps = __glibcxx_integral_traps;
362 static const bool tinyness_before = false;
363 static const float_round_style round_style = round_toward_zero;
366 template<>
367 struct numeric_limits<char>
369 static const bool is_specialized = true;
371 static char min() throw()
372 { return __glibcxx_min(char); }
373 static char max() throw()
374 { return __glibcxx_max(char); }
376 static const int digits = __glibcxx_digits (char);
377 static const int digits10 = __glibcxx_digits10 (char);
378 static const bool is_signed = __glibcxx_signed (char);
379 static const bool is_integer = true;
380 static const bool is_exact = true;
381 static const int radix = 2;
382 static char epsilon() throw()
383 { return 0; }
384 static char round_error() throw()
385 { return 0; }
387 static const int min_exponent = 0;
388 static const int min_exponent10 = 0;
389 static const int max_exponent = 0;
390 static const int max_exponent10 = 0;
392 static const bool has_infinity = false;
393 static const bool has_quiet_NaN = false;
394 static const bool has_signaling_NaN = false;
395 static const float_denorm_style has_denorm = denorm_absent;
396 static const bool has_denorm_loss = false;
398 static char infinity() throw()
399 { return char(); }
400 static char quiet_NaN() throw()
401 { return char(); }
402 static char signaling_NaN() throw()
403 { return char(); }
404 static char denorm_min() throw()
405 { return static_cast<char>(0); }
407 static const bool is_iec559 = false;
408 static const bool is_bounded = true;
409 static const bool is_modulo = true;
411 static const bool traps = __glibcxx_integral_traps;
412 static const bool tinyness_before = false;
413 static const float_round_style round_style = round_toward_zero;
416 template<>
417 struct numeric_limits<signed char>
419 static const bool is_specialized = true;
421 static signed char min() throw()
422 { return -__SCHAR_MAX__ - 1; }
423 static signed char max() throw()
424 { return __SCHAR_MAX__; }
426 static const int digits = __glibcxx_digits (signed char);
427 static const int digits10 = __glibcxx_digits10 (signed char);
428 static const bool is_signed = true;
429 static const bool is_integer = true;
430 static const bool is_exact = true;
431 static const int radix = 2;
432 static signed char epsilon() throw()
433 { return 0; }
434 static signed char round_error() throw()
435 { return 0; }
437 static const int min_exponent = 0;
438 static const int min_exponent10 = 0;
439 static const int max_exponent = 0;
440 static const int max_exponent10 = 0;
442 static const bool has_infinity = false;
443 static const bool has_quiet_NaN = false;
444 static const bool has_signaling_NaN = false;
445 static const float_denorm_style has_denorm = denorm_absent;
446 static const bool has_denorm_loss = false;
448 static signed char infinity() throw()
449 { return static_cast<signed char>(0); }
450 static signed char quiet_NaN() throw()
451 { return static_cast<signed char>(0); }
452 static signed char signaling_NaN() throw()
453 { return static_cast<signed char>(0); }
454 static signed char denorm_min() throw()
455 { return static_cast<signed char>(0); }
457 static const bool is_iec559 = false;
458 static const bool is_bounded = true;
459 static const bool is_modulo = true;
461 static const bool traps = __glibcxx_integral_traps;
462 static const bool tinyness_before = false;
463 static const float_round_style round_style = round_toward_zero;
466 template<>
467 struct numeric_limits<unsigned char>
469 static const bool is_specialized = true;
471 static unsigned char min() throw()
472 { return 0; }
473 static unsigned char max() throw()
474 { return __SCHAR_MAX__ * 2U + 1; }
476 static const int digits = __glibcxx_digits (unsigned char);
477 static const int digits10 = __glibcxx_digits10 (unsigned char);
478 static const bool is_signed = false;
479 static const bool is_integer = true;
480 static const bool is_exact = true;
481 static const int radix = 2;
482 static unsigned char epsilon() throw()
483 { return 0; }
484 static unsigned char round_error() throw()
485 { return 0; }
487 static const int min_exponent = 0;
488 static const int min_exponent10 = 0;
489 static const int max_exponent = 0;
490 static const int max_exponent10 = 0;
492 static const bool has_infinity = false;
493 static const bool has_quiet_NaN = false;
494 static const bool has_signaling_NaN = false;
495 static const float_denorm_style has_denorm = denorm_absent;
496 static const bool has_denorm_loss = false;
498 static unsigned char infinity() throw()
499 { return static_cast<unsigned char>(0); }
500 static unsigned char quiet_NaN() throw()
501 { return static_cast<unsigned char>(0); }
502 static unsigned char signaling_NaN() throw()
503 { return static_cast<unsigned char>(0); }
504 static unsigned char denorm_min() throw()
505 { return static_cast<unsigned char>(0); }
507 static const bool is_iec559 = false;
508 static const bool is_bounded = true;
509 static const bool is_modulo = true;
511 static const bool traps = __glibcxx_integral_traps;
512 static const bool tinyness_before = false;
513 static const float_round_style round_style = round_toward_zero;
516 template<>
517 struct numeric_limits<wchar_t>
519 static const bool is_specialized = true;
521 static wchar_t min() throw()
522 { return __glibcxx_min (wchar_t); }
523 static wchar_t max() throw()
524 { return __glibcxx_max (wchar_t); }
526 static const int digits = __glibcxx_digits (wchar_t);
527 static const int digits10 = __glibcxx_digits10 (wchar_t);
528 static const bool is_signed = __glibcxx_signed (wchar_t);
529 static const bool is_integer = true;
530 static const bool is_exact = true;
531 static const int radix = 2;
532 static wchar_t epsilon() throw()
533 { return 0; }
534 static wchar_t round_error() throw()
535 { return 0; }
537 static const int min_exponent = 0;
538 static const int min_exponent10 = 0;
539 static const int max_exponent = 0;
540 static const int max_exponent10 = 0;
542 static const bool has_infinity = false;
543 static const bool has_quiet_NaN = false;
544 static const bool has_signaling_NaN = false;
545 static const float_denorm_style has_denorm = denorm_absent;
546 static const bool has_denorm_loss = false;
548 static wchar_t infinity() throw()
549 { return wchar_t(); }
550 static wchar_t quiet_NaN() throw()
551 { return wchar_t(); }
552 static wchar_t signaling_NaN() throw()
553 { return wchar_t(); }
554 static wchar_t denorm_min() throw()
555 { return wchar_t(); }
557 static const bool is_iec559 = false;
558 static const bool is_bounded = true;
559 static const bool is_modulo = true;
561 static const bool traps = __glibcxx_integral_traps;
562 static const bool tinyness_before = false;
563 static const float_round_style round_style = round_toward_zero;
566 template<>
567 struct numeric_limits<short>
569 static const bool is_specialized = true;
571 static short min() throw()
572 { return -__SHRT_MAX__ - 1; }
573 static short max() throw()
574 { return __SHRT_MAX__; }
576 static const int digits = __glibcxx_digits (short);
577 static const int digits10 = __glibcxx_digits10 (short);
578 static const bool is_signed = true;
579 static const bool is_integer = true;
580 static const bool is_exact = true;
581 static const int radix = 2;
582 static short epsilon() throw()
583 { return 0; }
584 static short round_error() throw()
585 { return 0; }
587 static const int min_exponent = 0;
588 static const int min_exponent10 = 0;
589 static const int max_exponent = 0;
590 static const int max_exponent10 = 0;
592 static const bool has_infinity = false;
593 static const bool has_quiet_NaN = false;
594 static const bool has_signaling_NaN = false;
595 static const float_denorm_style has_denorm = denorm_absent;
596 static const bool has_denorm_loss = false;
598 static short infinity() throw()
599 { return short(); }
600 static short quiet_NaN() throw()
601 { return short(); }
602 static short signaling_NaN() throw()
603 { return short(); }
604 static short denorm_min() throw()
605 { return short(); }
607 static const bool is_iec559 = false;
608 static const bool is_bounded = true;
609 static const bool is_modulo = true;
611 static const bool traps = __glibcxx_integral_traps;
612 static const bool tinyness_before = false;
613 static const float_round_style round_style = round_toward_zero;
616 template<>
617 struct numeric_limits<unsigned short>
619 static const bool is_specialized = true;
621 static unsigned short min() throw()
622 { return 0; }
623 static unsigned short max() throw()
624 { return __SHRT_MAX__ * 2U + 1; }
626 static const int digits = __glibcxx_digits (unsigned short);
627 static const int digits10 = __glibcxx_digits10 (unsigned short);
628 static const bool is_signed = false;
629 static const bool is_integer = true;
630 static const bool is_exact = true;
631 static const int radix = 2;
632 static unsigned short epsilon() throw()
633 { return 0; }
634 static unsigned short round_error() throw()
635 { return 0; }
637 static const int min_exponent = 0;
638 static const int min_exponent10 = 0;
639 static const int max_exponent = 0;
640 static const int max_exponent10 = 0;
642 static const bool has_infinity = false;
643 static const bool has_quiet_NaN = false;
644 static const bool has_signaling_NaN = false;
645 static const float_denorm_style has_denorm = denorm_absent;
646 static const bool has_denorm_loss = false;
648 static unsigned short infinity() throw()
649 { return static_cast<unsigned short>(0); }
650 static unsigned short quiet_NaN() throw()
651 { return static_cast<unsigned short>(0); }
652 static unsigned short signaling_NaN() throw()
653 { return static_cast<unsigned short>(0); }
654 static unsigned short denorm_min() throw()
655 { return static_cast<unsigned short>(0); }
657 static const bool is_iec559 = false;
658 static const bool is_bounded = true;
659 static const bool is_modulo = true;
661 static const bool traps = __glibcxx_integral_traps;
662 static const bool tinyness_before = false;
663 static const float_round_style round_style = round_toward_zero;
666 template<>
667 struct numeric_limits<int>
669 static const bool is_specialized = true;
671 static int min() throw()
672 { return -__INT_MAX__ - 1; }
673 static int max() throw()
674 { return __INT_MAX__; }
676 static const int digits = __glibcxx_digits (int);
677 static const int digits10 = __glibcxx_digits10 (int);
678 static const bool is_signed = true;
679 static const bool is_integer = true;
680 static const bool is_exact = true;
681 static const int radix = 2;
682 static int epsilon() throw()
683 { return 0; }
684 static int round_error() throw()
685 { return 0; }
687 static const int min_exponent = 0;
688 static const int min_exponent10 = 0;
689 static const int max_exponent = 0;
690 static const int max_exponent10 = 0;
692 static const bool has_infinity = false;
693 static const bool has_quiet_NaN = false;
694 static const bool has_signaling_NaN = false;
695 static const float_denorm_style has_denorm = denorm_absent;
696 static const bool has_denorm_loss = false;
698 static int infinity() throw()
699 { return static_cast<int>(0); }
700 static int quiet_NaN() throw()
701 { return static_cast<int>(0); }
702 static int signaling_NaN() throw()
703 { return static_cast<int>(0); }
704 static int denorm_min() throw()
705 { return static_cast<int>(0); }
707 static const bool is_iec559 = false;
708 static const bool is_bounded = true;
709 static const bool is_modulo = true;
711 static const bool traps = __glibcxx_integral_traps;
712 static const bool tinyness_before = false;
713 static const float_round_style round_style = round_toward_zero;
716 template<>
717 struct numeric_limits<unsigned int>
719 static const bool is_specialized = true;
721 static unsigned int min() throw()
722 { return 0; }
723 static unsigned int max() throw()
724 { return __INT_MAX__ * 2U + 1; }
726 static const int digits = __glibcxx_digits (unsigned int);
727 static const int digits10 = __glibcxx_digits10 (unsigned int);
728 static const bool is_signed = false;
729 static const bool is_integer = true;
730 static const bool is_exact = true;
731 static const int radix = 2;
732 static unsigned int epsilon() throw()
733 { return 0; }
734 static unsigned int round_error() throw()
735 { return 0; }
737 static const int min_exponent = 0;
738 static const int min_exponent10 = 0;
739 static const int max_exponent = 0;
740 static const int max_exponent10 = 0;
742 static const bool has_infinity = false;
743 static const bool has_quiet_NaN = false;
744 static const bool has_signaling_NaN = false;
745 static const float_denorm_style has_denorm = denorm_absent;
746 static const bool has_denorm_loss = false;
748 static unsigned int infinity() throw()
749 { return static_cast<unsigned int>(0); }
750 static unsigned int quiet_NaN() throw()
751 { return static_cast<unsigned int>(0); }
752 static unsigned int signaling_NaN() throw()
753 { return static_cast<unsigned int>(0); }
754 static unsigned int denorm_min() throw()
755 { return static_cast<unsigned int>(0); }
757 static const bool is_iec559 = false;
758 static const bool is_bounded = true;
759 static const bool is_modulo = true;
761 static const bool traps = __glibcxx_integral_traps;
762 static const bool tinyness_before = false;
763 static const float_round_style round_style = round_toward_zero;
766 template<>
767 struct numeric_limits<long>
769 static const bool is_specialized = true;
771 static long min() throw()
772 { return -__LONG_MAX__ - 1; }
773 static long max() throw()
774 { return __LONG_MAX__; }
776 static const int digits = __glibcxx_digits (long);
777 static const int digits10 = __glibcxx_digits10 (long);
778 static const bool is_signed = true;
779 static const bool is_integer = true;
780 static const bool is_exact = true;
781 static const int radix = 2;
782 static long epsilon() throw()
783 { return 0; }
784 static long round_error() throw()
785 { return 0; }
787 static const int min_exponent = 0;
788 static const int min_exponent10 = 0;
789 static const int max_exponent = 0;
790 static const int max_exponent10 = 0;
792 static const bool has_infinity = false;
793 static const bool has_quiet_NaN = false;
794 static const bool has_signaling_NaN = false;
795 static const float_denorm_style has_denorm = denorm_absent;
796 static const bool has_denorm_loss = false;
798 static long infinity() throw()
799 { return static_cast<long>(0); }
800 static long quiet_NaN() throw()
801 { return static_cast<long>(0); }
802 static long signaling_NaN() throw()
803 { return static_cast<long>(0); }
804 static long denorm_min() throw()
805 { return static_cast<long>(0); }
807 static const bool is_iec559 = false;
808 static const bool is_bounded = true;
809 static const bool is_modulo = true;
811 static const bool traps = __glibcxx_integral_traps;
812 static const bool tinyness_before = false;
813 static const float_round_style round_style = round_toward_zero;
816 template<>
817 struct numeric_limits<unsigned long>
819 static const bool is_specialized = true;
821 static unsigned long min() throw()
822 { return 0; }
823 static unsigned long max() throw()
824 { return __LONG_MAX__ * 2UL + 1; }
826 static const int digits = __glibcxx_digits (unsigned long);
827 static const int digits10 = __glibcxx_digits10 (unsigned long);
828 static const bool is_signed = false;
829 static const bool is_integer = true;
830 static const bool is_exact = true;
831 static const int radix = 2;
832 static unsigned long epsilon() throw()
833 { return 0; }
834 static unsigned long round_error() throw()
835 { return 0; }
837 static const int min_exponent = 0;
838 static const int min_exponent10 = 0;
839 static const int max_exponent = 0;
840 static const int max_exponent10 = 0;
842 static const bool has_infinity = false;
843 static const bool has_quiet_NaN = false;
844 static const bool has_signaling_NaN = false;
845 static const float_denorm_style has_denorm = denorm_absent;
846 static const bool has_denorm_loss = false;
848 static unsigned long infinity() throw()
849 { return static_cast<unsigned long>(0); }
850 static unsigned long quiet_NaN() throw()
851 { return static_cast<unsigned long>(0); }
852 static unsigned long signaling_NaN() throw()
853 { return static_cast<unsigned long>(0); }
854 static unsigned long denorm_min() throw()
855 { return static_cast<unsigned long>(0); }
857 static const bool is_iec559 = false;
858 static const bool is_bounded = true;
859 static const bool is_modulo = true;
861 static const bool traps = __glibcxx_integral_traps;
862 static const bool tinyness_before = false;
863 static const float_round_style round_style = round_toward_zero;
866 template<>
867 struct numeric_limits<long long>
869 static const bool is_specialized = true;
871 static long long min() throw()
872 { return -__LONG_LONG_MAX__ - 1; }
873 static long long max() throw()
874 { return __LONG_LONG_MAX__; }
876 static const int digits = __glibcxx_digits (long long);
877 static const int digits10 = __glibcxx_digits10 (long long);
878 static const bool is_signed = true;
879 static const bool is_integer = true;
880 static const bool is_exact = true;
881 static const int radix = 2;
882 static long long epsilon() throw()
883 { return 0; }
884 static long long round_error() throw()
885 { return 0; }
887 static const int min_exponent = 0;
888 static const int min_exponent10 = 0;
889 static const int max_exponent = 0;
890 static const int max_exponent10 = 0;
892 static const bool has_infinity = false;
893 static const bool has_quiet_NaN = false;
894 static const bool has_signaling_NaN = false;
895 static const float_denorm_style has_denorm = denorm_absent;
896 static const bool has_denorm_loss = false;
898 static long long infinity() throw()
899 { return static_cast<long long>(0); }
900 static long long quiet_NaN() throw()
901 { return static_cast<long long>(0); }
902 static long long signaling_NaN() throw()
903 { return static_cast<long long>(0); }
904 static long long denorm_min() throw()
905 { return static_cast<long long>(0); }
907 static const bool is_iec559 = false;
908 static const bool is_bounded = true;
909 static const bool is_modulo = true;
911 static const bool traps = __glibcxx_integral_traps;
912 static const bool tinyness_before = false;
913 static const float_round_style round_style = round_toward_zero;
916 template<>
917 struct numeric_limits<unsigned long long>
919 static const bool is_specialized = true;
921 static unsigned long long min() throw()
922 { return 0; }
923 static unsigned long long max() throw()
924 { return __LONG_LONG_MAX__ * 2ULL + 1; }
926 static const int digits = __glibcxx_digits (unsigned long long);
927 static const int digits10 = __glibcxx_digits10 (unsigned long long);
928 static const bool is_signed = false;
929 static const bool is_integer = true;
930 static const bool is_exact = true;
931 static const int radix = 2;
932 static unsigned long long epsilon() throw()
933 { return 0; }
934 static unsigned long long round_error() throw()
935 { return 0; }
937 static const int min_exponent = 0;
938 static const int min_exponent10 = 0;
939 static const int max_exponent = 0;
940 static const int max_exponent10 = 0;
942 static const bool has_infinity = false;
943 static const bool has_quiet_NaN = false;
944 static const bool has_signaling_NaN = false;
945 static const float_denorm_style has_denorm = denorm_absent;
946 static const bool has_denorm_loss = false;
948 static unsigned long long infinity() throw()
949 { return static_cast<unsigned long long>(0); }
950 static unsigned long long quiet_NaN() throw()
951 { return static_cast<unsigned long long>(0); }
952 static unsigned long long signaling_NaN() throw()
953 { return static_cast<unsigned long long>(0); }
954 static unsigned long long denorm_min() throw()
955 { return static_cast<unsigned long long>(0); }
957 static const bool is_iec559 = false;
958 static const bool is_bounded = true;
959 static const bool is_modulo = true;
961 static const bool traps = __glibcxx_integral_traps;
962 static const bool tinyness_before = false;
963 static const float_round_style round_style = round_toward_zero;
966 template<>
967 struct numeric_limits<float>
969 static const bool is_specialized = true;
971 static float min() throw()
972 { return __FLT_MIN__; }
973 static float max() throw()
974 { return __FLT_MAX__; }
976 static const int digits = __FLT_MANT_DIG__;
977 static const int digits10 = __FLT_DIG__;
978 static const bool is_signed = true;
979 static const bool is_integer = false;
980 static const bool is_exact = false;
981 static const int radix = __FLT_RADIX__;
982 static float epsilon() throw()
983 { return __FLT_EPSILON__; }
984 static float round_error() throw()
985 { return 0.5F; }
987 static const int min_exponent = __FLT_MIN_EXP__;
988 static const int min_exponent10 = __FLT_MIN_10_EXP__;
989 static const int max_exponent = __FLT_MAX_EXP__;
990 static const int max_exponent10 = __FLT_MAX_10_EXP__;
992 static const bool has_infinity = __FLT_HAS_INFINITY__;
993 static const bool has_quiet_NaN = __FLT_HAS_QUIET_NAN__;
994 static const bool has_signaling_NaN = has_quiet_NaN;
995 static const float_denorm_style has_denorm
996 = __FLT_DENORM_MIN__ ? denorm_present : denorm_absent;
997 static const bool has_denorm_loss = __glibcxx_float_has_denorm_loss;
999 static float infinity() throw()
1000 { return __builtin_huge_valf (); }
1001 static float quiet_NaN() throw()
1002 { return __builtin_nanf (""); }
1003 static float signaling_NaN() throw()
1004 { return __builtin_nansf (""); }
1005 static float denorm_min() throw()
1006 { return __FLT_DENORM_MIN__; }
1008 static const bool is_iec559
1009 = has_infinity && has_quiet_NaN && has_denorm == denorm_present;
1010 static const bool is_bounded = true;
1011 static const bool is_modulo = false;
1013 static const bool traps = __glibcxx_float_traps;
1014 static const bool tinyness_before = __glibcxx_float_tinyness_before;
1015 static const float_round_style round_style = round_to_nearest;
1018 #undef __glibcxx_float_has_denorm_loss
1019 #undef __glibcxx_float_traps
1020 #undef __glibcxx_float_tinyness_before
1022 template<>
1023 struct numeric_limits<double>
1025 static const bool is_specialized = true;
1027 static double min() throw()
1028 { return __DBL_MIN__; }
1029 static double max() throw()
1030 { return __DBL_MAX__; }
1032 static const int digits = __DBL_MANT_DIG__;
1033 static const int digits10 = __DBL_DIG__;
1034 static const bool is_signed = true;
1035 static const bool is_integer = false;
1036 static const bool is_exact = false;
1037 static const int radix = __FLT_RADIX__;
1038 static double epsilon() throw()
1039 { return __DBL_EPSILON__; }
1040 static double round_error() throw()
1041 { return 0.5; }
1043 static const int min_exponent = __DBL_MIN_EXP__;
1044 static const int min_exponent10 = __DBL_MIN_10_EXP__;
1045 static const int max_exponent = __DBL_MAX_EXP__;
1046 static const int max_exponent10 = __DBL_MAX_10_EXP__;
1048 static const bool has_infinity = __DBL_HAS_INFINITY__;
1049 static const bool has_quiet_NaN = __DBL_HAS_QUIET_NAN__;
1050 static const bool has_signaling_NaN = has_quiet_NaN;
1051 static const float_denorm_style has_denorm
1052 = __DBL_DENORM_MIN__ ? denorm_present : denorm_absent;
1053 static const bool has_denorm_loss = __glibcxx_double_has_denorm_loss;
1055 static double infinity() throw()
1056 { return __builtin_huge_val(); }
1057 static double quiet_NaN() throw()
1058 { return __builtin_nan (""); }
1059 static double signaling_NaN() throw()
1060 { return __builtin_nans (""); }
1061 static double denorm_min() throw()
1062 { return __DBL_DENORM_MIN__; }
1064 static const bool is_iec559
1065 = has_infinity && has_quiet_NaN && has_denorm == denorm_present;
1066 static const bool is_bounded = true;
1067 static const bool is_modulo = false;
1069 static const bool traps = __glibcxx_double_traps;
1070 static const bool tinyness_before = __glibcxx_double_tinyness_before;
1071 static const float_round_style round_style = round_to_nearest;
1074 #undef __glibcxx_double_has_denorm_loss
1075 #undef __glibcxx_double_traps
1076 #undef __glibcxx_double_tinyness_before
1078 template<>
1079 struct numeric_limits<long double>
1081 static const bool is_specialized = true;
1083 static long double min() throw()
1084 { return __LDBL_MIN__; }
1085 static long double max() throw()
1086 { return __LDBL_MAX__; }
1088 static const int digits = __LDBL_MANT_DIG__;
1089 static const int digits10 = __LDBL_DIG__;
1090 static const bool is_signed = true;
1091 static const bool is_integer = false;
1092 static const bool is_exact = false;
1093 static const int radix = __FLT_RADIX__;
1094 static long double epsilon() throw()
1095 { return __LDBL_EPSILON__; }
1096 static long double round_error() throw()
1097 { return 0.5L; }
1099 static const int min_exponent = __LDBL_MIN_EXP__;
1100 static const int min_exponent10 = __LDBL_MIN_10_EXP__;
1101 static const int max_exponent = __LDBL_MAX_EXP__;
1102 static const int max_exponent10 = __LDBL_MAX_10_EXP__;
1104 static const bool has_infinity = __LDBL_HAS_INFINITY__;
1105 static const bool has_quiet_NaN = __LDBL_HAS_QUIET_NAN__;
1106 static const bool has_signaling_NaN = has_quiet_NaN;
1107 static const float_denorm_style has_denorm
1108 = __LDBL_DENORM_MIN__ ? denorm_present : denorm_absent;
1109 static const bool has_denorm_loss
1110 = __glibcxx_long_double_has_denorm_loss;
1112 static long double infinity() throw()
1113 { return __builtin_huge_vall (); }
1114 static long double quiet_NaN() throw()
1115 { return __builtin_nanl (""); }
1116 static long double signaling_NaN() throw()
1117 { return __builtin_nansl (""); }
1118 static long double denorm_min() throw()
1119 { return __LDBL_DENORM_MIN__; }
1121 static const bool is_iec559
1122 = has_infinity && has_quiet_NaN && has_denorm == denorm_present;
1123 static const bool is_bounded = true;
1124 static const bool is_modulo = false;
1126 static const bool traps = __glibcxx_long_double_traps;
1127 static const bool tinyness_before = __glibcxx_long_double_tinyness_before;
1128 static const float_round_style round_style = round_to_nearest;
1131 #undef __glibcxx_long_double_has_denorm_loss
1132 #undef __glibcxx_long_double_traps
1133 #undef __glibcxx_long_double_tinyness_before
1135 } // namespace std
1137 #undef __glibcxx_signed
1138 #undef __glibcxx_min
1139 #undef __glibcxx_max
1140 #undef __glibcxx_digits
1141 #undef __glibcxx_digits10
1143 #endif // _GLIBCXX_NUMERIC_LIMITS