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