1 : // The template and inlines for the numeric_limits classes. -*- C++ -*-
2 :
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.
11 :
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.
16 :
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.
20 :
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/>.
25 :
26 : /** @file limits
27 : * This is a Standard C++ Library header.
28 : */
29 :
30 : // Note: this is not a conforming implementation.
31 : // Written by Gabriel Dos Reis <gdr@codesourcery.com>
32 :
33 : //
34 : // ISO 14882:1998
35 : // 18.2.1
36 : //
37 :
38 : #ifndef _GLIBCXX_NUMERIC_LIMITS
39 : #define _GLIBCXX_NUMERIC_LIMITS 1
40 :
41 : #pragma GCC system_header
42 :
43 : #include <bits/c++config.h>
44 :
45 : //
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)
55 : //
56 : // * floating points
57 : // float (1)
58 : // double (1)
59 : // long double (1)
60 : //
61 : // GNU C++ understands (where supported by the host C-library)
62 : // * integer
63 : // long long, unsigned long long (2)
64 : //
65 : // which brings us to 16 fundamental arithmetic data types in GNU C++.
66 : //
67 : //
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.
72 : //
73 :
74 : // These values can be overridden in the target configuration file.
75 : // The default values are appropriate for many 32-bit targets.
76 :
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
83 :
84 : // float
85 : //
86 :
87 : // Default values. Should be overridden in configuration files if necessary.
88 :
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
98 :
99 : // double
100 :
101 : // Default values. Should be overridden in configuration files if necessary.
102 :
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
112 :
113 : // long double
114 :
115 : // Default values. Should be overridden in configuration files if necessary.
116 :
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
126 :
127 : // You should not need to define any macros below this point.
128 :
129 : #define __glibcxx_signed(T) ((T)(-1) < 0)
130 :
131 : #define __glibcxx_min(T) \
132 : (__glibcxx_signed (T) ? (T)1 << __glibcxx_digits (T) : (T)0)
133 :
134 : #define __glibcxx_max(T) \
135 : (__glibcxx_signed (T) ? \
136 : (((((T)1 << (__glibcxx_digits (T) - 1)) - 1) << 1) + 1) : ~(T)0)
137 :
138 : #define __glibcxx_digits(T) \
139 : (sizeof(T) * __CHAR_BIT__ - __glibcxx_signed (T))
140 :
141 : // The fraction 643/2136 approximates log10(2) to 7 significant digits.
142 : #define __glibcxx_digits10(T) \
143 : (__glibcxx_digits (T) * 643 / 2136)
144 :
145 : #define __glibcxx_max_digits10(T) \
146 : (2 + (T) * 643 / 2136)
147 :
148 : _GLIBCXX_BEGIN_NAMESPACE(std)
149 :
150 : /**
151 : * @brief Describes the rounding style for floating-point types.
152 : *
153 : * This is used in the std::numeric_limits class.
154 : */
155 : enum float_round_style
156 : {
157 : round_indeterminate = -1, ///< Self-explanatory.
158 : round_toward_zero = 0, ///< Self-explanatory.
159 : round_to_nearest = 1, ///< To the nearest representable value.
160 : round_toward_infinity = 2, ///< Self-explanatory.
161 : round_toward_neg_infinity = 3 ///< Self-explanatory.
162 : };
163 :
164 : /**
165 : * @brief Describes the denormalization for floating-point types.
166 : *
167 : * These values represent the presence or absence of a variable number
168 : * of exponent bits. This type is used in the std::numeric_limits class.
169 : */
170 : enum float_denorm_style
171 : {
172 : /// Indeterminate at compile time whether denormalized values are allowed.
173 : denorm_indeterminate = -1,
174 : /// The type does not allow denormalized values.
175 : denorm_absent = 0,
176 : /// The type allows denormalized values.
177 : denorm_present = 1
178 : };
179 :
180 : /**
181 : * @brief Part of std::numeric_limits.
182 : *
183 : * The @c static @c const members are usable as integral constant
184 : * expressions.
185 : *
186 : * @note This is a separate class for purposes of efficiency; you
187 : * should only access these members as part of an instantiation
188 : * of the std::numeric_limits class.
189 : */
190 : struct __numeric_limits_base
191 : {
192 : /** This will be true for all fundamental types (which have
193 : specializations), and false for everything else. */
194 : static const bool is_specialized = false;
195 :
196 : /** The number of @c radix digits that be represented without change: for
197 : integer types, the number of non-sign bits in the mantissa; for
198 : floating types, the number of @c radix digits in the mantissa. */
199 : static const int digits = 0;
200 : /** The number of base 10 digits that can be represented without change. */
201 : static const int digits10 = 0;
202 : #ifdef __GXX_EXPERIMENTAL_CXX0X__
203 : /** The number of base 10 digits required to ensure that values which
204 : differ are always differentiated. */
205 : static const int max_digits10 = 0;
206 : #endif
207 : /** True if the type is signed. */
208 : static const bool is_signed = false;
209 : /** True if the type is integer.
210 : * Is this supposed to be <em>if the type is integral?</em> */
211 : static const bool is_integer = false;
212 : /** True if the type uses an exact representation. <em>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.</em>
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;
220 :
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;
234 :
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 : <em>Not a Number</em>. */
239 : static const bool has_quiet_NaN = false;
240 : /** True if the type has a representation for a signaling
241 : <em>Not a Number</em>. */
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 : /** <em>True if loss of accuracy is detected as a denormalization loss,
246 : rather than as an inexact result.</em> [18.2.1.2]/42 */
247 : static const bool has_denorm_loss = false;
248 :
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 : /** <em>True if the set of values representable by the type is
253 : finite. All built-in types are bounded, this member would be
254 : false for arbitrary precision types.</em> [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;
261 :
262 : /** True if trapping is implemented for this type. */
263 : static const bool traps = false;
264 : /** True if tininess 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;
270 : };
271 :
272 : /**
273 : * @brief Properties of fundamental types.
274 : *
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.
279 : *
280 : * _GLIBCXX_RESOLVE_LIB_DEFECTS: DRs 201 and 184 (hi Gaby!) are
281 : * noted, but not incorporated in this documented (yet).
282 : */
283 : template<typename _Tp>
284 : struct numeric_limits : public __numeric_limits_base
285 : {
286 : /** The minimum finite value, or for floating types with
287 : denormalization, the minimum positive normalized value. */
288 : static _Tp min() throw() { return static_cast<_Tp>(0); }
289 : /** The maximum finite value. */
290 : static _Tp max() throw() { return static_cast<_Tp>(0); }
291 : #ifdef __GXX_EXPERIMENTAL_CXX0X__
292 : /** A finite value x such that there is no other finite value y
293 : * where y < x. */
294 : static _Tp lowest() throw() { return static_cast<_Tp>(0); }
295 : #endif
296 : /** The @e machine @e epsilon: the difference between 1 and the least
297 : value greater than 1 that is representable. */
298 : static _Tp epsilon() throw() { return static_cast<_Tp>(0); }
299 : /** The maximum rounding error measurement (see LIA-1). */
300 : static _Tp round_error() throw() { return static_cast<_Tp>(0); }
301 : /** The representation of positive infinity, if @c has_infinity. */
302 : static _Tp infinity() throw() { return static_cast<_Tp>(0); }
303 :
304 : /** The representation of a quiet <em>Not a Number</em>,
305 : if @c has_quiet_NaN. */
306 : static _Tp quiet_NaN() throw() { return static_cast<_Tp>(0); }
307 : /** The representation of a signaling <em>Not a Number</em>, if
308 : @c has_signaling_NaN. */
309 : static _Tp signaling_NaN() throw() { return static_cast<_Tp>(0); }
310 : /** The minimum positive denormalized value. For types where
311 : @c has_denorm is false, this is the minimum positive normalized
312 : value. */
313 : static _Tp denorm_min() throw() { return static_cast<_Tp>(0); }
314 : };
315 :
316 : #ifdef __GXX_EXPERIMENTAL_CXX0X__
317 : template<typename _Tp>
318 : struct numeric_limits<const _Tp>
319 : : public numeric_limits<_Tp> { };
320 :
321 : template<typename _Tp>
322 : struct numeric_limits<volatile _Tp>
323 : : public numeric_limits<_Tp> { };
324 :
325 : template<typename _Tp>
326 : struct numeric_limits<const volatile _Tp>
327 : : public numeric_limits<_Tp> { };
328 : #endif
329 :
330 : // Now there follow 16 explicit specializations. Yes, 16. Make sure
331 : // you get the count right. (18 in c++0x mode)
332 :
333 : /// numeric_limits<bool> specialization.
334 : template<>
335 : struct numeric_limits<bool>
336 : {
337 : static const bool is_specialized = true;
338 :
339 : static bool min() throw()
340 : { return false; }
341 : static bool max() throw()
342 : { return true; }
343 : #ifdef __GXX_EXPERIMENTAL_CXX0X__
344 : static bool lowest() throw()
345 : { return min(); }
346 : #endif
347 : static const int digits = 1;
348 : static const int digits10 = 0;
349 : #ifdef __GXX_EXPERIMENTAL_CXX0X__
350 : static const int max_digits10 = 0;
351 : #endif
352 : static const bool is_signed = false;
353 : static const bool is_integer = true;
354 : static const bool is_exact = true;
355 : static const int radix = 2;
356 : static bool epsilon() throw()
357 : { return false; }
358 : static bool round_error() throw()
359 : { return false; }
360 :
361 : static const int min_exponent = 0;
362 : static const int min_exponent10 = 0;
363 : static const int max_exponent = 0;
364 : static const int max_exponent10 = 0;
365 :
366 : static const bool has_infinity = false;
367 : static const bool has_quiet_NaN = false;
368 : static const bool has_signaling_NaN = false;
369 : static const float_denorm_style has_denorm = denorm_absent;
370 : static const bool has_denorm_loss = false;
371 :
372 : static bool infinity() throw()
373 : { return false; }
374 : static bool quiet_NaN() throw()
375 : { return false; }
376 : static bool signaling_NaN() throw()
377 : { return false; }
378 : static bool denorm_min() throw()
379 : { return false; }
380 :
381 : static const bool is_iec559 = false;
382 : static const bool is_bounded = true;
383 : static const bool is_modulo = false;
384 :
385 : // It is not clear what it means for a boolean type to trap.
386 : // This is a DR on the LWG issue list. Here, I use integer
387 : // promotion semantics.
388 : static const bool traps = __glibcxx_integral_traps;
389 : static const bool tinyness_before = false;
390 : static const float_round_style round_style = round_toward_zero;
391 : };
392 :
393 : /// numeric_limits<char> specialization.
394 : template<>
395 : struct numeric_limits<char>
396 : {
397 : static const bool is_specialized = true;
398 :
399 : static char min() throw()
400 : { return __glibcxx_min(char); }
401 : static char max() throw()
402 : { return __glibcxx_max(char); }
403 : #ifdef __GXX_EXPERIMENTAL_CXX0X__
404 : static char lowest() throw()
405 : { return min(); }
406 : #endif
407 :
408 : static const int digits = __glibcxx_digits (char);
409 : static const int digits10 = __glibcxx_digits10 (char);
410 : #ifdef __GXX_EXPERIMENTAL_CXX0X__
411 : static const int max_digits10 = 0;
412 : #endif
413 : static const bool is_signed = __glibcxx_signed (char);
414 : static const bool is_integer = true;
415 : static const bool is_exact = true;
416 : static const int radix = 2;
417 : static char epsilon() throw()
418 : { return 0; }
419 : static char round_error() throw()
420 : { return 0; }
421 :
422 : static const int min_exponent = 0;
423 : static const int min_exponent10 = 0;
424 : static const int max_exponent = 0;
425 : static const int max_exponent10 = 0;
426 :
427 : static const bool has_infinity = false;
428 : static const bool has_quiet_NaN = false;
429 : static const bool has_signaling_NaN = false;
430 : static const float_denorm_style has_denorm = denorm_absent;
431 : static const bool has_denorm_loss = false;
432 :
433 : static char infinity() throw()
434 : { return char(); }
435 : static char quiet_NaN() throw()
436 : { return char(); }
437 : static char signaling_NaN() throw()
438 : { return char(); }
439 : static char denorm_min() throw()
440 : { return static_cast<char>(0); }
441 :
442 : static const bool is_iec559 = false;
443 : static const bool is_bounded = true;
444 : static const bool is_modulo = true;
445 :
446 : static const bool traps = __glibcxx_integral_traps;
447 : static const bool tinyness_before = false;
448 : static const float_round_style round_style = round_toward_zero;
449 : };
450 :
451 : /// numeric_limits<signed char> specialization.
452 : template<>
453 : struct numeric_limits<signed char>
454 : {
455 : static const bool is_specialized = true;
456 :
457 : static signed char min() throw()
458 : { return -__SCHAR_MAX__ - 1; }
459 : static signed char max() throw()
460 : { return __SCHAR_MAX__; }
461 : #ifdef __GXX_EXPERIMENTAL_CXX0X__
462 : static signed char lowest() throw()
463 : { return min(); }
464 : #endif
465 :
466 : static const int digits = __glibcxx_digits (signed char);
467 : static const int digits10 = __glibcxx_digits10 (signed char);
468 : #ifdef __GXX_EXPERIMENTAL_CXX0X__
469 : static const int max_digits10 = 0;
470 : #endif
471 : static const bool is_signed = true;
472 : static const bool is_integer = true;
473 : static const bool is_exact = true;
474 : static const int radix = 2;
475 : static signed char epsilon() throw()
476 : { return 0; }
477 : static signed char round_error() throw()
478 : { return 0; }
479 :
480 : static const int min_exponent = 0;
481 : static const int min_exponent10 = 0;
482 : static const int max_exponent = 0;
483 : static const int max_exponent10 = 0;
484 :
485 : static const bool has_infinity = false;
486 : static const bool has_quiet_NaN = false;
487 : static const bool has_signaling_NaN = false;
488 : static const float_denorm_style has_denorm = denorm_absent;
489 : static const bool has_denorm_loss = false;
490 :
491 : static signed char infinity() throw()
492 : { return static_cast<signed char>(0); }
493 : static signed char quiet_NaN() throw()
494 : { return static_cast<signed char>(0); }
495 : static signed char signaling_NaN() throw()
496 : { return static_cast<signed char>(0); }
497 : static signed char denorm_min() throw()
498 : { return static_cast<signed char>(0); }
499 :
500 : static const bool is_iec559 = false;
501 : static const bool is_bounded = true;
502 : static const bool is_modulo = true;
503 :
504 : static const bool traps = __glibcxx_integral_traps;
505 : static const bool tinyness_before = false;
506 : static const float_round_style round_style = round_toward_zero;
507 : };
508 :
509 : /// numeric_limits<unsigned char> specialization.
510 : template<>
511 : struct numeric_limits<unsigned char>
512 : {
513 : static const bool is_specialized = true;
514 :
515 : static unsigned char min() throw()
516 : { return 0; }
517 : static unsigned char max() throw()
518 : { return __SCHAR_MAX__ * 2U + 1; }
519 : #ifdef __GXX_EXPERIMENTAL_CXX0X__
520 : static unsigned char lowest() throw()
521 : { return min(); }
522 : #endif
523 :
524 : static const int digits = __glibcxx_digits (unsigned char);
525 : static const int digits10 = __glibcxx_digits10 (unsigned char);
526 : #ifdef __GXX_EXPERIMENTAL_CXX0X__
527 : static const int max_digits10 = 0;
528 : #endif
529 : static const bool is_signed = false;
530 : static const bool is_integer = true;
531 : static const bool is_exact = true;
532 : static const int radix = 2;
533 : static unsigned char epsilon() throw()
534 : { return 0; }
535 : static unsigned char round_error() throw()
536 : { return 0; }
537 :
538 : static const int min_exponent = 0;
539 : static const int min_exponent10 = 0;
540 : static const int max_exponent = 0;
541 : static const int max_exponent10 = 0;
542 :
543 : static const bool has_infinity = false;
544 : static const bool has_quiet_NaN = false;
545 : static const bool has_signaling_NaN = false;
546 : static const float_denorm_style has_denorm = denorm_absent;
547 : static const bool has_denorm_loss = false;
548 :
549 : static unsigned char infinity() throw()
550 : { return static_cast<unsigned char>(0); }
551 : static unsigned char quiet_NaN() throw()
552 : { return static_cast<unsigned char>(0); }
553 : static unsigned char signaling_NaN() throw()
554 : { return static_cast<unsigned char>(0); }
555 : static unsigned char denorm_min() throw()
556 : { return static_cast<unsigned char>(0); }
557 :
558 : static const bool is_iec559 = false;
559 : static const bool is_bounded = true;
560 : static const bool is_modulo = true;
561 :
562 : static const bool traps = __glibcxx_integral_traps;
563 : static const bool tinyness_before = false;
564 : static const float_round_style round_style = round_toward_zero;
565 : };
566 :
567 : /// numeric_limits<wchar_t> specialization.
568 : template<>
569 : struct numeric_limits<wchar_t>
570 : {
571 : static const bool is_specialized = true;
572 :
573 : static wchar_t min() throw()
574 : { return __glibcxx_min (wchar_t); }
575 : static wchar_t max() throw()
576 : { return __glibcxx_max (wchar_t); }
577 : #ifdef __GXX_EXPERIMENTAL_CXX0X__
578 : static wchar_t lowest() throw()
579 : { return min(); }
580 : #endif
581 :
582 : static const int digits = __glibcxx_digits (wchar_t);
583 : static const int digits10 = __glibcxx_digits10 (wchar_t);
584 : #ifdef __GXX_EXPERIMENTAL_CXX0X__
585 : static const int max_digits10 = 0;
586 : #endif
587 : static const bool is_signed = __glibcxx_signed (wchar_t);
588 : static const bool is_integer = true;
589 : static const bool is_exact = true;
590 : static const int radix = 2;
591 : static wchar_t epsilon() throw()
592 : { return 0; }
593 : static wchar_t round_error() throw()
594 : { return 0; }
595 :
596 : static const int min_exponent = 0;
597 : static const int min_exponent10 = 0;
598 : static const int max_exponent = 0;
599 : static const int max_exponent10 = 0;
600 :
601 : static const bool has_infinity = false;
602 : static const bool has_quiet_NaN = false;
603 : static const bool has_signaling_NaN = false;
604 : static const float_denorm_style has_denorm = denorm_absent;
605 : static const bool has_denorm_loss = false;
606 :
607 : static wchar_t infinity() throw()
608 : { return wchar_t(); }
609 : static wchar_t quiet_NaN() throw()
610 : { return wchar_t(); }
611 : static wchar_t signaling_NaN() throw()
612 : { return wchar_t(); }
613 : static wchar_t denorm_min() throw()
614 : { return wchar_t(); }
615 :
616 : static const bool is_iec559 = false;
617 : static const bool is_bounded = true;
618 : static const bool is_modulo = true;
619 :
620 : static const bool traps = __glibcxx_integral_traps;
621 : static const bool tinyness_before = false;
622 : static const float_round_style round_style = round_toward_zero;
623 : };
624 :
625 : #ifdef __GXX_EXPERIMENTAL_CXX0X__
626 : /// numeric_limits<char16_t> specialization.
627 : template<>
628 : struct numeric_limits<char16_t>
629 : {
630 : static const bool is_specialized = true;
631 :
632 : static char16_t min() throw()
633 : { return __glibcxx_min (char16_t); }
634 : static char16_t max() throw()
635 : { return __glibcxx_max (char16_t); }
636 : #ifdef __GXX_EXPERIMENTAL_CXX0X__
637 : static char16_t lowest() throw()
638 : { return min(); }
639 : #endif
640 :
641 : static const int digits = __glibcxx_digits (char16_t);
642 : static const int digits10 = __glibcxx_digits10 (char16_t);
643 : #ifdef __GXX_EXPERIMENTAL_CXX0X__
644 : static const int max_digits10 = 0;
645 : #endif
646 : static const bool is_signed = __glibcxx_signed (char16_t);
647 : static const bool is_integer = true;
648 : static const bool is_exact = true;
649 : static const int radix = 2;
650 : static char16_t epsilon() throw()
651 : { return 0; }
652 : static char16_t round_error() throw()
653 : { return 0; }
654 :
655 : static const int min_exponent = 0;
656 : static const int min_exponent10 = 0;
657 : static const int max_exponent = 0;
658 : static const int max_exponent10 = 0;
659 :
660 : static const bool has_infinity = false;
661 : static const bool has_quiet_NaN = false;
662 : static const bool has_signaling_NaN = false;
663 : static const float_denorm_style has_denorm = denorm_absent;
664 : static const bool has_denorm_loss = false;
665 :
666 : static char16_t infinity() throw()
667 : { return char16_t(); }
668 : static char16_t quiet_NaN() throw()
669 : { return char16_t(); }
670 : static char16_t signaling_NaN() throw()
671 : { return char16_t(); }
672 : static char16_t denorm_min() throw()
673 : { return char16_t(); }
674 :
675 : static const bool is_iec559 = false;
676 : static const bool is_bounded = true;
677 : static const bool is_modulo = true;
678 :
679 : static const bool traps = __glibcxx_integral_traps;
680 : static const bool tinyness_before = false;
681 : static const float_round_style round_style = round_toward_zero;
682 : };
683 :
684 : /// numeric_limits<char32_t> specialization.
685 : template<>
686 : struct numeric_limits<char32_t>
687 : {
688 : static const bool is_specialized = true;
689 :
690 : static char32_t min() throw()
691 : { return __glibcxx_min (char32_t); }
692 : static char32_t max() throw()
693 : { return __glibcxx_max (char32_t); }
694 : #ifdef __GXX_EXPERIMENTAL_CXX0X__
695 : static char32_t lowest() throw()
696 : { return min(); }
697 : #endif
698 :
699 : static const int digits = __glibcxx_digits (char32_t);
700 : static const int digits10 = __glibcxx_digits10 (char32_t);
701 : #ifdef __GXX_EXPERIMENTAL_CXX0X__
702 : static const int max_digits10 = 0;
703 : #endif
704 : static const bool is_signed = __glibcxx_signed (char32_t);
705 : static const bool is_integer = true;
706 : static const bool is_exact = true;
707 : static const int radix = 2;
708 : static char32_t epsilon() throw()
709 : { return 0; }
710 : static char32_t round_error() throw()
711 : { return 0; }
712 :
713 : static const int min_exponent = 0;
714 : static const int min_exponent10 = 0;
715 : static const int max_exponent = 0;
716 : static const int max_exponent10 = 0;
717 :
718 : static const bool has_infinity = false;
719 : static const bool has_quiet_NaN = false;
720 : static const bool has_signaling_NaN = false;
721 : static const float_denorm_style has_denorm = denorm_absent;
722 : static const bool has_denorm_loss = false;
723 :
724 : static char32_t infinity() throw()
725 : { return char32_t(); }
726 : static char32_t quiet_NaN() throw()
727 : { return char32_t(); }
728 : static char32_t signaling_NaN() throw()
729 : { return char32_t(); }
730 : static char32_t denorm_min() throw()
731 : { return char32_t(); }
732 :
733 : static const bool is_iec559 = false;
734 : static const bool is_bounded = true;
735 : static const bool is_modulo = true;
736 :
737 : static const bool traps = __glibcxx_integral_traps;
738 : static const bool tinyness_before = false;
739 : static const float_round_style round_style = round_toward_zero;
740 : };
741 : #endif
742 :
743 : /// numeric_limits<short> specialization.
744 : template<>
745 : struct numeric_limits<short>
746 : {
747 : static const bool is_specialized = true;
748 :
749 : static short min() throw()
750 : { return -__SHRT_MAX__ - 1; }
751 : static short max() throw()
752 : { return __SHRT_MAX__; }
753 : #ifdef __GXX_EXPERIMENTAL_CXX0X__
754 : static short lowest() throw()
755 : { return min(); }
756 : #endif
757 :
758 : static const int digits = __glibcxx_digits (short);
759 : static const int digits10 = __glibcxx_digits10 (short);
760 : #ifdef __GXX_EXPERIMENTAL_CXX0X__
761 : static const int max_digits10 = 0;
762 : #endif
763 : static const bool is_signed = true;
764 : static const bool is_integer = true;
765 : static const bool is_exact = true;
766 : static const int radix = 2;
767 : static short epsilon() throw()
768 : { return 0; }
769 : static short round_error() throw()
770 : { return 0; }
771 :
772 : static const int min_exponent = 0;
773 : static const int min_exponent10 = 0;
774 : static const int max_exponent = 0;
775 : static const int max_exponent10 = 0;
776 :
777 : static const bool has_infinity = false;
778 : static const bool has_quiet_NaN = false;
779 : static const bool has_signaling_NaN = false;
780 : static const float_denorm_style has_denorm = denorm_absent;
781 : static const bool has_denorm_loss = false;
782 :
783 : static short infinity() throw()
784 : { return short(); }
785 : static short quiet_NaN() throw()
786 : { return short(); }
787 : static short signaling_NaN() throw()
788 : { return short(); }
789 : static short denorm_min() throw()
790 : { return short(); }
791 :
792 : static const bool is_iec559 = false;
793 : static const bool is_bounded = true;
794 : static const bool is_modulo = true;
795 :
796 : static const bool traps = __glibcxx_integral_traps;
797 : static const bool tinyness_before = false;
798 : static const float_round_style round_style = round_toward_zero;
799 : };
800 :
801 : /// numeric_limits<unsigned short> specialization.
802 : template<>
803 : struct numeric_limits<unsigned short>
804 : {
805 : static const bool is_specialized = true;
806 :
807 : static unsigned short min() throw()
808 : { return 0; }
809 0 : static unsigned short max() throw()
810 0 : { return __SHRT_MAX__ * 2U + 1; }
811 : #ifdef __GXX_EXPERIMENTAL_CXX0X__
812 : static unsigned short lowest() throw()
813 : { return min(); }
814 : #endif
815 :
816 : static const int digits = __glibcxx_digits (unsigned short);
817 : static const int digits10 = __glibcxx_digits10 (unsigned short);
818 : #ifdef __GXX_EXPERIMENTAL_CXX0X__
819 : static const int max_digits10 = 0;
820 : #endif
821 : static const bool is_signed = false;
822 : static const bool is_integer = true;
823 : static const bool is_exact = true;
824 : static const int radix = 2;
825 : static unsigned short epsilon() throw()
826 : { return 0; }
827 : static unsigned short round_error() throw()
828 : { return 0; }
829 :
830 : static const int min_exponent = 0;
831 : static const int min_exponent10 = 0;
832 : static const int max_exponent = 0;
833 : static const int max_exponent10 = 0;
834 :
835 : static const bool has_infinity = false;
836 : static const bool has_quiet_NaN = false;
837 : static const bool has_signaling_NaN = false;
838 : static const float_denorm_style has_denorm = denorm_absent;
839 : static const bool has_denorm_loss = false;
840 :
841 : static unsigned short infinity() throw()
842 : { return static_cast<unsigned short>(0); }
843 : static unsigned short quiet_NaN() throw()
844 : { return static_cast<unsigned short>(0); }
845 : static unsigned short signaling_NaN() throw()
846 : { return static_cast<unsigned short>(0); }
847 : static unsigned short denorm_min() throw()
848 : { return static_cast<unsigned short>(0); }
849 :
850 : static const bool is_iec559 = false;
851 : static const bool is_bounded = true;
852 : static const bool is_modulo = true;
853 :
854 : static const bool traps = __glibcxx_integral_traps;
855 : static const bool tinyness_before = false;
856 : static const float_round_style round_style = round_toward_zero;
857 : };
858 :
859 : /// numeric_limits<int> specialization.
860 : template<>
861 : struct numeric_limits<int>
862 : {
863 : static const bool is_specialized = true;
864 :
865 0 : static int min() throw()
866 0 : { return -__INT_MAX__ - 1; }
867 0 : static int max() throw()
868 0 : { return __INT_MAX__; }
869 : #ifdef __GXX_EXPERIMENTAL_CXX0X__
870 : static int lowest() throw()
871 : { return min(); }
872 : #endif
873 :
874 : static const int digits = __glibcxx_digits (int);
875 : static const int digits10 = __glibcxx_digits10 (int);
876 : #ifdef __GXX_EXPERIMENTAL_CXX0X__
877 : static const int max_digits10 = 0;
878 : #endif
879 : static const bool is_signed = true;
880 : static const bool is_integer = true;
881 : static const bool is_exact = true;
882 : static const int radix = 2;
883 : static int epsilon() throw()
884 : { return 0; }
885 : static int round_error() throw()
886 : { return 0; }
887 :
888 : static const int min_exponent = 0;
889 : static const int min_exponent10 = 0;
890 : static const int max_exponent = 0;
891 : static const int max_exponent10 = 0;
892 :
893 : static const bool has_infinity = false;
894 : static const bool has_quiet_NaN = false;
895 : static const bool has_signaling_NaN = false;
896 : static const float_denorm_style has_denorm = denorm_absent;
897 : static const bool has_denorm_loss = false;
898 :
899 : static int infinity() throw()
900 : { return static_cast<int>(0); }
901 : static int quiet_NaN() throw()
902 : { return static_cast<int>(0); }
903 : static int signaling_NaN() throw()
904 : { return static_cast<int>(0); }
905 : static int denorm_min() throw()
906 : { return static_cast<int>(0); }
907 :
908 : static const bool is_iec559 = false;
909 : static const bool is_bounded = true;
910 : static const bool is_modulo = true;
911 :
912 : static const bool traps = __glibcxx_integral_traps;
913 : static const bool tinyness_before = false;
914 : static const float_round_style round_style = round_toward_zero;
915 : };
916 :
917 : /// numeric_limits<unsigned int> specialization.
918 : template<>
919 : struct numeric_limits<unsigned int>
920 : {
921 : static const bool is_specialized = true;
922 :
923 : static unsigned int min() throw()
924 : { return 0; }
925 524234 : static unsigned int max() throw()
926 524234 : { return __INT_MAX__ * 2U + 1; }
927 : #ifdef __GXX_EXPERIMENTAL_CXX0X__
928 : static unsigned int lowest() throw()
929 : { return min(); }
930 : #endif
931 :
932 : static const int digits = __glibcxx_digits (unsigned int);
933 : static const int digits10 = __glibcxx_digits10 (unsigned int);
934 : #ifdef __GXX_EXPERIMENTAL_CXX0X__
935 : static const int max_digits10 = 0;
936 : #endif
937 : static const bool is_signed = false;
938 : static const bool is_integer = true;
939 : static const bool is_exact = true;
940 : static const int radix = 2;
941 : static unsigned int epsilon() throw()
942 : { return 0; }
943 : static unsigned int round_error() throw()
944 : { return 0; }
945 :
946 : static const int min_exponent = 0;
947 : static const int min_exponent10 = 0;
948 : static const int max_exponent = 0;
949 : static const int max_exponent10 = 0;
950 :
951 : static const bool has_infinity = false;
952 : static const bool has_quiet_NaN = false;
953 : static const bool has_signaling_NaN = false;
954 : static const float_denorm_style has_denorm = denorm_absent;
955 : static const bool has_denorm_loss = false;
956 :
957 : static unsigned int infinity() throw()
958 : { return static_cast<unsigned int>(0); }
959 : static unsigned int quiet_NaN() throw()
960 : { return static_cast<unsigned int>(0); }
961 : static unsigned int signaling_NaN() throw()
962 : { return static_cast<unsigned int>(0); }
963 : static unsigned int denorm_min() throw()
964 : { return static_cast<unsigned int>(0); }
965 :
966 : static const bool is_iec559 = false;
967 : static const bool is_bounded = true;
968 : static const bool is_modulo = true;
969 :
970 : static const bool traps = __glibcxx_integral_traps;
971 : static const bool tinyness_before = false;
972 : static const float_round_style round_style = round_toward_zero;
973 : };
974 :
975 : /// numeric_limits<long> specialization.
976 : template<>
977 : struct numeric_limits<long>
978 : {
979 : static const bool is_specialized = true;
980 :
981 0 : static long min() throw()
982 0 : { return -__LONG_MAX__ - 1; }
983 0 : static long max() throw()
984 0 : { return __LONG_MAX__; }
985 : #ifdef __GXX_EXPERIMENTAL_CXX0X__
986 : static long lowest() throw()
987 : { return min(); }
988 : #endif
989 :
990 : static const int digits = __glibcxx_digits (long);
991 : static const int digits10 = __glibcxx_digits10 (long);
992 : #ifdef __GXX_EXPERIMENTAL_CXX0X__
993 : static const int max_digits10 = 0;
994 : #endif
995 : static const bool is_signed = true;
996 : static const bool is_integer = true;
997 : static const bool is_exact = true;
998 : static const int radix = 2;
999 : static long epsilon() throw()
1000 : { return 0; }
1001 : static long round_error() throw()
1002 : { return 0; }
1003 :
1004 : static const int min_exponent = 0;
1005 : static const int min_exponent10 = 0;
1006 : static const int max_exponent = 0;
1007 : static const int max_exponent10 = 0;
1008 :
1009 : static const bool has_infinity = false;
1010 : static const bool has_quiet_NaN = false;
1011 : static const bool has_signaling_NaN = false;
1012 : static const float_denorm_style has_denorm = denorm_absent;
1013 : static const bool has_denorm_loss = false;
1014 :
1015 : static long infinity() throw()
1016 : { return static_cast<long>(0); }
1017 : static long quiet_NaN() throw()
1018 : { return static_cast<long>(0); }
1019 : static long signaling_NaN() throw()
1020 : { return static_cast<long>(0); }
1021 : static long denorm_min() throw()
1022 : { return static_cast<long>(0); }
1023 :
1024 : static const bool is_iec559 = false;
1025 : static const bool is_bounded = true;
1026 : static const bool is_modulo = true;
1027 :
1028 : static const bool traps = __glibcxx_integral_traps;
1029 : static const bool tinyness_before = false;
1030 : static const float_round_style round_style = round_toward_zero;
1031 : };
1032 :
1033 : /// numeric_limits<unsigned long> specialization.
1034 : template<>
1035 : struct numeric_limits<unsigned long>
1036 : {
1037 : static const bool is_specialized = true;
1038 :
1039 : static unsigned long min() throw()
1040 : { return 0; }
1041 : static unsigned long max() throw()
1042 : { return __LONG_MAX__ * 2UL + 1; }
1043 : #ifdef __GXX_EXPERIMENTAL_CXX0X__
1044 : static unsigned long lowest() throw()
1045 : { return min(); }
1046 : #endif
1047 :
1048 : static const int digits = __glibcxx_digits (unsigned long);
1049 : static const int digits10 = __glibcxx_digits10 (unsigned long);
1050 : #ifdef __GXX_EXPERIMENTAL_CXX0X__
1051 : static const int max_digits10 = 0;
1052 : #endif
1053 : static const bool is_signed = false;
1054 : static const bool is_integer = true;
1055 : static const bool is_exact = true;
1056 : static const int radix = 2;
1057 : static unsigned long epsilon() throw()
1058 : { return 0; }
1059 : static unsigned long round_error() throw()
1060 : { return 0; }
1061 :
1062 : static const int min_exponent = 0;
1063 : static const int min_exponent10 = 0;
1064 : static const int max_exponent = 0;
1065 : static const int max_exponent10 = 0;
1066 :
1067 : static const bool has_infinity = false;
1068 : static const bool has_quiet_NaN = false;
1069 : static const bool has_signaling_NaN = false;
1070 : static const float_denorm_style has_denorm = denorm_absent;
1071 : static const bool has_denorm_loss = false;
1072 :
1073 : static unsigned long infinity() throw()
1074 : { return static_cast<unsigned long>(0); }
1075 : static unsigned long quiet_NaN() throw()
1076 : { return static_cast<unsigned long>(0); }
1077 : static unsigned long signaling_NaN() throw()
1078 : { return static_cast<unsigned long>(0); }
1079 : static unsigned long denorm_min() throw()
1080 : { return static_cast<unsigned long>(0); }
1081 :
1082 : static const bool is_iec559 = false;
1083 : static const bool is_bounded = true;
1084 : static const bool is_modulo = true;
1085 :
1086 : static const bool traps = __glibcxx_integral_traps;
1087 : static const bool tinyness_before = false;
1088 : static const float_round_style round_style = round_toward_zero;
1089 : };
1090 :
1091 : /// numeric_limits<long long> specialization.
1092 : template<>
1093 : struct numeric_limits<long long>
1094 : {
1095 : static const bool is_specialized = true;
1096 :
1097 0 : static long long min() throw()
1098 0 : { return -__LONG_LONG_MAX__ - 1; }
1099 0 : static long long max() throw()
1100 0 : { return __LONG_LONG_MAX__; }
1101 : #ifdef __GXX_EXPERIMENTAL_CXX0X__
1102 : static long long lowest() throw()
1103 : { return min(); }
1104 : #endif
1105 :
1106 : static const int digits = __glibcxx_digits (long long);
1107 : static const int digits10 = __glibcxx_digits10 (long long);
1108 : #ifdef __GXX_EXPERIMENTAL_CXX0X__
1109 : static const int max_digits10 = 0;
1110 : #endif
1111 : static const bool is_signed = true;
1112 : static const bool is_integer = true;
1113 : static const bool is_exact = true;
1114 : static const int radix = 2;
1115 : static long long epsilon() throw()
1116 : { return 0; }
1117 : static long long round_error() throw()
1118 : { return 0; }
1119 :
1120 : static const int min_exponent = 0;
1121 : static const int min_exponent10 = 0;
1122 : static const int max_exponent = 0;
1123 : static const int max_exponent10 = 0;
1124 :
1125 : static const bool has_infinity = false;
1126 : static const bool has_quiet_NaN = false;
1127 : static const bool has_signaling_NaN = false;
1128 : static const float_denorm_style has_denorm = denorm_absent;
1129 : static const bool has_denorm_loss = false;
1130 :
1131 : static long long infinity() throw()
1132 : { return static_cast<long long>(0); }
1133 : static long long quiet_NaN() throw()
1134 : { return static_cast<long long>(0); }
1135 : static long long signaling_NaN() throw()
1136 : { return static_cast<long long>(0); }
1137 : static long long denorm_min() throw()
1138 : { return static_cast<long long>(0); }
1139 :
1140 : static const bool is_iec559 = false;
1141 : static const bool is_bounded = true;
1142 : static const bool is_modulo = true;
1143 :
1144 : static const bool traps = __glibcxx_integral_traps;
1145 : static const bool tinyness_before = false;
1146 : static const float_round_style round_style = round_toward_zero;
1147 : };
1148 :
1149 : /// numeric_limits<unsigned long long> specialization.
1150 : template<>
1151 : struct numeric_limits<unsigned long long>
1152 : {
1153 : static const bool is_specialized = true;
1154 :
1155 : static unsigned long long min() throw()
1156 : { return 0; }
1157 0 : static unsigned long long max() throw()
1158 0 : { return __LONG_LONG_MAX__ * 2ULL + 1; }
1159 : #ifdef __GXX_EXPERIMENTAL_CXX0X__
1160 : static unsigned long long lowest() throw()
1161 : { return min(); }
1162 : #endif
1163 :
1164 : static const int digits = __glibcxx_digits (unsigned long long);
1165 : static const int digits10 = __glibcxx_digits10 (unsigned long long);
1166 : #ifdef __GXX_EXPERIMENTAL_CXX0X__
1167 : static const int max_digits10 = 0;
1168 : #endif
1169 : static const bool is_signed = false;
1170 : static const bool is_integer = true;
1171 : static const bool is_exact = true;
1172 : static const int radix = 2;
1173 : static unsigned long long epsilon() throw()
1174 : { return 0; }
1175 : static unsigned long long round_error() throw()
1176 : { return 0; }
1177 :
1178 : static const int min_exponent = 0;
1179 : static const int min_exponent10 = 0;
1180 : static const int max_exponent = 0;
1181 : static const int max_exponent10 = 0;
1182 :
1183 : static const bool has_infinity = false;
1184 : static const bool has_quiet_NaN = false;
1185 : static const bool has_signaling_NaN = false;
1186 : static const float_denorm_style has_denorm = denorm_absent;
1187 : static const bool has_denorm_loss = false;
1188 :
1189 : static unsigned long long infinity() throw()
1190 : { return static_cast<unsigned long long>(0); }
1191 : static unsigned long long quiet_NaN() throw()
1192 : { return static_cast<unsigned long long>(0); }
1193 : static unsigned long long signaling_NaN() throw()
1194 : { return static_cast<unsigned long long>(0); }
1195 : static unsigned long long denorm_min() throw()
1196 : { return static_cast<unsigned long long>(0); }
1197 :
1198 : static const bool is_iec559 = false;
1199 : static const bool is_bounded = true;
1200 : static const bool is_modulo = true;
1201 :
1202 : static const bool traps = __glibcxx_integral_traps;
1203 : static const bool tinyness_before = false;
1204 : static const float_round_style round_style = round_toward_zero;
1205 : };
1206 :
1207 : /// numeric_limits<float> specialization.
1208 : template<>
1209 : struct numeric_limits<float>
1210 : {
1211 : static const bool is_specialized = true;
1212 :
1213 : static float min() throw()
1214 : { return __FLT_MIN__; }
1215 : static float max() throw()
1216 : { return __FLT_MAX__; }
1217 : #ifdef __GXX_EXPERIMENTAL_CXX0X__
1218 : static float lowest() throw()
1219 : { return -__FLT_MAX__; }
1220 : #endif
1221 :
1222 : static const int digits = __FLT_MANT_DIG__;
1223 : static const int digits10 = __FLT_DIG__;
1224 : #ifdef __GXX_EXPERIMENTAL_CXX0X__
1225 : static const int max_digits10
1226 : = __glibcxx_max_digits10 (__FLT_MANT_DIG__);
1227 : #endif
1228 : static const bool is_signed = true;
1229 : static const bool is_integer = false;
1230 : static const bool is_exact = false;
1231 : static const int radix = __FLT_RADIX__;
1232 : static float epsilon() throw()
1233 : { return __FLT_EPSILON__; }
1234 : static float round_error() throw()
1235 : { return 0.5F; }
1236 :
1237 : static const int min_exponent = __FLT_MIN_EXP__;
1238 : static const int min_exponent10 = __FLT_MIN_10_EXP__;
1239 : static const int max_exponent = __FLT_MAX_EXP__;
1240 : static const int max_exponent10 = __FLT_MAX_10_EXP__;
1241 :
1242 : static const bool has_infinity = __FLT_HAS_INFINITY__;
1243 : static const bool has_quiet_NaN = __FLT_HAS_QUIET_NAN__;
1244 : static const bool has_signaling_NaN = has_quiet_NaN;
1245 : static const float_denorm_style has_denorm
1246 : = bool(__FLT_HAS_DENORM__) ? denorm_present : denorm_absent;
1247 : static const bool has_denorm_loss = __glibcxx_float_has_denorm_loss;
1248 :
1249 : static float infinity() throw()
1250 : { return __builtin_huge_valf (); }
1251 0 : static float quiet_NaN() throw()
1252 0 : { return __builtin_nanf (""); }
1253 : static float signaling_NaN() throw()
1254 : { return __builtin_nansf (""); }
1255 : static float denorm_min() throw()
1256 : { return __FLT_DENORM_MIN__; }
1257 :
1258 : static const bool is_iec559
1259 : = has_infinity && has_quiet_NaN && has_denorm == denorm_present;
1260 : static const bool is_bounded = true;
1261 : static const bool is_modulo = false;
1262 :
1263 : static const bool traps = __glibcxx_float_traps;
1264 : static const bool tinyness_before = __glibcxx_float_tinyness_before;
1265 : static const float_round_style round_style = round_to_nearest;
1266 : };
1267 :
1268 : #undef __glibcxx_float_has_denorm_loss
1269 : #undef __glibcxx_float_traps
1270 : #undef __glibcxx_float_tinyness_before
1271 :
1272 : /// numeric_limits<double> specialization.
1273 : template<>
1274 : struct numeric_limits<double>
1275 : {
1276 : static const bool is_specialized = true;
1277 :
1278 : static double min() throw()
1279 : { return __DBL_MIN__; }
1280 : static double max() throw()
1281 : { return __DBL_MAX__; }
1282 : #ifdef __GXX_EXPERIMENTAL_CXX0X__
1283 : static double lowest() throw()
1284 : { return -__DBL_MAX__; }
1285 : #endif
1286 :
1287 : static const int digits = __DBL_MANT_DIG__;
1288 : static const int digits10 = __DBL_DIG__;
1289 : #ifdef __GXX_EXPERIMENTAL_CXX0X__
1290 : static const int max_digits10
1291 : = __glibcxx_max_digits10 (__DBL_MANT_DIG__);
1292 : #endif
1293 : static const bool is_signed = true;
1294 : static const bool is_integer = false;
1295 : static const bool is_exact = false;
1296 : static const int radix = __FLT_RADIX__;
1297 : static double epsilon() throw()
1298 : { return __DBL_EPSILON__; }
1299 : static double round_error() throw()
1300 : { return 0.5; }
1301 :
1302 : static const int min_exponent = __DBL_MIN_EXP__;
1303 : static const int min_exponent10 = __DBL_MIN_10_EXP__;
1304 : static const int max_exponent = __DBL_MAX_EXP__;
1305 : static const int max_exponent10 = __DBL_MAX_10_EXP__;
1306 :
1307 : static const bool has_infinity = __DBL_HAS_INFINITY__;
1308 : static const bool has_quiet_NaN = __DBL_HAS_QUIET_NAN__;
1309 : static const bool has_signaling_NaN = has_quiet_NaN;
1310 : static const float_denorm_style has_denorm
1311 : = bool(__DBL_HAS_DENORM__) ? denorm_present : denorm_absent;
1312 : static const bool has_denorm_loss = __glibcxx_double_has_denorm_loss;
1313 :
1314 1 : static double infinity() throw()
1315 1 : { return __builtin_huge_val(); }
1316 9 : static double quiet_NaN() throw()
1317 9 : { return __builtin_nan (""); }
1318 9 : static double signaling_NaN() throw()
1319 9 : { return __builtin_nans (""); }
1320 : static double denorm_min() throw()
1321 : { return __DBL_DENORM_MIN__; }
1322 :
1323 : static const bool is_iec559
1324 : = has_infinity && has_quiet_NaN && has_denorm == denorm_present;
1325 : static const bool is_bounded = true;
1326 : static const bool is_modulo = false;
1327 :
1328 : static const bool traps = __glibcxx_double_traps;
1329 : static const bool tinyness_before = __glibcxx_double_tinyness_before;
1330 : static const float_round_style round_style = round_to_nearest;
1331 : };
1332 :
1333 : #undef __glibcxx_double_has_denorm_loss
1334 : #undef __glibcxx_double_traps
1335 : #undef __glibcxx_double_tinyness_before
1336 :
1337 : /// numeric_limits<long double> specialization.
1338 : template<>
1339 : struct numeric_limits<long double>
1340 : {
1341 : static const bool is_specialized = true;
1342 :
1343 : static long double min() throw()
1344 : { return __LDBL_MIN__; }
1345 : static long double max() throw()
1346 : { return __LDBL_MAX__; }
1347 : #ifdef __GXX_EXPERIMENTAL_CXX0X__
1348 : static long double lowest() throw()
1349 : { return -__LDBL_MAX__; }
1350 : #endif
1351 :
1352 : static const int digits = __LDBL_MANT_DIG__;
1353 : static const int digits10 = __LDBL_DIG__;
1354 : #ifdef __GXX_EXPERIMENTAL_CXX0X__
1355 : static const int max_digits10
1356 : = __glibcxx_max_digits10 (__LDBL_MANT_DIG__);
1357 : #endif
1358 : static const bool is_signed = true;
1359 : static const bool is_integer = false;
1360 : static const bool is_exact = false;
1361 : static const int radix = __FLT_RADIX__;
1362 : static long double epsilon() throw()
1363 : { return __LDBL_EPSILON__; }
1364 : static long double round_error() throw()
1365 : { return 0.5L; }
1366 :
1367 : static const int min_exponent = __LDBL_MIN_EXP__;
1368 : static const int min_exponent10 = __LDBL_MIN_10_EXP__;
1369 : static const int max_exponent = __LDBL_MAX_EXP__;
1370 : static const int max_exponent10 = __LDBL_MAX_10_EXP__;
1371 :
1372 : static const bool has_infinity = __LDBL_HAS_INFINITY__;
1373 : static const bool has_quiet_NaN = __LDBL_HAS_QUIET_NAN__;
1374 : static const bool has_signaling_NaN = has_quiet_NaN;
1375 : static const float_denorm_style has_denorm
1376 : = bool(__LDBL_HAS_DENORM__) ? denorm_present : denorm_absent;
1377 : static const bool has_denorm_loss
1378 : = __glibcxx_long_double_has_denorm_loss;
1379 :
1380 : static long double infinity() throw()
1381 : { return __builtin_huge_vall (); }
1382 : static long double quiet_NaN() throw()
1383 : { return __builtin_nanl (""); }
1384 : static long double signaling_NaN() throw()
1385 : { return __builtin_nansl (""); }
1386 : static long double denorm_min() throw()
1387 : { return __LDBL_DENORM_MIN__; }
1388 :
1389 : static const bool is_iec559
1390 : = has_infinity && has_quiet_NaN && has_denorm == denorm_present;
1391 : static const bool is_bounded = true;
1392 : static const bool is_modulo = false;
1393 :
1394 : static const bool traps = __glibcxx_long_double_traps;
1395 : static const bool tinyness_before = __glibcxx_long_double_tinyness_before;
1396 : static const float_round_style round_style = round_to_nearest;
1397 : };
1398 :
1399 : #undef __glibcxx_long_double_has_denorm_loss
1400 : #undef __glibcxx_long_double_traps
1401 : #undef __glibcxx_long_double_tinyness_before
1402 :
1403 : _GLIBCXX_END_NAMESPACE
1404 :
1405 : #undef __glibcxx_signed
1406 : #undef __glibcxx_min
1407 : #undef __glibcxx_max
1408 : #undef __glibcxx_digits
1409 : #undef __glibcxx_digits10
1410 : #undef __glibcxx_max_digits10
1411 :
1412 : #endif // _GLIBCXX_NUMERIC_LIMITS
|