1// The template and inlines for the numeric_limits classes. -*- C++ -*-
2
3// Copyright (C) 1999-2017 Free Software Foundation, Inc.
4//
5// This file is part of the GNU ISO C++ Library. This library is free
6// software; you can redistribute it and/or modify it under the
7// terms of the GNU General Public License as published by the
8// Free Software Foundation; either version 3, or (at your option)
9// any later version.
10
11// This library is distributed in the hope that it will be useful,
12// but WITHOUT ANY WARRANTY; without even the implied warranty of
13// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14// GNU General Public License for more details.
15
16// Under Section 7 of GPL version 3, you are granted additional
17// permissions described in the GCC Runtime Library Exception, version
18// 3.1, as published by the Free Software Foundation.
19
20// You should have received a copy of the GNU General Public License and
21// a copy of the GCC Runtime Library Exception along with this program;
22// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
23// <http://www.gnu.org/licenses/>.
24
25/** @file include/limits
26 * This is a Standard C++ Library header.
27 */
28
29// Note: this is not a conforming implementation.
30// Written by Gabriel Dos Reis <gdr@codesourcery.com>
31
32//
33// ISO 14882:1998
34// 18.2.1
35//
36
37#ifndef _GLIBCXX_NUMERIC_LIMITS
38#define _GLIBCXX_NUMERIC_LIMITS 1
39
40#pragma GCC system_header
41
42#include <bits/c++config.h>
43
44//
45// The numeric_limits<> traits document implementation-defined aspects
46// of fundamental arithmetic data types (integers and floating points).
47// From Standard C++ point of view, there are 14 such types:
48// * integers
49// bool (1)
50// char, signed char, unsigned char, wchar_t (4)
51// short, unsigned short (2)
52// int, unsigned (2)
53// long, unsigned long (2)
54//
55// * floating points
56// float (1)
57// double (1)
58// long double (1)
59//
60// GNU C++ understands (where supported by the host C-library)
61// * integer
62// long long, unsigned long long (2)
63//
64// which brings us to 16 fundamental arithmetic data types in GNU C++.
65//
66//
67// Since a numeric_limits<> is a bit tricky to get right, we rely on
68// an interface composed of macros which should be defined in config/os
69// or config/cpu when they differ from the generic (read arbitrary)
70// definitions given here.
71//
72
73// These values can be overridden in the target configuration file.
74// The default values are appropriate for many 32-bit targets.
75
76// GCC only intrinsically supports modulo integral types. The only remaining
77// integral exceptional values is division by zero. Only targets that do not
78// signal division by zero in some "hard to ignore" way should use false.
79#ifndef __glibcxx_integral_traps
80# define __glibcxx_integral_traps true
81#endif
82
83// float
84//
85
86// Default values. Should be overridden in configuration files if necessary.
87
88#ifndef __glibcxx_float_has_denorm_loss
89# define __glibcxx_float_has_denorm_loss false
90#endif
91#ifndef __glibcxx_float_traps
92# define __glibcxx_float_traps false
93#endif
94#ifndef __glibcxx_float_tinyness_before
95# define __glibcxx_float_tinyness_before false
96#endif
97
98// double
99
100// Default values. Should be overridden in configuration files if necessary.
101
102#ifndef __glibcxx_double_has_denorm_loss
103# define __glibcxx_double_has_denorm_loss false
104#endif
105#ifndef __glibcxx_double_traps
106# define __glibcxx_double_traps false
107#endif
108#ifndef __glibcxx_double_tinyness_before
109# define __glibcxx_double_tinyness_before false
110#endif
111
112// long double
113
114// Default values. Should be overridden in configuration files if necessary.
115
116#ifndef __glibcxx_long_double_has_denorm_loss
117# define __glibcxx_long_double_has_denorm_loss false
118#endif
119#ifndef __glibcxx_long_double_traps
120# define __glibcxx_long_double_traps false
121#endif
122#ifndef __glibcxx_long_double_tinyness_before
123# define __glibcxx_long_double_tinyness_before false
124#endif
125
126// You should not need to define any macros below this point.
127
128#define __glibcxx_signed_b(T,B) ((T)(-1) < 0)
129
130#define __glibcxx_min_b(T,B) \
131 (__glibcxx_signed_b (T,B) ? -__glibcxx_max_b (T,B) - 1 : (T)0)
132
133#define __glibcxx_max_b(T,B) \
134 (__glibcxx_signed_b (T,B) ? \
135 (((((T)1 << (__glibcxx_digits_b (T,B) - 1)) - 1) << 1) + 1) : ~(T)0)
136
137#define __glibcxx_digits_b(T,B) \
138 (B - __glibcxx_signed_b (T,B))
139
140// The fraction 643/2136 approximates log10(2) to 7 significant digits.
141#define __glibcxx_digits10_b(T,B) \
142 (__glibcxx_digits_b (T,B) * 643L / 2136)
143
144#define __glibcxx_signed(T) \
145 __glibcxx_signed_b (T, sizeof(T) * __CHAR_BIT__)
146#define __glibcxx_min(T) \
147 __glibcxx_min_b (T, sizeof(T) * __CHAR_BIT__)
148#define __glibcxx_max(T) \
149 __glibcxx_max_b (T, sizeof(T) * __CHAR_BIT__)
150#define __glibcxx_digits(T) \
151 __glibcxx_digits_b (T, sizeof(T) * __CHAR_BIT__)
152#define __glibcxx_digits10(T) \
153 __glibcxx_digits10_b (T, sizeof(T) * __CHAR_BIT__)
154
155#define __glibcxx_max_digits10(T) \
156 (2 + (T) * 643L / 2136)
157
158namespace std _GLIBCXX_VISIBILITY(default)
159{
160_GLIBCXX_BEGIN_NAMESPACE_VERSION
161
162 /**
163 * @brief Describes the rounding style for floating-point types.
164 *
165 * This is used in the std::numeric_limits class.
166 */
167 enum float_round_style
168 {
169 round_indeterminate = -1, /// Intermediate.
170 round_toward_zero = 0, /// To zero.
171 round_to_nearest = 1, /// To the nearest representable value.
172 round_toward_infinity = 2, /// To infinity.
173 round_toward_neg_infinity = 3 /// To negative infinity.
174 };
175
176 /**
177 * @brief Describes the denormalization for floating-point types.
178 *
179 * These values represent the presence or absence of a variable number
180 * of exponent bits. This type is used in the std::numeric_limits class.
181 */
182 enum float_denorm_style
183 {
184 /// Indeterminate at compile time whether denormalized values are allowed.
185 denorm_indeterminate = -1,
186 /// The type does not allow denormalized values.
187 denorm_absent = 0,
188 /// The type allows denormalized values.
189 denorm_present = 1
190 };
191
192 /**
193 * @brief Part of std::numeric_limits.
194 *
195 * The @c static @c const members are usable as integral constant
196 * expressions.
197 *
198 * @note This is a separate class for purposes of efficiency; you
199 * should only access these members as part of an instantiation
200 * of the std::numeric_limits class.
201 */
202 struct __numeric_limits_base
203 {
204 /** This will be true for all fundamental types (which have
205 specializations), and false for everything else. */
206 static _GLIBCXX_USE_CONSTEXPR bool is_specialized = false;
207
208 /** The number of @c radix digits that be represented without change: for
209 integer types, the number of non-sign bits in the mantissa; for
210 floating types, the number of @c radix digits in the mantissa. */
211 static _GLIBCXX_USE_CONSTEXPR int digits = 0;
212
213 /** The number of base 10 digits that can be represented without change. */
214 static _GLIBCXX_USE_CONSTEXPR int digits10 = 0;
215
216#if __cplusplus >= 201103L
217 /** The number of base 10 digits required to ensure that values which
218 differ are always differentiated. */
219 static constexpr int max_digits10 = 0;
220#endif
221
222 /** True if the type is signed. */
223 static _GLIBCXX_USE_CONSTEXPR bool is_signed = false;
224
225 /** True if the type is integer. */
226 static _GLIBCXX_USE_CONSTEXPR bool is_integer = false;
227
228 /** True if the type uses an exact representation. All integer types are
229 exact, but not all exact types are integer. For example, rational and
230 fixed-exponent representations are exact but not integer. */
231 static _GLIBCXX_USE_CONSTEXPR bool is_exact = false;
232
233 /** For integer types, specifies the base of the representation. For
234 floating types, specifies the base of the exponent representation. */
235 static _GLIBCXX_USE_CONSTEXPR int radix = 0;
236
237 /** The minimum negative integer such that @c radix raised to the power of
238 (one less than that integer) is a normalized floating point number. */
239 static _GLIBCXX_USE_CONSTEXPR int min_exponent = 0;
240
241 /** The minimum negative integer such that 10 raised to that power is in
242 the range of normalized floating point numbers. */
243 static _GLIBCXX_USE_CONSTEXPR int min_exponent10 = 0;
244
245 /** The maximum positive integer such that @c radix raised to the power of
246 (one less than that integer) is a representable finite floating point
247 number. */
248 static _GLIBCXX_USE_CONSTEXPR int max_exponent = 0;
249
250 /** The maximum positive integer such that 10 raised to that power is in
251 the range of representable finite floating point numbers. */
252 static _GLIBCXX_USE_CONSTEXPR int max_exponent10 = 0;
253
254 /** True if the type has a representation for positive infinity. */
255 static _GLIBCXX_USE_CONSTEXPR bool has_infinity = false;
256
257 /** True if the type has a representation for a quiet (non-signaling)
258 Not a Number. */
259 static _GLIBCXX_USE_CONSTEXPR bool has_quiet_NaN = false;
260
261 /** True if the type has a representation for a signaling
262 Not a Number. */
263 static _GLIBCXX_USE_CONSTEXPR bool has_signaling_NaN = false;
264
265 /** See std::float_denorm_style for more information. */
266 static _GLIBCXX_USE_CONSTEXPR float_denorm_style has_denorm = denorm_absent;
267
268 /** True if loss of accuracy is detected as a denormalization loss,
269 rather than as an inexact result. */
270 static _GLIBCXX_USE_CONSTEXPR bool has_denorm_loss = false;
271
272 /** True if-and-only-if the type adheres to the IEC 559 standard, also
273 known as IEEE 754. (Only makes sense for floating point types.) */
274 static _GLIBCXX_USE_CONSTEXPR bool is_iec559 = false;
275
276 /** True if the set of values representable by the type is
277 finite. All built-in types are bounded, this member would be
278 false for arbitrary precision types. */
279 static _GLIBCXX_USE_CONSTEXPR bool is_bounded = false;
280
281 /** True if the type is @e modulo. A type is modulo if, for any
282 operation involving +, -, or * on values of that type whose
283 result would fall outside the range [min(),max()], the value
284 returned differs from the true value by an integer multiple of
285 max() - min() + 1. On most machines, this is false for floating
286 types, true for unsigned integers, and true for signed integers.
287 See PR22200 about signed integers. */
288 static _GLIBCXX_USE_CONSTEXPR bool is_modulo = false;
289
290 /** True if trapping is implemented for this type. */
291 static _GLIBCXX_USE_CONSTEXPR bool traps = false;
292
293 /** True if tininess is detected before rounding. (see IEC 559) */
294 static _GLIBCXX_USE_CONSTEXPR bool tinyness_before = false;
295
296 /** See std::float_round_style for more information. This is only
297 meaningful for floating types; integer types will all be
298 round_toward_zero. */
299 static _GLIBCXX_USE_CONSTEXPR float_round_style round_style =
300 round_toward_zero;
301 };
302
303 /**
304 * @brief Properties of fundamental types.
305 *
306 * This class allows a program to obtain information about the
307 * representation of a fundamental type on a given platform. For
308 * non-fundamental types, the functions will return 0 and the data
309 * members will all be @c false.
310 */
311 template<typename _Tp>
312 struct numeric_limits : public __numeric_limits_base
313 {
314 /** The minimum finite value, or for floating types with
315 denormalization, the minimum positive normalized value. */
316 static _GLIBCXX_CONSTEXPR _Tp
317 min() _GLIBCXX_USE_NOEXCEPT { return _Tp(); }
318
319 /** The maximum finite value. */
320 static _GLIBCXX_CONSTEXPR _Tp
321 max() _GLIBCXX_USE_NOEXCEPT { return _Tp(); }
322
323#if __cplusplus >= 201103L
324 /** A finite value x such that there is no other finite value y
325 * where y < x. */
326 static constexpr _Tp
327 lowest() noexcept { return _Tp(); }
328#endif
329
330 /** The @e machine @e epsilon: the difference between 1 and the least
331 value greater than 1 that is representable. */
332 static _GLIBCXX_CONSTEXPR _Tp
333 epsilon() _GLIBCXX_USE_NOEXCEPT { return _Tp(); }
334
335 /** The maximum rounding error measurement (see LIA-1). */
336 static _GLIBCXX_CONSTEXPR _Tp
337 round_error() _GLIBCXX_USE_NOEXCEPT { return _Tp(); }
338
339 /** The representation of positive infinity, if @c has_infinity. */
340 static _GLIBCXX_CONSTEXPR _Tp
341 infinity() _GLIBCXX_USE_NOEXCEPT { return _Tp(); }
342
343 /** The representation of a quiet Not a Number,
344 if @c has_quiet_NaN. */
345 static _GLIBCXX_CONSTEXPR _Tp
346 quiet_NaN() _GLIBCXX_USE_NOEXCEPT { return _Tp(); }
347
348 /** The representation of a signaling Not a Number, if
349 @c has_signaling_NaN. */
350 static _GLIBCXX_CONSTEXPR _Tp
351 signaling_NaN() _GLIBCXX_USE_NOEXCEPT { return _Tp(); }
352
353 /** The minimum positive denormalized value. For types where
354 @c has_denorm is false, this is the minimum positive normalized
355 value. */
356 static _GLIBCXX_CONSTEXPR _Tp
357 denorm_min() _GLIBCXX_USE_NOEXCEPT { return _Tp(); }
358 };
359
360 // _GLIBCXX_RESOLVE_LIB_DEFECTS
361 // 559. numeric_limits<const T>
362
363 template<typename _Tp>
364 struct numeric_limits<const _Tp>
365 : public numeric_limits<_Tp> { };
366
367 template<typename _Tp>
368 struct numeric_limits<volatile _Tp>
369 : public numeric_limits<_Tp> { };
370
371 template<typename _Tp>
372 struct numeric_limits<const volatile _Tp>
373 : public numeric_limits<_Tp> { };
374
375 // Now there follow 16 explicit specializations. Yes, 16. Make sure
376 // you get the count right. (18 in C++11 mode, with char16_t and char32_t.)
377
378 // _GLIBCXX_RESOLVE_LIB_DEFECTS
379 // 184. numeric_limits<bool> wording problems
380
381 /// numeric_limits<bool> specialization.
382 template<>
383 struct numeric_limits<bool>
384 {
385 static _GLIBCXX_USE_CONSTEXPR bool is_specialized = true;
386
387 static _GLIBCXX_CONSTEXPR bool
388 min() _GLIBCXX_USE_NOEXCEPT { return false; }
389
390 static _GLIBCXX_CONSTEXPR bool
391 max() _GLIBCXX_USE_NOEXCEPT { return true; }
392
393#if __cplusplus >= 201103L
394 static constexpr bool
395 lowest() noexcept { return min(); }
396#endif
397 static _GLIBCXX_USE_CONSTEXPR int digits = 1;
398 static _GLIBCXX_USE_CONSTEXPR int digits10 = 0;
399#if __cplusplus >= 201103L
400 static constexpr int max_digits10 = 0;
401#endif
402 static _GLIBCXX_USE_CONSTEXPR bool is_signed = false;
403 static _GLIBCXX_USE_CONSTEXPR bool is_integer = true;
404 static _GLIBCXX_USE_CONSTEXPR bool is_exact = true;
405 static _GLIBCXX_USE_CONSTEXPR int radix = 2;
406
407 static _GLIBCXX_CONSTEXPR bool
408 epsilon() _GLIBCXX_USE_NOEXCEPT { return false; }
409
410 static _GLIBCXX_CONSTEXPR bool
411 round_error() _GLIBCXX_USE_NOEXCEPT { return false; }
412
413 static _GLIBCXX_USE_CONSTEXPR int min_exponent = 0;
414 static _GLIBCXX_USE_CONSTEXPR int min_exponent10 = 0;
415 static _GLIBCXX_USE_CONSTEXPR int max_exponent = 0;
416 static _GLIBCXX_USE_CONSTEXPR int max_exponent10 = 0;
417
418 static _GLIBCXX_USE_CONSTEXPR bool has_infinity = false;
419 static _GLIBCXX_USE_CONSTEXPR bool has_quiet_NaN = false;
420 static _GLIBCXX_USE_CONSTEXPR bool has_signaling_NaN = false;
421 static _GLIBCXX_USE_CONSTEXPR float_denorm_style has_denorm
422 = denorm_absent;
423 static _GLIBCXX_USE_CONSTEXPR bool has_denorm_loss = false;
424
425 static _GLIBCXX_CONSTEXPR bool
426 infinity() _GLIBCXX_USE_NOEXCEPT { return false; }
427
428 static _GLIBCXX_CONSTEXPR bool
429 quiet_NaN() _GLIBCXX_USE_NOEXCEPT { return false; }
430
431 static _GLIBCXX_CONSTEXPR bool
432 signaling_NaN() _GLIBCXX_USE_NOEXCEPT { return false; }
433
434 static _GLIBCXX_CONSTEXPR bool
435 denorm_min() _GLIBCXX_USE_NOEXCEPT { return false; }
436
437 static _GLIBCXX_USE_CONSTEXPR bool is_iec559 = false;
438 static _GLIBCXX_USE_CONSTEXPR bool is_bounded = true;
439 static _GLIBCXX_USE_CONSTEXPR bool is_modulo = false;
440
441 // It is not clear what it means for a boolean type to trap.
442 // This is a DR on the LWG issue list. Here, I use integer
443 // promotion semantics.
444 static _GLIBCXX_USE_CONSTEXPR bool traps = __glibcxx_integral_traps;
445 static _GLIBCXX_USE_CONSTEXPR bool tinyness_before = false;
446 static _GLIBCXX_USE_CONSTEXPR float_round_style round_style
447 = round_toward_zero;
448 };
449
450 /// numeric_limits<char> specialization.
451 template<>
452 struct numeric_limits<char>
453 {
454 static _GLIBCXX_USE_CONSTEXPR bool is_specialized = true;
455
456 static _GLIBCXX_CONSTEXPR char
457 min() _GLIBCXX_USE_NOEXCEPT { return __glibcxx_min(char); }
458
459 static _GLIBCXX_CONSTEXPR char
460 max() _GLIBCXX_USE_NOEXCEPT { return __glibcxx_max(char); }
461
462#if __cplusplus >= 201103L
463 static constexpr char
464 lowest() noexcept { return min(); }
465#endif
466
467 static _GLIBCXX_USE_CONSTEXPR int digits = __glibcxx_digits (char);
468 static _GLIBCXX_USE_CONSTEXPR int digits10 = __glibcxx_digits10 (char);
469#if __cplusplus >= 201103L
470 static constexpr int max_digits10 = 0;
471#endif
472 static _GLIBCXX_USE_CONSTEXPR bool is_signed = __glibcxx_signed (char);
473 static _GLIBCXX_USE_CONSTEXPR bool is_integer = true;
474 static _GLIBCXX_USE_CONSTEXPR bool is_exact = true;
475 static _GLIBCXX_USE_CONSTEXPR int radix = 2;
476
477 static _GLIBCXX_CONSTEXPR char
478 epsilon() _GLIBCXX_USE_NOEXCEPT { return 0; }
479
480 static _GLIBCXX_CONSTEXPR char
481 round_error() _GLIBCXX_USE_NOEXCEPT { return 0; }
482
483 static _GLIBCXX_USE_CONSTEXPR int min_exponent = 0;
484 static _GLIBCXX_USE_CONSTEXPR int min_exponent10 = 0;
485 static _GLIBCXX_USE_CONSTEXPR int max_exponent = 0;
486 static _GLIBCXX_USE_CONSTEXPR int max_exponent10 = 0;
487
488 static _GLIBCXX_USE_CONSTEXPR bool has_infinity = false;
489 static _GLIBCXX_USE_CONSTEXPR bool has_quiet_NaN = false;
490 static _GLIBCXX_USE_CONSTEXPR bool has_signaling_NaN = false;
491 static _GLIBCXX_USE_CONSTEXPR float_denorm_style has_denorm
492 = denorm_absent;
493 static _GLIBCXX_USE_CONSTEXPR bool has_denorm_loss = false;
494
495 static _GLIBCXX_CONSTEXPR
496 char infinity() _GLIBCXX_USE_NOEXCEPT { return char(); }
497
498 static _GLIBCXX_CONSTEXPR char
499 quiet_NaN() _GLIBCXX_USE_NOEXCEPT { return char(); }
500
501 static _GLIBCXX_CONSTEXPR char
502 signaling_NaN() _GLIBCXX_USE_NOEXCEPT { return char(); }
503
504 static _GLIBCXX_CONSTEXPR char
505 denorm_min() _GLIBCXX_USE_NOEXCEPT { return static_cast<char>(0); }
506
507 static _GLIBCXX_USE_CONSTEXPR bool is_iec559 = false;
508 static _GLIBCXX_USE_CONSTEXPR bool is_bounded = true;
509 static _GLIBCXX_USE_CONSTEXPR bool is_modulo = !is_signed;
510
511 static _GLIBCXX_USE_CONSTEXPR bool traps = __glibcxx_integral_traps;
512 static _GLIBCXX_USE_CONSTEXPR bool tinyness_before = false;
513 static _GLIBCXX_USE_CONSTEXPR float_round_style round_style
514 = round_toward_zero;
515 };
516
517 /// numeric_limits<signed char> specialization.
518 template<>
519 struct numeric_limits<signed char>
520 {
521 static _GLIBCXX_USE_CONSTEXPR bool is_specialized = true;
522
523 static _GLIBCXX_CONSTEXPR signed char
524 min() _GLIBCXX_USE_NOEXCEPT { return -__SCHAR_MAX__ - 1; }
525
526 static _GLIBCXX_CONSTEXPR signed char
527 max() _GLIBCXX_USE_NOEXCEPT { return __SCHAR_MAX__; }
528
529#if __cplusplus >= 201103L
530 static constexpr signed char
531 lowest() noexcept { return min(); }
532#endif
533
534 static _GLIBCXX_USE_CONSTEXPR int digits = __glibcxx_digits (signed char);
535 static _GLIBCXX_USE_CONSTEXPR int digits10
536 = __glibcxx_digits10 (signed char);
537#if __cplusplus >= 201103L
538 static constexpr int max_digits10 = 0;
539#endif
540 static _GLIBCXX_USE_CONSTEXPR bool is_signed = true;
541 static _GLIBCXX_USE_CONSTEXPR bool is_integer = true;
542 static _GLIBCXX_USE_CONSTEXPR bool is_exact = true;
543 static _GLIBCXX_USE_CONSTEXPR int radix = 2;
544
545 static _GLIBCXX_CONSTEXPR signed char
546 epsilon() _GLIBCXX_USE_NOEXCEPT { return 0; }
547
548 static _GLIBCXX_CONSTEXPR signed char
549 round_error() _GLIBCXX_USE_NOEXCEPT { return 0; }
550
551 static _GLIBCXX_USE_CONSTEXPR int min_exponent = 0;
552 static _GLIBCXX_USE_CONSTEXPR int min_exponent10 = 0;
553 static _GLIBCXX_USE_CONSTEXPR int max_exponent = 0;
554 static _GLIBCXX_USE_CONSTEXPR int max_exponent10 = 0;
555
556 static _GLIBCXX_USE_CONSTEXPR bool has_infinity = false;
557 static _GLIBCXX_USE_CONSTEXPR bool has_quiet_NaN = false;
558 static _GLIBCXX_USE_CONSTEXPR bool has_signaling_NaN = false;
559 static _GLIBCXX_USE_CONSTEXPR float_denorm_style has_denorm
560 = denorm_absent;
561 static _GLIBCXX_USE_CONSTEXPR bool has_denorm_loss = false;
562
563 static _GLIBCXX_CONSTEXPR signed char
564 infinity() _GLIBCXX_USE_NOEXCEPT { return static_cast<signed char>(0); }
565
566 static _GLIBCXX_CONSTEXPR signed char
567 quiet_NaN() _GLIBCXX_USE_NOEXCEPT { return static_cast<signed char>(0); }
568
569 static _GLIBCXX_CONSTEXPR signed char
570 signaling_NaN() _GLIBCXX_USE_NOEXCEPT
571 { return static_cast<signed char>(0); }
572
573 static _GLIBCXX_CONSTEXPR signed char
574 denorm_min() _GLIBCXX_USE_NOEXCEPT
575 { return static_cast<signed char>(0); }
576
577 static _GLIBCXX_USE_CONSTEXPR bool is_iec559 = false;
578 static _GLIBCXX_USE_CONSTEXPR bool is_bounded = true;
579 static _GLIBCXX_USE_CONSTEXPR bool is_modulo = false;
580
581 static _GLIBCXX_USE_CONSTEXPR bool traps = __glibcxx_integral_traps;
582 static _GLIBCXX_USE_CONSTEXPR bool tinyness_before = false;
583 static _GLIBCXX_USE_CONSTEXPR float_round_style round_style
584 = round_toward_zero;
585 };
586
587 /// numeric_limits<unsigned char> specialization.
588 template<>
589 struct numeric_limits<unsigned char>
590 {
591 static _GLIBCXX_USE_CONSTEXPR bool is_specialized = true;
592
593 static _GLIBCXX_CONSTEXPR unsigned char
594 min() _GLIBCXX_USE_NOEXCEPT { return 0; }
595
596 static _GLIBCXX_CONSTEXPR unsigned char
597 max() _GLIBCXX_USE_NOEXCEPT { return __SCHAR_MAX__ * 2U + 1; }
598
599#if __cplusplus >= 201103L
600 static constexpr unsigned char
601 lowest() noexcept { return min(); }
602#endif
603
604 static _GLIBCXX_USE_CONSTEXPR int digits
605 = __glibcxx_digits (unsigned char);
606 static _GLIBCXX_USE_CONSTEXPR int digits10
607 = __glibcxx_digits10 (unsigned char);
608#if __cplusplus >= 201103L
609 static constexpr int max_digits10 = 0;
610#endif
611 static _GLIBCXX_USE_CONSTEXPR bool is_signed = false;
612 static _GLIBCXX_USE_CONSTEXPR bool is_integer = true;
613 static _GLIBCXX_USE_CONSTEXPR bool is_exact = true;
614 static _GLIBCXX_USE_CONSTEXPR int radix = 2;
615
616 static _GLIBCXX_CONSTEXPR unsigned char
617 epsilon() _GLIBCXX_USE_NOEXCEPT { return 0; }
618
619 static _GLIBCXX_CONSTEXPR unsigned char
620 round_error() _GLIBCXX_USE_NOEXCEPT { return 0; }
621
622 static _GLIBCXX_USE_CONSTEXPR int min_exponent = 0;
623 static _GLIBCXX_USE_CONSTEXPR int min_exponent10 = 0;
624 static _GLIBCXX_USE_CONSTEXPR int max_exponent = 0;
625 static _GLIBCXX_USE_CONSTEXPR int max_exponent10 = 0;
626
627 static _GLIBCXX_USE_CONSTEXPR bool has_infinity = false;
628 static _GLIBCXX_USE_CONSTEXPR bool has_quiet_NaN = false;
629 static _GLIBCXX_USE_CONSTEXPR bool has_signaling_NaN = false;
630 static _GLIBCXX_USE_CONSTEXPR float_denorm_style has_denorm
631 = denorm_absent;
632 static _GLIBCXX_USE_CONSTEXPR bool has_denorm_loss = false;
633
634 static _GLIBCXX_CONSTEXPR unsigned char
635 infinity() _GLIBCXX_USE_NOEXCEPT
636 { return static_cast<unsigned char>(0); }
637
638 static _GLIBCXX_CONSTEXPR unsigned char
639 quiet_NaN() _GLIBCXX_USE_NOEXCEPT
640 { return static_cast<unsigned char>(0); }
641
642 static _GLIBCXX_CONSTEXPR unsigned char
643 signaling_NaN() _GLIBCXX_USE_NOEXCEPT
644 { return static_cast<unsigned char>(0); }
645
646 static _GLIBCXX_CONSTEXPR unsigned char
647 denorm_min() _GLIBCXX_USE_NOEXCEPT
648 { return static_cast<unsigned char>(0); }
649
650 static _GLIBCXX_USE_CONSTEXPR bool is_iec559 = false;
651 static _GLIBCXX_USE_CONSTEXPR bool is_bounded = true;
652 static _GLIBCXX_USE_CONSTEXPR bool is_modulo = true;
653
654 static _GLIBCXX_USE_CONSTEXPR bool traps = __glibcxx_integral_traps;
655 static _GLIBCXX_USE_CONSTEXPR bool tinyness_before = false;
656 static _GLIBCXX_USE_CONSTEXPR float_round_style round_style
657 = round_toward_zero;
658 };
659
660 /// numeric_limits<wchar_t> specialization.
661 template<>
662 struct numeric_limits<wchar_t>
663 {
664 static _GLIBCXX_USE_CONSTEXPR bool is_specialized = true;
665
666 static _GLIBCXX_CONSTEXPR wchar_t
667 min() _GLIBCXX_USE_NOEXCEPT { return __glibcxx_min (wchar_t); }
668
669 static _GLIBCXX_CONSTEXPR wchar_t
670 max() _GLIBCXX_USE_NOEXCEPT { return __glibcxx_max (wchar_t); }
671
672#if __cplusplus >= 201103L
673 static constexpr wchar_t
674 lowest() noexcept { return min(); }
675#endif
676
677 static _GLIBCXX_USE_CONSTEXPR int digits = __glibcxx_digits (wchar_t);
678 static _GLIBCXX_USE_CONSTEXPR int digits10
679 = __glibcxx_digits10 (wchar_t);
680#if __cplusplus >= 201103L
681 static constexpr int max_digits10 = 0;
682#endif
683 static _GLIBCXX_USE_CONSTEXPR bool is_signed = __glibcxx_signed (wchar_t);
684 static _GLIBCXX_USE_CONSTEXPR bool is_integer = true;
685 static _GLIBCXX_USE_CONSTEXPR bool is_exact = true;
686 static _GLIBCXX_USE_CONSTEXPR int radix = 2;
687
688 static _GLIBCXX_CONSTEXPR wchar_t
689 epsilon() _GLIBCXX_USE_NOEXCEPT { return 0; }
690
691 static _GLIBCXX_CONSTEXPR wchar_t
692 round_error() _GLIBCXX_USE_NOEXCEPT { return 0; }
693
694 static _GLIBCXX_USE_CONSTEXPR int min_exponent = 0;
695 static _GLIBCXX_USE_CONSTEXPR int min_exponent10 = 0;
696 static _GLIBCXX_USE_CONSTEXPR int max_exponent = 0;
697 static _GLIBCXX_USE_CONSTEXPR int max_exponent10 = 0;
698
699 static _GLIBCXX_USE_CONSTEXPR bool has_infinity = false;
700 static _GLIBCXX_USE_CONSTEXPR bool has_quiet_NaN = false;
701 static _GLIBCXX_USE_CONSTEXPR bool has_signaling_NaN = false;
702 static _GLIBCXX_USE_CONSTEXPR float_denorm_style has_denorm
703 = denorm_absent;
704 static _GLIBCXX_USE_CONSTEXPR bool has_denorm_loss = false;
705
706 static _GLIBCXX_CONSTEXPR wchar_t
707 infinity() _GLIBCXX_USE_NOEXCEPT { return wchar_t(); }
708
709 static _GLIBCXX_CONSTEXPR wchar_t
710 quiet_NaN() _GLIBCXX_USE_NOEXCEPT { return wchar_t(); }
711
712 static _GLIBCXX_CONSTEXPR wchar_t
713 signaling_NaN() _GLIBCXX_USE_NOEXCEPT { return wchar_t(); }
714
715 static _GLIBCXX_CONSTEXPR wchar_t
716 denorm_min() _GLIBCXX_USE_NOEXCEPT { return wchar_t(); }
717
718 static _GLIBCXX_USE_CONSTEXPR bool is_iec559 = false;
719 static _GLIBCXX_USE_CONSTEXPR bool is_bounded = true;
720 static _GLIBCXX_USE_CONSTEXPR bool is_modulo = !is_signed;
721
722 static _GLIBCXX_USE_CONSTEXPR bool traps = __glibcxx_integral_traps;
723 static _GLIBCXX_USE_CONSTEXPR bool tinyness_before = false;
724 static _GLIBCXX_USE_CONSTEXPR float_round_style round_style
725 = round_toward_zero;
726 };
727
728#if __cplusplus >= 201103L
729 /// numeric_limits<char16_t> specialization.
730 template<>
731 struct numeric_limits<char16_t>
732 {
733 static constexpr bool is_specialized = true;
734
735 static constexpr char16_t
736 min() noexcept { return __glibcxx_min (char16_t); }
737
738 static constexpr char16_t
739 max() noexcept { return __glibcxx_max (char16_t); }
740
741 static constexpr char16_t
742 lowest() noexcept { return min(); }
743
744 static constexpr int digits = __glibcxx_digits (char16_t);
745 static constexpr int digits10 = __glibcxx_digits10 (char16_t);
746 static constexpr int max_digits10 = 0;
747 static constexpr bool is_signed = __glibcxx_signed (char16_t);
748 static constexpr bool is_integer = true;
749 static constexpr bool is_exact = true;
750 static constexpr int radix = 2;
751
752 static constexpr char16_t
753 epsilon() noexcept { return 0; }
754
755 static constexpr char16_t
756 round_error() noexcept { return 0; }
757
758 static constexpr int min_exponent = 0;
759 static constexpr int min_exponent10 = 0;
760 static constexpr int max_exponent = 0;
761 static constexpr int max_exponent10 = 0;
762
763 static constexpr bool has_infinity = false;
764 static constexpr bool has_quiet_NaN = false;
765 static constexpr bool has_signaling_NaN = false;
766 static constexpr float_denorm_style has_denorm = denorm_absent;
767 static constexpr bool has_denorm_loss = false;
768
769 static constexpr char16_t
770 infinity() noexcept { return char16_t(); }
771
772 static constexpr char16_t
773 quiet_NaN() noexcept { return char16_t(); }
774
775 static constexpr char16_t
776 signaling_NaN() noexcept { return char16_t(); }
777
778 static constexpr char16_t
779 denorm_min() noexcept { return char16_t(); }
780
781 static constexpr bool is_iec559 = false;
782 static constexpr bool is_bounded = true;
783 static constexpr bool is_modulo = !is_signed;
784
785 static constexpr bool traps = __glibcxx_integral_traps;
786 static constexpr bool tinyness_before = false;
787 static constexpr float_round_style round_style = round_toward_zero;
788 };
789
790 /// numeric_limits<char32_t> specialization.
791 template<>
792 struct numeric_limits<char32_t>
793 {
794 static constexpr bool is_specialized = true;
795
796 static constexpr char32_t
797 min() noexcept { return __glibcxx_min (char32_t); }
798
799 static constexpr char32_t
800 max() noexcept { return __glibcxx_max (char32_t); }
801
802 static constexpr char32_t
803 lowest() noexcept { return min(); }
804
805 static constexpr int digits = __glibcxx_digits (char32_t);
806 static constexpr int digits10 = __glibcxx_digits10 (char32_t);
807 static constexpr int max_digits10 = 0;
808 static constexpr bool is_signed = __glibcxx_signed (char32_t);
809 static constexpr bool is_integer = true;
810 static constexpr bool is_exact = true;
811 static constexpr int radix = 2;
812
813 static constexpr char32_t
814 epsilon() noexcept { return 0; }
815
816 static constexpr char32_t
817 round_error() noexcept { return 0; }
818
819 static constexpr int min_exponent = 0;
820 static constexpr int min_exponent10 = 0;
821 static constexpr int max_exponent = 0;
822 static constexpr int max_exponent10 = 0;
823
824 static constexpr bool has_infinity = false;
825 static constexpr bool has_quiet_NaN = false;
826 static constexpr bool has_signaling_NaN = false;
827 static constexpr float_denorm_style has_denorm = denorm_absent;
828 static constexpr bool has_denorm_loss = false;
829
830 static constexpr char32_t
831 infinity() noexcept { return char32_t(); }
832
833 static constexpr char32_t
834 quiet_NaN() noexcept { return char32_t(); }
835
836 static constexpr char32_t
837 signaling_NaN() noexcept { return char32_t(); }
838
839 static constexpr char32_t
840 denorm_min() noexcept { return char32_t(); }
841
842 static constexpr bool is_iec559 = false;
843 static constexpr bool is_bounded = true;
844 static constexpr bool is_modulo = !is_signed;
845
846 static constexpr bool traps = __glibcxx_integral_traps;
847 static constexpr bool tinyness_before = false;
848 static constexpr float_round_style round_style = round_toward_zero;
849 };
850#endif
851
852 /// numeric_limits<short> specialization.
853 template<>
854 struct numeric_limits<short>
855 {
856 static _GLIBCXX_USE_CONSTEXPR bool is_specialized = true;
857
858 static _GLIBCXX_CONSTEXPR short
859 min() _GLIBCXX_USE_NOEXCEPT { return -__SHRT_MAX__ - 1; }
860
861 static _GLIBCXX_CONSTEXPR short
862 max() _GLIBCXX_USE_NOEXCEPT { return __SHRT_MAX__; }
863
864#if __cplusplus >= 201103L
865 static constexpr short
866 lowest() noexcept { return min(); }
867#endif
868
869 static _GLIBCXX_USE_CONSTEXPR int digits = __glibcxx_digits (short);
870 static _GLIBCXX_USE_CONSTEXPR int digits10 = __glibcxx_digits10 (short);
871#if __cplusplus >= 201103L
872 static constexpr int max_digits10 = 0;
873#endif
874 static _GLIBCXX_USE_CONSTEXPR bool is_signed = true;
875 static _GLIBCXX_USE_CONSTEXPR bool is_integer = true;
876 static _GLIBCXX_USE_CONSTEXPR bool is_exact = true;
877 static _GLIBCXX_USE_CONSTEXPR int radix = 2;
878
879 static _GLIBCXX_CONSTEXPR short
880 epsilon() _GLIBCXX_USE_NOEXCEPT { return 0; }
881
882 static _GLIBCXX_CONSTEXPR short
883 round_error() _GLIBCXX_USE_NOEXCEPT { return 0; }
884
885 static _GLIBCXX_USE_CONSTEXPR int min_exponent = 0;
886 static _GLIBCXX_USE_CONSTEXPR int min_exponent10 = 0;
887 static _GLIBCXX_USE_CONSTEXPR int max_exponent = 0;
888 static _GLIBCXX_USE_CONSTEXPR int max_exponent10 = 0;
889
890 static _GLIBCXX_USE_CONSTEXPR bool has_infinity = false;
891 static _GLIBCXX_USE_CONSTEXPR bool has_quiet_NaN = false;
892 static _GLIBCXX_USE_CONSTEXPR bool has_signaling_NaN = false;
893 static _GLIBCXX_USE_CONSTEXPR float_denorm_style has_denorm
894 = denorm_absent;
895 static _GLIBCXX_USE_CONSTEXPR bool has_denorm_loss = false;
896
897 static _GLIBCXX_CONSTEXPR short
898 infinity() _GLIBCXX_USE_NOEXCEPT { return short(); }
899
900 static _GLIBCXX_CONSTEXPR short
901 quiet_NaN() _GLIBCXX_USE_NOEXCEPT { return short(); }
902
903 static _GLIBCXX_CONSTEXPR short
904 signaling_NaN() _GLIBCXX_USE_NOEXCEPT { return short(); }
905
906 static _GLIBCXX_CONSTEXPR short
907 denorm_min() _GLIBCXX_USE_NOEXCEPT { return short(); }
908
909 static _GLIBCXX_USE_CONSTEXPR bool is_iec559 = false;
910 static _GLIBCXX_USE_CONSTEXPR bool is_bounded = true;
911 static _GLIBCXX_USE_CONSTEXPR bool is_modulo = false;
912
913 static _GLIBCXX_USE_CONSTEXPR bool traps = __glibcxx_integral_traps;
914 static _GLIBCXX_USE_CONSTEXPR bool tinyness_before = false;
915 static _GLIBCXX_USE_CONSTEXPR float_round_style round_style
916 = round_toward_zero;
917 };
918
919 /// numeric_limits<unsigned short> specialization.
920 template<>
921 struct numeric_limits<unsigned short>
922 {
923 static _GLIBCXX_USE_CONSTEXPR bool is_specialized = true;
924
925 static _GLIBCXX_CONSTEXPR unsigned short
926 min() _GLIBCXX_USE_NOEXCEPT { return 0; }
927
928 static _GLIBCXX_CONSTEXPR unsigned short
929 max() _GLIBCXX_USE_NOEXCEPT { return __SHRT_MAX__ * 2U + 1; }
930
931#if __cplusplus >= 201103L
932 static constexpr unsigned short
933 lowest() noexcept { return min(); }
934#endif
935
936 static _GLIBCXX_USE_CONSTEXPR int digits
937 = __glibcxx_digits (unsigned short);
938 static _GLIBCXX_USE_CONSTEXPR int digits10
939 = __glibcxx_digits10 (unsigned short);
940#if __cplusplus >= 201103L
941 static constexpr int max_digits10 = 0;
942#endif
943 static _GLIBCXX_USE_CONSTEXPR bool is_signed = false;
944 static _GLIBCXX_USE_CONSTEXPR bool is_integer = true;
945 static _GLIBCXX_USE_CONSTEXPR bool is_exact = true;
946 static _GLIBCXX_USE_CONSTEXPR int radix = 2;
947
948 static _GLIBCXX_CONSTEXPR unsigned short
949 epsilon() _GLIBCXX_USE_NOEXCEPT { return 0; }
950
951 static _GLIBCXX_CONSTEXPR unsigned short
952 round_error() _GLIBCXX_USE_NOEXCEPT { return 0; }
953
954 static _GLIBCXX_USE_CONSTEXPR int min_exponent = 0;
955 static _GLIBCXX_USE_CONSTEXPR int min_exponent10 = 0;
956 static _GLIBCXX_USE_CONSTEXPR int max_exponent = 0;
957 static _GLIBCXX_USE_CONSTEXPR int max_exponent10 = 0;
958
959 static _GLIBCXX_USE_CONSTEXPR bool has_infinity = false;
960 static _GLIBCXX_USE_CONSTEXPR bool has_quiet_NaN = false;
961 static _GLIBCXX_USE_CONSTEXPR bool has_signaling_NaN = false;
962 static _GLIBCXX_USE_CONSTEXPR float_denorm_style has_denorm
963 = denorm_absent;
964 static _GLIBCXX_USE_CONSTEXPR bool has_denorm_loss = false;
965
966 static _GLIBCXX_CONSTEXPR unsigned short
967 infinity() _GLIBCXX_USE_NOEXCEPT
968 { return static_cast<unsigned short>(0); }
969
970 static _GLIBCXX_CONSTEXPR unsigned short
971 quiet_NaN() _GLIBCXX_USE_NOEXCEPT
972 { return static_cast<unsigned short>(0); }
973
974 static _GLIBCXX_CONSTEXPR unsigned short
975 signaling_NaN() _GLIBCXX_USE_NOEXCEPT
976 { return static_cast<unsigned short>(0); }
977
978 static _GLIBCXX_CONSTEXPR unsigned short
979 denorm_min() _GLIBCXX_USE_NOEXCEPT
980 { return static_cast<unsigned short>(0); }
981
982 static _GLIBCXX_USE_CONSTEXPR bool is_iec559 = false;
983 static _GLIBCXX_USE_CONSTEXPR bool is_bounded = true;
984 static _GLIBCXX_USE_CONSTEXPR bool is_modulo = true;
985
986 static _GLIBCXX_USE_CONSTEXPR bool traps = __glibcxx_integral_traps;
987 static _GLIBCXX_USE_CONSTEXPR bool tinyness_before = false;
988 static _GLIBCXX_USE_CONSTEXPR float_round_style round_style
989 = round_toward_zero;
990 };
991
992 /// numeric_limits<int> specialization.
993 template<>
994 struct numeric_limits<int>
995 {
996 static _GLIBCXX_USE_CONSTEXPR bool is_specialized = true;
997
998 static _GLIBCXX_CONSTEXPR int
999 min() _GLIBCXX_USE_NOEXCEPT { return -__INT_MAX__ - 1; }
1000
1001 static _GLIBCXX_CONSTEXPR int
1002 max() _GLIBCXX_USE_NOEXCEPT { return __INT_MAX__; }
1003
1004#if __cplusplus >= 201103L
1005 static constexpr int
1006 lowest() noexcept { return min(); }
1007#endif
1008
1009 static _GLIBCXX_USE_CONSTEXPR int digits = __glibcxx_digits (int);
1010 static _GLIBCXX_USE_CONSTEXPR int digits10 = __glibcxx_digits10 (int);
1011#if __cplusplus >= 201103L
1012 static constexpr int max_digits10 = 0;
1013#endif
1014 static _GLIBCXX_USE_CONSTEXPR bool is_signed = true;
1015 static _GLIBCXX_USE_CONSTEXPR bool is_integer = true;
1016 static _GLIBCXX_USE_CONSTEXPR bool is_exact = true;
1017 static _GLIBCXX_USE_CONSTEXPR int radix = 2;
1018
1019 static _GLIBCXX_CONSTEXPR int
1020 epsilon() _GLIBCXX_USE_NOEXCEPT { return 0; }
1021
1022 static _GLIBCXX_CONSTEXPR int
1023 round_error() _GLIBCXX_USE_NOEXCEPT { return 0; }
1024
1025 static _GLIBCXX_USE_CONSTEXPR int min_exponent = 0;
1026 static _GLIBCXX_USE_CONSTEXPR int min_exponent10 = 0;
1027 static _GLIBCXX_USE_CONSTEXPR int max_exponent = 0;
1028 static _GLIBCXX_USE_CONSTEXPR int max_exponent10 = 0;
1029
1030 static _GLIBCXX_USE_CONSTEXPR bool has_infinity = false;
1031 static _GLIBCXX_USE_CONSTEXPR bool has_quiet_NaN = false;
1032 static _GLIBCXX_USE_CONSTEXPR bool has_signaling_NaN = false;
1033 static _GLIBCXX_USE_CONSTEXPR float_denorm_style has_denorm
1034 = denorm_absent;
1035 static _GLIBCXX_USE_CONSTEXPR bool has_denorm_loss = false;
1036
1037 static _GLIBCXX_CONSTEXPR int
1038 infinity() _GLIBCXX_USE_NOEXCEPT { return static_cast<int>(0); }
1039
1040 static _GLIBCXX_CONSTEXPR int
1041 quiet_NaN() _GLIBCXX_USE_NOEXCEPT { return static_cast<int>(0); }
1042
1043 static _GLIBCXX_CONSTEXPR int
1044 signaling_NaN() _GLIBCXX_USE_NOEXCEPT { return static_cast<int>(0); }
1045
1046 static _GLIBCXX_CONSTEXPR int
1047 denorm_min() _GLIBCXX_USE_NOEXCEPT { return static_cast<int>(0); }
1048
1049 static _GLIBCXX_USE_CONSTEXPR bool is_iec559 = false;
1050 static _GLIBCXX_USE_CONSTEXPR bool is_bounded = true;
1051 static _GLIBCXX_USE_CONSTEXPR bool is_modulo = false;
1052
1053 static _GLIBCXX_USE_CONSTEXPR bool traps = __glibcxx_integral_traps;
1054 static _GLIBCXX_USE_CONSTEXPR bool tinyness_before = false;
1055 static _GLIBCXX_USE_CONSTEXPR float_round_style round_style
1056 = round_toward_zero;
1057 };
1058
1059 /// numeric_limits<unsigned int> specialization.
1060 template<>
1061 struct numeric_limits<unsigned int>
1062 {
1063 static _GLIBCXX_USE_CONSTEXPR bool is_specialized = true;
1064
1065 static _GLIBCXX_CONSTEXPR unsigned int
1066 min() _GLIBCXX_USE_NOEXCEPT { return 0; }
1067
1068 static _GLIBCXX_CONSTEXPR unsigned int
1069 max() _GLIBCXX_USE_NOEXCEPT { return __INT_MAX__ * 2U + 1; }
1070
1071#if __cplusplus >= 201103L
1072 static constexpr unsigned int
1073 lowest() noexcept { return min(); }
1074#endif
1075
1076 static _GLIBCXX_USE_CONSTEXPR int digits
1077 = __glibcxx_digits (unsigned int);
1078 static _GLIBCXX_USE_CONSTEXPR int digits10
1079 = __glibcxx_digits10 (unsigned int);
1080#if __cplusplus >= 201103L
1081 static constexpr int max_digits10 = 0;
1082#endif
1083 static _GLIBCXX_USE_CONSTEXPR bool is_signed = false;
1084 static _GLIBCXX_USE_CONSTEXPR bool is_integer = true;
1085 static _GLIBCXX_USE_CONSTEXPR bool is_exact = true;
1086 static _GLIBCXX_USE_CONSTEXPR int radix = 2;
1087
1088 static _GLIBCXX_CONSTEXPR unsigned int
1089 epsilon() _GLIBCXX_USE_NOEXCEPT { return 0; }
1090
1091 static _GLIBCXX_CONSTEXPR unsigned int
1092 round_error() _GLIBCXX_USE_NOEXCEPT { return 0; }
1093
1094 static _GLIBCXX_USE_CONSTEXPR int min_exponent = 0;
1095 static _GLIBCXX_USE_CONSTEXPR int min_exponent10 = 0;
1096 static _GLIBCXX_USE_CONSTEXPR int max_exponent = 0;
1097 static _GLIBCXX_USE_CONSTEXPR int max_exponent10 = 0;
1098
1099 static _GLIBCXX_USE_CONSTEXPR bool has_infinity = false;
1100 static _GLIBCXX_USE_CONSTEXPR bool has_quiet_NaN = false;
1101 static _GLIBCXX_USE_CONSTEXPR bool has_signaling_NaN = false;
1102 static _GLIBCXX_USE_CONSTEXPR float_denorm_style has_denorm
1103 = denorm_absent;
1104 static _GLIBCXX_USE_CONSTEXPR bool has_denorm_loss = false;
1105
1106 static _GLIBCXX_CONSTEXPR unsigned int
1107 infinity() _GLIBCXX_USE_NOEXCEPT { return static_cast<unsigned int>(0); }
1108
1109 static _GLIBCXX_CONSTEXPR unsigned int
1110 quiet_NaN() _GLIBCXX_USE_NOEXCEPT
1111 { return static_cast<unsigned int>(0); }
1112
1113 static _GLIBCXX_CONSTEXPR unsigned int
1114 signaling_NaN() _GLIBCXX_USE_NOEXCEPT
1115 { return static_cast<unsigned int>(0); }
1116
1117 static _GLIBCXX_CONSTEXPR unsigned int
1118 denorm_min() _GLIBCXX_USE_NOEXCEPT
1119 { return static_cast<unsigned int>(0); }
1120
1121 static _GLIBCXX_USE_CONSTEXPR bool is_iec559 = false;
1122 static _GLIBCXX_USE_CONSTEXPR bool is_bounded = true;
1123 static _GLIBCXX_USE_CONSTEXPR bool is_modulo = true;
1124
1125 static _GLIBCXX_USE_CONSTEXPR bool traps = __glibcxx_integral_traps;
1126 static _GLIBCXX_USE_CONSTEXPR bool tinyness_before = false;
1127 static _GLIBCXX_USE_CONSTEXPR float_round_style round_style
1128 = round_toward_zero;
1129 };
1130
1131 /// numeric_limits<long> specialization.
1132 template<>
1133 struct numeric_limits<long>
1134 {
1135 static _GLIBCXX_USE_CONSTEXPR bool is_specialized = true;
1136
1137 static _GLIBCXX_CONSTEXPR long
1138 min() _GLIBCXX_USE_NOEXCEPT { return -__LONG_MAX__ - 1; }
1139
1140 static _GLIBCXX_CONSTEXPR long
1141 max() _GLIBCXX_USE_NOEXCEPT { return __LONG_MAX__; }
1142
1143#if __cplusplus >= 201103L
1144 static constexpr long
1145 lowest() noexcept { return min(); }
1146#endif
1147
1148 static _GLIBCXX_USE_CONSTEXPR int digits = __glibcxx_digits (long);
1149 static _GLIBCXX_USE_CONSTEXPR int digits10 = __glibcxx_digits10 (long);
1150#if __cplusplus >= 201103L
1151 static constexpr int max_digits10 = 0;
1152#endif
1153 static _GLIBCXX_USE_CONSTEXPR bool is_signed = true;
1154 static _GLIBCXX_USE_CONSTEXPR bool is_integer = true;
1155 static _GLIBCXX_USE_CONSTEXPR bool is_exact = true;
1156 static _GLIBCXX_USE_CONSTEXPR int radix = 2;
1157
1158 static _GLIBCXX_CONSTEXPR long
1159 epsilon() _GLIBCXX_USE_NOEXCEPT { return 0; }
1160
1161 static _GLIBCXX_CONSTEXPR long
1162 round_error() _GLIBCXX_USE_NOEXCEPT { return 0; }
1163
1164 static _GLIBCXX_USE_CONSTEXPR int min_exponent = 0;
1165 static _GLIBCXX_USE_CONSTEXPR int min_exponent10 = 0;
1166 static _GLIBCXX_USE_CONSTEXPR int max_exponent = 0;
1167 static _GLIBCXX_USE_CONSTEXPR int max_exponent10 = 0;
1168
1169 static _GLIBCXX_USE_CONSTEXPR bool has_infinity = false;
1170 static _GLIBCXX_USE_CONSTEXPR bool has_quiet_NaN = false;
1171 static _GLIBCXX_USE_CONSTEXPR bool has_signaling_NaN = false;
1172 static _GLIBCXX_USE_CONSTEXPR float_denorm_style has_denorm
1173 = denorm_absent;
1174 static _GLIBCXX_USE_CONSTEXPR bool has_denorm_loss = false;
1175
1176 static _GLIBCXX_CONSTEXPR long
1177 infinity() _GLIBCXX_USE_NOEXCEPT { return static_cast<long>(0); }
1178
1179 static _GLIBCXX_CONSTEXPR long
1180 quiet_NaN() _GLIBCXX_USE_NOEXCEPT { return static_cast<long>(0); }
1181
1182 static _GLIBCXX_CONSTEXPR long
1183 signaling_NaN() _GLIBCXX_USE_NOEXCEPT { return static_cast<long>(0); }
1184
1185 static _GLIBCXX_CONSTEXPR long
1186 denorm_min() _GLIBCXX_USE_NOEXCEPT { return static_cast<long>(0); }
1187
1188 static _GLIBCXX_USE_CONSTEXPR bool is_iec559 = false;
1189 static _GLIBCXX_USE_CONSTEXPR bool is_bounded = true;
1190 static _GLIBCXX_USE_CONSTEXPR bool is_modulo = false;
1191
1192 static _GLIBCXX_USE_CONSTEXPR bool traps = __glibcxx_integral_traps;
1193 static _GLIBCXX_USE_CONSTEXPR bool tinyness_before = false;
1194 static _GLIBCXX_USE_CONSTEXPR float_round_style round_style
1195 = round_toward_zero;
1196 };
1197
1198 /// numeric_limits<unsigned long> specialization.
1199 template<>
1200 struct numeric_limits<unsigned long>
1201 {
1202 static _GLIBCXX_USE_CONSTEXPR bool is_specialized = true;
1203
1204 static _GLIBCXX_CONSTEXPR unsigned long
1205 min() _GLIBCXX_USE_NOEXCEPT { return 0; }
1206
1207 static _GLIBCXX_CONSTEXPR unsigned long
1208 max() _GLIBCXX_USE_NOEXCEPT { return __LONG_MAX__ * 2UL + 1; }
1209
1210#if __cplusplus >= 201103L
1211 static constexpr unsigned long
1212 lowest() noexcept { return min(); }
1213#endif
1214
1215 static _GLIBCXX_USE_CONSTEXPR int digits
1216 = __glibcxx_digits (unsigned long);
1217 static _GLIBCXX_USE_CONSTEXPR int digits10
1218 = __glibcxx_digits10 (unsigned long);
1219#if __cplusplus >= 201103L
1220 static constexpr int max_digits10 = 0;
1221#endif
1222 static _GLIBCXX_USE_CONSTEXPR bool is_signed = false;
1223 static _GLIBCXX_USE_CONSTEXPR bool is_integer = true;
1224 static _GLIBCXX_USE_CONSTEXPR bool is_exact = true;
1225 static _GLIBCXX_USE_CONSTEXPR int radix = 2;
1226
1227 static _GLIBCXX_CONSTEXPR unsigned long
1228 epsilon() _GLIBCXX_USE_NOEXCEPT { return 0; }
1229
1230 static _GLIBCXX_CONSTEXPR unsigned long
1231 round_error() _GLIBCXX_USE_NOEXCEPT { return 0; }
1232
1233 static _GLIBCXX_USE_CONSTEXPR int min_exponent = 0;
1234 static _GLIBCXX_USE_CONSTEXPR int min_exponent10 = 0;
1235 static _GLIBCXX_USE_CONSTEXPR int max_exponent = 0;
1236 static _GLIBCXX_USE_CONSTEXPR int max_exponent10 = 0;
1237
1238 static _GLIBCXX_USE_CONSTEXPR bool has_infinity = false;
1239 static _GLIBCXX_USE_CONSTEXPR bool has_quiet_NaN = false;
1240 static _GLIBCXX_USE_CONSTEXPR bool has_signaling_NaN = false;
1241 static _GLIBCXX_USE_CONSTEXPR float_denorm_style has_denorm
1242 = denorm_absent;
1243 static _GLIBCXX_USE_CONSTEXPR bool has_denorm_loss = false;
1244
1245 static _GLIBCXX_CONSTEXPR unsigned long
1246 infinity() _GLIBCXX_USE_NOEXCEPT
1247 { return static_cast<unsigned long>(0); }
1248
1249 static _GLIBCXX_CONSTEXPR unsigned long
1250 quiet_NaN() _GLIBCXX_USE_NOEXCEPT
1251 { return static_cast<unsigned long>(0); }
1252
1253 static _GLIBCXX_CONSTEXPR unsigned long
1254 signaling_NaN() _GLIBCXX_USE_NOEXCEPT
1255 { return static_cast<unsigned long>(0); }
1256
1257 static _GLIBCXX_CONSTEXPR unsigned long
1258 denorm_min() _GLIBCXX_USE_NOEXCEPT
1259 { return static_cast<unsigned long>(0); }
1260
1261 static _GLIBCXX_USE_CONSTEXPR bool is_iec559 = false;
1262 static _GLIBCXX_USE_CONSTEXPR bool is_bounded = true;
1263 static _GLIBCXX_USE_CONSTEXPR bool is_modulo = true;
1264
1265 static _GLIBCXX_USE_CONSTEXPR bool traps = __glibcxx_integral_traps;
1266 static _GLIBCXX_USE_CONSTEXPR bool tinyness_before = false;
1267 static _GLIBCXX_USE_CONSTEXPR float_round_style round_style
1268 = round_toward_zero;
1269 };
1270
1271 /// numeric_limits<long long> specialization.
1272 template<>
1273 struct numeric_limits<long long>
1274 {
1275 static _GLIBCXX_USE_CONSTEXPR bool is_specialized = true;
1276
1277 static _GLIBCXX_CONSTEXPR long long
1278 min() _GLIBCXX_USE_NOEXCEPT { return -__LONG_LONG_MAX__ - 1; }
1279
1280 static _GLIBCXX_CONSTEXPR long long
1281 max() _GLIBCXX_USE_NOEXCEPT { return __LONG_LONG_MAX__; }
1282
1283#if __cplusplus >= 201103L
1284 static constexpr long long
1285 lowest() noexcept { return min(); }
1286#endif
1287
1288 static _GLIBCXX_USE_CONSTEXPR int digits
1289 = __glibcxx_digits (long long);
1290 static _GLIBCXX_USE_CONSTEXPR int digits10
1291 = __glibcxx_digits10 (long long);
1292#if __cplusplus >= 201103L
1293 static constexpr int max_digits10 = 0;
1294#endif
1295 static _GLIBCXX_USE_CONSTEXPR bool is_signed = true;
1296 static _GLIBCXX_USE_CONSTEXPR bool is_integer = true;
1297 static _GLIBCXX_USE_CONSTEXPR bool is_exact = true;
1298 static _GLIBCXX_USE_CONSTEXPR int radix = 2;
1299
1300 static _GLIBCXX_CONSTEXPR long long
1301 epsilon() _GLIBCXX_USE_NOEXCEPT { return 0; }
1302
1303 static _GLIBCXX_CONSTEXPR long long
1304 round_error() _GLIBCXX_USE_NOEXCEPT { return 0; }
1305
1306 static _GLIBCXX_USE_CONSTEXPR int min_exponent = 0;
1307 static _GLIBCXX_USE_CONSTEXPR int min_exponent10 = 0;
1308 static _GLIBCXX_USE_CONSTEXPR int max_exponent = 0;
1309 static _GLIBCXX_USE_CONSTEXPR int max_exponent10 = 0;
1310
1311 static _GLIBCXX_USE_CONSTEXPR bool has_infinity = false;
1312 static _GLIBCXX_USE_CONSTEXPR bool has_quiet_NaN = false;
1313 static _GLIBCXX_USE_CONSTEXPR bool has_signaling_NaN = false;
1314 static _GLIBCXX_USE_CONSTEXPR float_denorm_style has_denorm
1315 = denorm_absent;
1316 static _GLIBCXX_USE_CONSTEXPR bool has_denorm_loss = false;
1317
1318 static _GLIBCXX_CONSTEXPR long long
1319 infinity() _GLIBCXX_USE_NOEXCEPT { return static_cast<long long>(0); }
1320
1321 static _GLIBCXX_CONSTEXPR long long
1322 quiet_NaN() _GLIBCXX_USE_NOEXCEPT { return static_cast<long long>(0); }
1323
1324 static _GLIBCXX_CONSTEXPR long long
1325 signaling_NaN() _GLIBCXX_USE_NOEXCEPT
1326 { return static_cast<long long>(0); }
1327
1328 static _GLIBCXX_CONSTEXPR long long
1329 denorm_min() _GLIBCXX_USE_NOEXCEPT { return static_cast<long long>(0); }
1330
1331 static _GLIBCXX_USE_CONSTEXPR bool is_iec559 = false;
1332 static _GLIBCXX_USE_CONSTEXPR bool is_bounded = true;
1333 static _GLIBCXX_USE_CONSTEXPR bool is_modulo = false;
1334
1335 static _GLIBCXX_USE_CONSTEXPR bool traps = __glibcxx_integral_traps;
1336 static _GLIBCXX_USE_CONSTEXPR bool tinyness_before = false;
1337 static _GLIBCXX_USE_CONSTEXPR float_round_style round_style
1338 = round_toward_zero;
1339 };
1340
1341 /// numeric_limits<unsigned long long> specialization.
1342 template<>
1343 struct numeric_limits<unsigned long long>
1344 {
1345 static _GLIBCXX_USE_CONSTEXPR bool is_specialized = true;
1346
1347 static _GLIBCXX_CONSTEXPR unsigned long long
1348 min() _GLIBCXX_USE_NOEXCEPT { return 0; }
1349
1350 static _GLIBCXX_CONSTEXPR unsigned long long
1351 max() _GLIBCXX_USE_NOEXCEPT { return __LONG_LONG_MAX__ * 2ULL + 1; }
1352
1353#if __cplusplus >= 201103L
1354 static constexpr unsigned long long
1355 lowest() noexcept { return min(); }
1356#endif
1357
1358 static _GLIBCXX_USE_CONSTEXPR int digits
1359 = __glibcxx_digits (unsigned long long);
1360 static _GLIBCXX_USE_CONSTEXPR int digits10
1361 = __glibcxx_digits10 (unsigned long long);
1362#if __cplusplus >= 201103L
1363 static constexpr int max_digits10 = 0;
1364#endif
1365 static _GLIBCXX_USE_CONSTEXPR bool is_signed = false;
1366 static _GLIBCXX_USE_CONSTEXPR bool is_integer = true;
1367 static _GLIBCXX_USE_CONSTEXPR bool is_exact = true;
1368 static _GLIBCXX_USE_CONSTEXPR int radix = 2;
1369
1370 static _GLIBCXX_CONSTEXPR unsigned long long
1371 epsilon() _GLIBCXX_USE_NOEXCEPT { return 0; }
1372
1373 static _GLIBCXX_CONSTEXPR unsigned long long
1374 round_error() _GLIBCXX_USE_NOEXCEPT { return 0; }
1375
1376 static _GLIBCXX_USE_CONSTEXPR int min_exponent = 0;
1377 static _GLIBCXX_USE_CONSTEXPR int min_exponent10 = 0;
1378 static _GLIBCXX_USE_CONSTEXPR int max_exponent = 0;
1379 static _GLIBCXX_USE_CONSTEXPR int max_exponent10 = 0;
1380
1381 static _GLIBCXX_USE_CONSTEXPR bool has_infinity = false;
1382 static _GLIBCXX_USE_CONSTEXPR bool has_quiet_NaN = false;
1383 static _GLIBCXX_USE_CONSTEXPR bool has_signaling_NaN = false;
1384 static _GLIBCXX_USE_CONSTEXPR float_denorm_style has_denorm
1385 = denorm_absent;
1386 static _GLIBCXX_USE_CONSTEXPR bool has_denorm_loss = false;
1387
1388 static _GLIBCXX_CONSTEXPR unsigned long long
1389 infinity() _GLIBCXX_USE_NOEXCEPT
1390 { return static_cast<unsigned long long>(0); }
1391
1392 static _GLIBCXX_CONSTEXPR unsigned long long
1393 quiet_NaN() _GLIBCXX_USE_NOEXCEPT
1394 { return static_cast<unsigned long long>(0); }
1395
1396 static _GLIBCXX_CONSTEXPR unsigned long long
1397 signaling_NaN() _GLIBCXX_USE_NOEXCEPT
1398 { return static_cast<unsigned long long>(0); }
1399
1400 static _GLIBCXX_CONSTEXPR unsigned long long
1401 denorm_min() _GLIBCXX_USE_NOEXCEPT
1402 { return static_cast<unsigned long long>(0); }
1403
1404 static _GLIBCXX_USE_CONSTEXPR bool is_iec559 = false;
1405 static _GLIBCXX_USE_CONSTEXPR bool is_bounded = true;
1406 static _GLIBCXX_USE_CONSTEXPR bool is_modulo = true;
1407
1408 static _GLIBCXX_USE_CONSTEXPR bool traps = __glibcxx_integral_traps;
1409 static _GLIBCXX_USE_CONSTEXPR bool tinyness_before = false;
1410 static _GLIBCXX_USE_CONSTEXPR float_round_style round_style
1411 = round_toward_zero;
1412 };
1413
1414#if !defined(__STRICT_ANSI__)
1415
1416#define __INT_N(TYPE, BITSIZE, EXT, UEXT) \
1417 template<> \
1418 struct numeric_limits<TYPE> \
1419 { \
1420 static _GLIBCXX_USE_CONSTEXPR bool is_specialized = true; \
1421 \
1422 static _GLIBCXX_CONSTEXPR TYPE \
1423 min() _GLIBCXX_USE_NOEXCEPT { return __glibcxx_min_b (TYPE, BITSIZE); } \
1424 \
1425 static _GLIBCXX_CONSTEXPR TYPE \
1426 max() _GLIBCXX_USE_NOEXCEPT { return __glibcxx_max_b (TYPE, BITSIZE); } \
1427 \
1428 static _GLIBCXX_USE_CONSTEXPR int digits \
1429 = BITSIZE - 1; \
1430 static _GLIBCXX_USE_CONSTEXPR int digits10 \
1431 = (BITSIZE - 1) * 643L / 2136; \
1432 \
1433 static _GLIBCXX_USE_CONSTEXPR bool is_signed = true; \
1434 static _GLIBCXX_USE_CONSTEXPR bool is_integer = true; \
1435 static _GLIBCXX_USE_CONSTEXPR bool is_exact = true; \
1436 static _GLIBCXX_USE_CONSTEXPR int radix = 2; \
1437 \
1438 static _GLIBCXX_CONSTEXPR TYPE \
1439 epsilon() _GLIBCXX_USE_NOEXCEPT { return 0; } \
1440 \
1441 static _GLIBCXX_CONSTEXPR TYPE \
1442 round_error() _GLIBCXX_USE_NOEXCEPT { return 0; } \
1443 \
1444 EXT \
1445 \
1446 static _GLIBCXX_USE_CONSTEXPR int min_exponent = 0; \
1447 static _GLIBCXX_USE_CONSTEXPR int min_exponent10 = 0; \
1448 static _GLIBCXX_USE_CONSTEXPR int max_exponent = 0; \
1449 static _GLIBCXX_USE_CONSTEXPR int max_exponent10 = 0; \
1450 \
1451 static _GLIBCXX_USE_CONSTEXPR bool has_infinity = false; \
1452 static _GLIBCXX_USE_CONSTEXPR bool has_quiet_NaN = false; \
1453 static _GLIBCXX_USE_CONSTEXPR bool has_signaling_NaN = false; \
1454 static _GLIBCXX_USE_CONSTEXPR float_denorm_style has_denorm \
1455 = denorm_absent; \
1456 static _GLIBCXX_USE_CONSTEXPR bool has_denorm_loss = false; \
1457 \
1458 static _GLIBCXX_CONSTEXPR TYPE \
1459 infinity() _GLIBCXX_USE_NOEXCEPT \
1460 { return static_cast<TYPE>(0); } \
1461 \
1462 static _GLIBCXX_CONSTEXPR TYPE \
1463 quiet_NaN() _GLIBCXX_USE_NOEXCEPT \
1464 { return static_cast<TYPE>(0); } \
1465 \
1466 static _GLIBCXX_CONSTEXPR TYPE \
1467 signaling_NaN() _GLIBCXX_USE_NOEXCEPT \
1468 { return static_cast<TYPE>(0); } \
1469 \
1470 static _GLIBCXX_CONSTEXPR TYPE \
1471 denorm_min() _GLIBCXX_USE_NOEXCEPT \
1472 { return static_cast<TYPE>(0); } \
1473 \
1474 static _GLIBCXX_USE_CONSTEXPR bool is_iec559 = false; \
1475 static _GLIBCXX_USE_CONSTEXPR bool is_bounded = true; \
1476 static _GLIBCXX_USE_CONSTEXPR bool is_modulo = false; \
1477 \
1478 static _GLIBCXX_USE_CONSTEXPR bool traps \
1479 = __glibcxx_integral_traps; \
1480 static _GLIBCXX_USE_CONSTEXPR bool tinyness_before = false; \
1481 static _GLIBCXX_USE_CONSTEXPR float_round_style round_style \
1482 = round_toward_zero; \
1483 }; \
1484 \
1485 template<> \
1486 struct numeric_limits<unsigned TYPE> \
1487 { \
1488 static _GLIBCXX_USE_CONSTEXPR bool is_specialized = true; \
1489 \
1490 static _GLIBCXX_CONSTEXPR unsigned TYPE \
1491 min() _GLIBCXX_USE_NOEXCEPT { return 0; } \
1492 \
1493 static _GLIBCXX_CONSTEXPR unsigned TYPE \
1494 max() _GLIBCXX_USE_NOEXCEPT \
1495 { return __glibcxx_max_b (unsigned TYPE, BITSIZE); } \
1496 \
1497 UEXT \
1498 \
1499 static _GLIBCXX_USE_CONSTEXPR int digits \
1500 = BITSIZE; \
1501 static _GLIBCXX_USE_CONSTEXPR int digits10 \
1502 = BITSIZE * 643L / 2136; \
1503 static _GLIBCXX_USE_CONSTEXPR bool is_signed = false; \
1504 static _GLIBCXX_USE_CONSTEXPR bool is_integer = true; \
1505 static _GLIBCXX_USE_CONSTEXPR bool is_exact = true; \
1506 static _GLIBCXX_USE_CONSTEXPR int radix = 2; \
1507 \
1508 static _GLIBCXX_CONSTEXPR unsigned TYPE \
1509 epsilon() _GLIBCXX_USE_NOEXCEPT { return 0; } \
1510 \
1511 static _GLIBCXX_CONSTEXPR unsigned TYPE \
1512 round_error() _GLIBCXX_USE_NOEXCEPT { return 0; } \
1513 \
1514 static _GLIBCXX_USE_CONSTEXPR int min_exponent = 0; \
1515 static _GLIBCXX_USE_CONSTEXPR int min_exponent10 = 0; \
1516 static _GLIBCXX_USE_CONSTEXPR int max_exponent = 0; \
1517 static _GLIBCXX_USE_CONSTEXPR int max_exponent10 = 0; \
1518 \
1519 static _GLIBCXX_USE_CONSTEXPR bool has_infinity = false; \
1520 static _GLIBCXX_USE_CONSTEXPR bool has_quiet_NaN = false; \
1521 static _GLIBCXX_USE_CONSTEXPR bool has_signaling_NaN = false; \
1522 static _GLIBCXX_USE_CONSTEXPR float_denorm_style has_denorm \
1523 = denorm_absent; \
1524 static _GLIBCXX_USE_CONSTEXPR bool has_denorm_loss = false; \
1525 \
1526 static _GLIBCXX_CONSTEXPR unsigned TYPE \
1527 infinity() _GLIBCXX_USE_NOEXCEPT \
1528 { return static_cast<unsigned TYPE>(0); } \
1529 \
1530 static _GLIBCXX_CONSTEXPR unsigned TYPE \
1531 quiet_NaN() _GLIBCXX_USE_NOEXCEPT \
1532 { return static_cast<unsigned TYPE>(0); } \
1533 \
1534 static _GLIBCXX_CONSTEXPR unsigned TYPE \
1535 signaling_NaN() _GLIBCXX_USE_NOEXCEPT \
1536 { return static_cast<unsigned TYPE>(0); } \
1537 \
1538 static _GLIBCXX_CONSTEXPR unsigned TYPE \
1539 denorm_min() _GLIBCXX_USE_NOEXCEPT \
1540 { return static_cast<unsigned TYPE>(0); } \
1541 \
1542 static _GLIBCXX_USE_CONSTEXPR bool is_iec559 = false; \
1543 static _GLIBCXX_USE_CONSTEXPR bool is_bounded = true; \
1544 static _GLIBCXX_USE_CONSTEXPR bool is_modulo = true; \
1545 \
1546 static _GLIBCXX_USE_CONSTEXPR bool traps = __glibcxx_integral_traps; \
1547 static _GLIBCXX_USE_CONSTEXPR bool tinyness_before = false; \
1548 static _GLIBCXX_USE_CONSTEXPR float_round_style round_style \
1549 = round_toward_zero; \
1550 };
1551
1552#if __cplusplus >= 201103L
1553
1554#define __INT_N_201103(TYPE) \
1555 static constexpr TYPE \
1556 lowest() noexcept { return min(); } \
1557 static constexpr int max_digits10 = 0;
1558
1559#define __INT_N_U201103(TYPE) \
1560 static constexpr unsigned TYPE \
1561 lowest() noexcept { return min(); } \
1562 static constexpr int max_digits10 = 0;
1563
1564#else
1565#define __INT_N_201103(TYPE)
1566#define __INT_N_U201103(TYPE)
1567#endif
1568
1569#ifdef __GLIBCXX_TYPE_INT_N_0
1570 __INT_N(__GLIBCXX_TYPE_INT_N_0, __GLIBCXX_BITSIZE_INT_N_0,
1571 __INT_N_201103 (__GLIBCXX_TYPE_INT_N_0), __INT_N_U201103 (__GLIBCXX_TYPE_INT_N_0))
1572#endif
1573#ifdef __GLIBCXX_TYPE_INT_N_1
1574 __INT_N (__GLIBCXX_TYPE_INT_N_1, __GLIBCXX_BITSIZE_INT_N_1,
1575 __INT_N_201103 (__GLIBCXX_TYPE_INT_N_1), __INT_N_U201103 (__GLIBCXX_TYPE_INT_N_1))
1576#endif
1577#ifdef __GLIBCXX_TYPE_INT_N_2
1578 __INT_N (__GLIBCXX_TYPE_INT_N_2, __GLIBCXX_BITSIZE_INT_N_2,
1579 __INT_N_201103 (__GLIBCXX_TYPE_INT_N_2), __INT_N_U201103 (__GLIBCXX_TYPE_INT_N_2))
1580#endif
1581#ifdef __GLIBCXX_TYPE_INT_N_3
1582 __INT_N (__GLIBCXX_TYPE_INT_N_3, __GLIBCXX_BITSIZE_INT_N_3,
1583 __INT_N_201103 (__GLIBCXX_TYPE_INT_N_3), __INT_N_U201103 (__GLIBCXX_TYPE_INT_N_3))
1584#endif
1585
1586#undef __INT_N
1587#undef __INT_N_201103
1588#undef __INT_N_U201103
1589
1590#endif
1591
1592 /// numeric_limits<float> specialization.
1593 template<>
1594 struct numeric_limits<float>
1595 {
1596 static _GLIBCXX_USE_CONSTEXPR bool is_specialized = true;
1597
1598 static _GLIBCXX_CONSTEXPR float
1599 min() _GLIBCXX_USE_NOEXCEPT { return __FLT_MIN__; }
1600
1601 static _GLIBCXX_CONSTEXPR float
1602 max() _GLIBCXX_USE_NOEXCEPT { return __FLT_MAX__; }
1603
1604#if __cplusplus >= 201103L
1605 static constexpr float
1606 lowest() noexcept { return -__FLT_MAX__; }
1607#endif
1608
1609 static _GLIBCXX_USE_CONSTEXPR int digits = __FLT_MANT_DIG__;
1610 static _GLIBCXX_USE_CONSTEXPR int digits10 = __FLT_DIG__;
1611#if __cplusplus >= 201103L
1612 static constexpr int max_digits10
1613 = __glibcxx_max_digits10 (__FLT_MANT_DIG__);
1614#endif
1615 static _GLIBCXX_USE_CONSTEXPR bool is_signed = true;
1616 static _GLIBCXX_USE_CONSTEXPR bool is_integer = false;
1617 static _GLIBCXX_USE_CONSTEXPR bool is_exact = false;
1618 static _GLIBCXX_USE_CONSTEXPR int radix = __FLT_RADIX__;
1619
1620 static _GLIBCXX_CONSTEXPR float
1621 epsilon() _GLIBCXX_USE_NOEXCEPT { return __FLT_EPSILON__; }
1622
1623 static _GLIBCXX_CONSTEXPR float
1624 round_error() _GLIBCXX_USE_NOEXCEPT { return 0.5F; }
1625
1626 static _GLIBCXX_USE_CONSTEXPR int min_exponent = __FLT_MIN_EXP__;
1627 static _GLIBCXX_USE_CONSTEXPR int min_exponent10 = __FLT_MIN_10_EXP__;
1628 static _GLIBCXX_USE_CONSTEXPR int max_exponent = __FLT_MAX_EXP__;
1629 static _GLIBCXX_USE_CONSTEXPR int max_exponent10 = __FLT_MAX_10_EXP__;
1630
1631 static _GLIBCXX_USE_CONSTEXPR bool has_infinity = __FLT_HAS_INFINITY__;
1632 static _GLIBCXX_USE_CONSTEXPR bool has_quiet_NaN = __FLT_HAS_QUIET_NAN__;
1633 static _GLIBCXX_USE_CONSTEXPR bool has_signaling_NaN = has_quiet_NaN;
1634 static _GLIBCXX_USE_CONSTEXPR float_denorm_style has_denorm
1635 = bool(__FLT_HAS_DENORM__) ? denorm_present : denorm_absent;
1636 static _GLIBCXX_USE_CONSTEXPR bool has_denorm_loss
1637 = __glibcxx_float_has_denorm_loss;
1638
1639 static _GLIBCXX_CONSTEXPR float
1640 infinity() _GLIBCXX_USE_NOEXCEPT { return __builtin_huge_valf(); }
1641
1642 static _GLIBCXX_CONSTEXPR float
1643 quiet_NaN() _GLIBCXX_USE_NOEXCEPT { return __builtin_nanf(""); }
1644
1645 static _GLIBCXX_CONSTEXPR float
1646 signaling_NaN() _GLIBCXX_USE_NOEXCEPT { return __builtin_nansf(""); }
1647
1648 static _GLIBCXX_CONSTEXPR float
1649 denorm_min() _GLIBCXX_USE_NOEXCEPT { return __FLT_DENORM_MIN__; }
1650
1651 static _GLIBCXX_USE_CONSTEXPR bool is_iec559
1652 = has_infinity && has_quiet_NaN && has_denorm == denorm_present;
1653 static _GLIBCXX_USE_CONSTEXPR bool is_bounded = true;
1654 static _GLIBCXX_USE_CONSTEXPR bool is_modulo = false;
1655
1656 static _GLIBCXX_USE_CONSTEXPR bool traps = __glibcxx_float_traps;
1657 static _GLIBCXX_USE_CONSTEXPR bool tinyness_before
1658 = __glibcxx_float_tinyness_before;
1659 static _GLIBCXX_USE_CONSTEXPR float_round_style round_style
1660 = round_to_nearest;
1661 };
1662
1663#undef __glibcxx_float_has_denorm_loss
1664#undef __glibcxx_float_traps
1665#undef __glibcxx_float_tinyness_before
1666
1667 /// numeric_limits<double> specialization.
1668 template<>
1669 struct numeric_limits<double>
1670 {
1671 static _GLIBCXX_USE_CONSTEXPR bool is_specialized = true;
1672
1673 static _GLIBCXX_CONSTEXPR double
1674 min() _GLIBCXX_USE_NOEXCEPT { return __DBL_MIN__; }
1675
1676 static _GLIBCXX_CONSTEXPR double
1677 max() _GLIBCXX_USE_NOEXCEPT { return __DBL_MAX__; }
1678
1679#if __cplusplus >= 201103L
1680 static constexpr double
1681 lowest() noexcept { return -__DBL_MAX__; }
1682#endif
1683
1684 static _GLIBCXX_USE_CONSTEXPR int digits = __DBL_MANT_DIG__;
1685 static _GLIBCXX_USE_CONSTEXPR int digits10 = __DBL_DIG__;
1686#if __cplusplus >= 201103L
1687 static constexpr int max_digits10
1688 = __glibcxx_max_digits10 (__DBL_MANT_DIG__);
1689#endif
1690 static _GLIBCXX_USE_CONSTEXPR bool is_signed = true;
1691 static _GLIBCXX_USE_CONSTEXPR bool is_integer = false;
1692 static _GLIBCXX_USE_CONSTEXPR bool is_exact = false;
1693 static _GLIBCXX_USE_CONSTEXPR int radix = __FLT_RADIX__;
1694
1695 static _GLIBCXX_CONSTEXPR double
1696 epsilon() _GLIBCXX_USE_NOEXCEPT { return __DBL_EPSILON__; }
1697
1698 static _GLIBCXX_CONSTEXPR double
1699 round_error() _GLIBCXX_USE_NOEXCEPT { return 0.5; }
1700
1701 static _GLIBCXX_USE_CONSTEXPR int min_exponent = __DBL_MIN_EXP__;
1702 static _GLIBCXX_USE_CONSTEXPR int min_exponent10 = __DBL_MIN_10_EXP__;
1703 static _GLIBCXX_USE_CONSTEXPR int max_exponent = __DBL_MAX_EXP__;
1704 static _GLIBCXX_USE_CONSTEXPR int max_exponent10 = __DBL_MAX_10_EXP__;
1705
1706 static _GLIBCXX_USE_CONSTEXPR bool has_infinity = __DBL_HAS_INFINITY__;
1707 static _GLIBCXX_USE_CONSTEXPR bool has_quiet_NaN = __DBL_HAS_QUIET_NAN__;
1708 static _GLIBCXX_USE_CONSTEXPR bool has_signaling_NaN = has_quiet_NaN;
1709 static _GLIBCXX_USE_CONSTEXPR float_denorm_style has_denorm
1710 = bool(__DBL_HAS_DENORM__) ? denorm_present : denorm_absent;
1711 static _GLIBCXX_USE_CONSTEXPR bool has_denorm_loss
1712 = __glibcxx_double_has_denorm_loss;
1713
1714 static _GLIBCXX_CONSTEXPR double
1715 infinity() _GLIBCXX_USE_NOEXCEPT { return __builtin_huge_val(); }
1716
1717 static _GLIBCXX_CONSTEXPR double
1718 quiet_NaN() _GLIBCXX_USE_NOEXCEPT { return __builtin_nan(""); }
1719
1720 static _GLIBCXX_CONSTEXPR double
1721 signaling_NaN() _GLIBCXX_USE_NOEXCEPT { return __builtin_nans(""); }
1722
1723 static _GLIBCXX_CONSTEXPR double
1724 denorm_min() _GLIBCXX_USE_NOEXCEPT { return __DBL_DENORM_MIN__; }
1725
1726 static _GLIBCXX_USE_CONSTEXPR bool is_iec559
1727 = has_infinity && has_quiet_NaN && has_denorm == denorm_present;
1728 static _GLIBCXX_USE_CONSTEXPR bool is_bounded = true;
1729 static _GLIBCXX_USE_CONSTEXPR bool is_modulo = false;
1730
1731 static _GLIBCXX_USE_CONSTEXPR bool traps = __glibcxx_double_traps;
1732 static _GLIBCXX_USE_CONSTEXPR bool tinyness_before
1733 = __glibcxx_double_tinyness_before;
1734 static _GLIBCXX_USE_CONSTEXPR float_round_style round_style
1735 = round_to_nearest;
1736 };
1737
1738#undef __glibcxx_double_has_denorm_loss
1739#undef __glibcxx_double_traps
1740#undef __glibcxx_double_tinyness_before
1741
1742 /// numeric_limits<long double> specialization.
1743 template<>
1744 struct numeric_limits<long double>
1745 {
1746 static _GLIBCXX_USE_CONSTEXPR bool is_specialized = true;
1747
1748 static _GLIBCXX_CONSTEXPR long double
1749 min() _GLIBCXX_USE_NOEXCEPT { return __LDBL_MIN__; }
1750
1751 static _GLIBCXX_CONSTEXPR long double
1752 max() _GLIBCXX_USE_NOEXCEPT { return __LDBL_MAX__; }
1753
1754#if __cplusplus >= 201103L
1755 static constexpr long double
1756 lowest() noexcept { return -__LDBL_MAX__; }
1757#endif
1758
1759 static _GLIBCXX_USE_CONSTEXPR int digits = __LDBL_MANT_DIG__;
1760 static _GLIBCXX_USE_CONSTEXPR int digits10 = __LDBL_DIG__;
1761#if __cplusplus >= 201103L
1762 static _GLIBCXX_USE_CONSTEXPR int max_digits10
1763 = __glibcxx_max_digits10 (__LDBL_MANT_DIG__);
1764#endif
1765 static _GLIBCXX_USE_CONSTEXPR bool is_signed = true;
1766 static _GLIBCXX_USE_CONSTEXPR bool is_integer = false;
1767 static _GLIBCXX_USE_CONSTEXPR bool is_exact = false;
1768 static _GLIBCXX_USE_CONSTEXPR int radix = __FLT_RADIX__;
1769
1770 static _GLIBCXX_CONSTEXPR long double
1771 epsilon() _GLIBCXX_USE_NOEXCEPT { return __LDBL_EPSILON__; }
1772
1773 static _GLIBCXX_CONSTEXPR long double
1774 round_error() _GLIBCXX_USE_NOEXCEPT { return 0.5L; }
1775
1776 static _GLIBCXX_USE_CONSTEXPR int min_exponent = __LDBL_MIN_EXP__;
1777 static _GLIBCXX_USE_CONSTEXPR int min_exponent10 = __LDBL_MIN_10_EXP__;
1778 static _GLIBCXX_USE_CONSTEXPR int max_exponent = __LDBL_MAX_EXP__;
1779 static _GLIBCXX_USE_CONSTEXPR int max_exponent10 = __LDBL_MAX_10_EXP__;
1780
1781 static _GLIBCXX_USE_CONSTEXPR bool has_infinity = __LDBL_HAS_INFINITY__;
1782 static _GLIBCXX_USE_CONSTEXPR bool has_quiet_NaN = __LDBL_HAS_QUIET_NAN__;
1783 static _GLIBCXX_USE_CONSTEXPR bool has_signaling_NaN = has_quiet_NaN;
1784 static _GLIBCXX_USE_CONSTEXPR float_denorm_style has_denorm
1785 = bool(__LDBL_HAS_DENORM__) ? denorm_present : denorm_absent;
1786 static _GLIBCXX_USE_CONSTEXPR bool has_denorm_loss
1787 = __glibcxx_long_double_has_denorm_loss;
1788
1789 static _GLIBCXX_CONSTEXPR long double
1790 infinity() _GLIBCXX_USE_NOEXCEPT { return __builtin_huge_vall(); }
1791
1792 static _GLIBCXX_CONSTEXPR long double
1793 quiet_NaN() _GLIBCXX_USE_NOEXCEPT { return __builtin_nanl(""); }
1794
1795 static _GLIBCXX_CONSTEXPR long double
1796 signaling_NaN() _GLIBCXX_USE_NOEXCEPT { return __builtin_nansl(""); }
1797
1798 static _GLIBCXX_CONSTEXPR long double
1799 denorm_min() _GLIBCXX_USE_NOEXCEPT { return __LDBL_DENORM_MIN__; }
1800
1801 static _GLIBCXX_USE_CONSTEXPR bool is_iec559
1802 = has_infinity && has_quiet_NaN && has_denorm == denorm_present;
1803 static _GLIBCXX_USE_CONSTEXPR bool is_bounded = true;
1804 static _GLIBCXX_USE_CONSTEXPR bool is_modulo = false;
1805
1806 static _GLIBCXX_USE_CONSTEXPR bool traps = __glibcxx_long_double_traps;
1807 static _GLIBCXX_USE_CONSTEXPR bool tinyness_before =
1808 __glibcxx_long_double_tinyness_before;
1809 static _GLIBCXX_USE_CONSTEXPR float_round_style round_style =
1810 round_to_nearest;
1811 };
1812
1813#undef __glibcxx_long_double_has_denorm_loss
1814#undef __glibcxx_long_double_traps
1815#undef __glibcxx_long_double_tinyness_before
1816
1817_GLIBCXX_END_NAMESPACE_VERSION
1818} // namespace
1819
1820#undef __glibcxx_signed
1821#undef __glibcxx_min
1822#undef __glibcxx_max
1823#undef __glibcxx_digits
1824#undef __glibcxx_digits10
1825#undef __glibcxx_max_digits10
1826
1827#endif // _GLIBCXX_NUMERIC_LIMITS
1828