libstdc++: limits Source File

libstdc++

limits
Go to the documentation of this file.
1// The template and inlines for the numeric_limits classes. -*- C++ -*-
2
3// Copyright (C) 1999-2026 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#ifdef _GLIBCXX_SYSHDR
41#pragma GCC system_header
42#endif
43
44#pragma GCC diagnostic push
45#pragma GCC diagnostic ignored "-Wpedantic" // Q suffix
46#pragma GCC diagnostic ignored "-Wlong-long"
47#pragma GCC diagnostic ignored "-Wc++23-extensions"
48
49#include <bits/c++config.h>
50
51//
52// The numeric_limits<> traits document implementation-defined aspects
53// of fundamental arithmetic data types (integers and floating points).
54// From Standard C++ point of view, there are 14 such types:
55// * integers
56// bool (1)
57// char, signed char, unsigned char, wchar_t (4)
58// short, unsigned short (2)
59// int, unsigned (2)
60// long, unsigned long (2)
61//
62// * floating points
63// float (1)
64// double (1)
65// long double (1)
66//
67// GNU C++ understands (where supported by the host C-library)
68// * integer
69// long long, unsigned long long (2)
70//
71// which brings us to 16 fundamental arithmetic data types in GNU C++.
72//
73//
74// Since a numeric_limits<> is a bit tricky to get right, we rely on
75// an interface composed of macros which should be defined in config/os
76// or config/cpu when they differ from the generic (read arbitrary)
77// definitions given here.
78//
79
80// These values can be overridden in the target configuration file.
81// The default values are appropriate for many 32-bit targets.
82
83// GCC only intrinsically supports modulo integral types. The only remaining
84// integral exceptional values is division by zero. Only targets that do not
85// signal division by zero in some "hard to ignore" way should use false.
86#ifndef __glibcxx_integral_traps
87# define __glibcxx_integral_traps true
88#endif
89
90// float
91//
92
93// Default values. Should be overridden in configuration files if necessary.
94
95#ifndef __glibcxx_float_has_denorm_loss
96# define __glibcxx_float_has_denorm_loss false
97#endif
98#ifndef __glibcxx_float_traps
99# define __glibcxx_float_traps false
100#endif
101#ifndef __glibcxx_float_tinyness_before
102# define __glibcxx_float_tinyness_before false
103#endif
104
105// double
106
107// Default values. Should be overridden in configuration files if necessary.
108
109#ifndef __glibcxx_double_has_denorm_loss
110# define __glibcxx_double_has_denorm_loss false
111#endif
112#ifndef __glibcxx_double_traps
113# define __glibcxx_double_traps false
114#endif
115#ifndef __glibcxx_double_tinyness_before
116# define __glibcxx_double_tinyness_before false
117#endif
118
119// long double
120
121// Default values. Should be overridden in configuration files if necessary.
122
123#ifndef __glibcxx_long_double_has_denorm_loss
124# define __glibcxx_long_double_has_denorm_loss false
125#endif
126#ifndef __glibcxx_long_double_traps
127# define __glibcxx_long_double_traps false
128#endif
129#ifndef __glibcxx_long_double_tinyness_before
130# define __glibcxx_long_double_tinyness_before false
131#endif
132
133// You should not need to define any macros below this point.
134
135#define __glibcxx_signed_b(T,B) ((T)(-1) < 0)
136
137#define __glibcxx_min_b(T,B) \
138 (__glibcxx_signed_b (T,B) ? -__glibcxx_max_b (T,B) - 1 : (T)0)
139
140#define __glibcxx_max_b(T,B) \
141 (__glibcxx_signed_b (T,B) ? \
142 (((((T)1 << (__glibcxx_digits_b (T,B) - 1)) - 1) << 1) + 1) : ~(T)0)
143
144#define __glibcxx_digits_b(T,B) \
145 (B - __glibcxx_signed_b (T,B))
146
147// The fraction 643/2136 approximates log10(2) to 7 significant digits.
148#define __glibcxx_digits10_b(T,B) \
149 (__glibcxx_digits_b (T,B) * 643L / 2136)
150
151#define __glibcxx_signed(T) \
152 __glibcxx_signed_b (T, sizeof(T) * __CHAR_BIT__)
153#define __glibcxx_min(T) \
154 __glibcxx_min_b (T, sizeof(T) * __CHAR_BIT__)
155#define __glibcxx_max(T) \
156 __glibcxx_max_b (T, sizeof(T) * __CHAR_BIT__)
157#define __glibcxx_digits(T) \
158 __glibcxx_digits_b (T, sizeof(T) * __CHAR_BIT__)
159#define __glibcxx_digits10(T) \
160 __glibcxx_digits10_b (T, sizeof(T) * __CHAR_BIT__)
161
162#define __glibcxx_max_digits10(T) \
163 (2 + (T) * 643L / 2136)
164
165namespace std _GLIBCXX_VISIBILITY(default)
166{
167_GLIBCXX_BEGIN_NAMESPACE_VERSION
168
169 /**
170 * @brief Describes the rounding style for floating-point types.
171 *
172 * This is used in the std::numeric_limits class.
173 */
174 enum float_round_style
175 {
176 round_indeterminate = -1, ///< Intermediate.
177 round_toward_zero = 0, ///< To zero.
178 round_to_nearest = 1, ///< To the nearest representable value.
179 round_toward_infinity = 2, ///< To infinity.
180 round_toward_neg_infinity = 3 ///< To negative infinity.
181 };
182
183 /**
184 * @brief Describes the denormalization for floating-point types.
185 *
186 * These values represent the presence or absence of a variable number
187 * of exponent bits. This type is used in the std::numeric_limits class.
188 */
189 enum float_denorm_style
190 {
191 /// Indeterminate at compile time whether denormalized values are allowed.
192 denorm_indeterminate = -1,
193 /// The type does not allow denormalized values.
194 denorm_absent = 0,
195 /// The type allows denormalized values.
196 denorm_present = 1
197 };
198
199 /**
200 * @brief Part of std::numeric_limits.
201 *
202 * The @c static @c const members are usable as integral constant
203 * expressions.
204 *
205 * @note This is a separate class for purposes of efficiency; you
206 * should only access these members as part of an instantiation
207 * of the std::numeric_limits class.
208 */
209 struct __numeric_limits_base
210 {
211 /** This will be true for all fundamental types (which have
212 specializations), and false for everything else. */
213 static _GLIBCXX_USE_CONSTEXPR bool is_specialized = false;
214
215 /** The number of @c radix digits that be represented without change: for
216 integer types, the number of non-sign bits in the mantissa; for
217 floating types, the number of @c radix digits in the mantissa. */
218 static _GLIBCXX_USE_CONSTEXPR int digits = 0;
219
220 /** The number of base 10 digits that can be represented without change. */
221 static _GLIBCXX_USE_CONSTEXPR int digits10 = 0;
222
223#if __cplusplus >= 201103L
224 /** The number of base 10 digits required to ensure that values which
225 differ are always differentiated. */
226 static constexpr int max_digits10 = 0;
227#endif
228
229 /** True if the type is signed. */
230 static _GLIBCXX_USE_CONSTEXPR bool is_signed = false;
231
232 /** True if the type is integer. */
233 static _GLIBCXX_USE_CONSTEXPR bool is_integer = false;
234
235 /** True if the type uses an exact representation. All integer types are
236 exact, but not all exact types are integer. For example, rational and
237 fixed-exponent representations are exact but not integer. */
238 static _GLIBCXX_USE_CONSTEXPR bool is_exact = false;
239
240 /** For integer types, specifies the base of the representation. For
241 floating types, specifies the base of the exponent representation. */
242 static _GLIBCXX_USE_CONSTEXPR int radix = 0;
243
244 /** The minimum negative integer such that @c radix raised to the power of
245 (one less than that integer) is a normalized floating point number. */
246 static _GLIBCXX_USE_CONSTEXPR int min_exponent = 0;
247
248 /** The minimum negative integer such that 10 raised to that power is in
249 the range of normalized floating point numbers. */
250 static _GLIBCXX_USE_CONSTEXPR int min_exponent10 = 0;
251
252 /** The maximum positive integer such that @c radix raised to the power of
253 (one less than that integer) is a representable finite floating point
254 number. */
255 static _GLIBCXX_USE_CONSTEXPR int max_exponent = 0;
256
257 /** The maximum positive integer such that 10 raised to that power is in
258 the range of representable finite floating point numbers. */
259 static _GLIBCXX_USE_CONSTEXPR int max_exponent10 = 0;
260
261 /** True if the type has a representation for positive infinity. */
262 static _GLIBCXX_USE_CONSTEXPR bool has_infinity = false;
263
264 /** True if the type has a representation for a quiet (non-signaling)
265 Not a Number. */
266 static _GLIBCXX_USE_CONSTEXPR bool has_quiet_NaN = false;
267
268 /** True if the type has a representation for a signaling
269 Not a Number. */
270 static _GLIBCXX_USE_CONSTEXPR bool has_signaling_NaN = false;
271
272 /** See std::float_denorm_style for more information. */
273 static _GLIBCXX_USE_CONSTEXPR float_denorm_style has_denorm = denorm_absent;
274
275 /** True if loss of accuracy is detected as a denormalization loss,
276 rather than as an inexact result. */
277 static _GLIBCXX_USE_CONSTEXPR bool has_denorm_loss = false;
278
279 /** True if-and-only-if the type adheres to the IEC 559 standard, also
280 known as IEEE 754. (Only makes sense for floating point types.) */
281 static _GLIBCXX_USE_CONSTEXPR bool is_iec559 = false;
282
283 /** True if the set of values representable by the type is
284 finite. All built-in types are bounded, this member would be
285 false for arbitrary precision types. */
286 static _GLIBCXX_USE_CONSTEXPR bool is_bounded = false;
287
288 /** True if the type is @e modulo. A type is modulo if, for any
289 operation involving +, -, or * on values of that type whose
290 result would fall outside the range [min(),max()], the value
291 returned differs from the true value by an integer multiple of
292 max() - min() + 1. On most machines, this is false for floating
293 types, true for unsigned integers, and true for signed integers.
294 See PR22200 about signed integers. */
295 static _GLIBCXX_USE_CONSTEXPR bool is_modulo = false;
296
297 /** True if trapping is implemented for this type. */
298 static _GLIBCXX_USE_CONSTEXPR bool traps = false;
299
300 /** True if tininess is detected before rounding. (see IEC 559) */
301 static _GLIBCXX_USE_CONSTEXPR bool tinyness_before = false;
302
303 /** See std::float_round_style for more information. This is only
304 meaningful for floating types; integer types will all be
305 round_toward_zero. */
306 static _GLIBCXX_USE_CONSTEXPR float_round_style round_style =
307 round_toward_zero;
308 };
309
310 /**
311 * @brief Properties of fundamental types.
312 *
313 * This class allows a program to obtain information about the
314 * representation of a fundamental type on a given platform. For
315 * non-fundamental types, the functions will return 0 and the data
316 * members will all be @c false.
317 */
318 template<typename _Tp>
319 struct numeric_limits : public __numeric_limits_base
320 {
321 /** The minimum finite value, or for floating types with
322 denormalization, the minimum positive normalized value. */
323 static _GLIBCXX_CONSTEXPR _Tp
324 min() _GLIBCXX_USE_NOEXCEPT { return _Tp(); }
325
326 /** The maximum finite value. */
327 static _GLIBCXX_CONSTEXPR _Tp
328 max() _GLIBCXX_USE_NOEXCEPT { return _Tp(); }
329
330#if __cplusplus >= 201103L
331 /** A finite value x such that there is no other finite value y
332 * where y < x. */
333 static constexpr _Tp
334 lowest() noexcept { return _Tp(); }
335#endif
336
337 /** The @e machine @e epsilon: the difference between 1 and the least
338 value greater than 1 that is representable. */
339 static _GLIBCXX_CONSTEXPR _Tp
340 epsilon() _GLIBCXX_USE_NOEXCEPT { return _Tp(); }
341
342 /** The maximum rounding error measurement (see LIA-1). */
343 static _GLIBCXX_CONSTEXPR _Tp
344 round_error() _GLIBCXX_USE_NOEXCEPT { return _Tp(); }
345
346 /** The representation of positive infinity, if @c has_infinity. */
347 static _GLIBCXX_CONSTEXPR _Tp
348 infinity() _GLIBCXX_USE_NOEXCEPT { return _Tp(); }
349
350 /** The representation of a quiet Not a Number,
351 if @c has_quiet_NaN. */
352 static _GLIBCXX_CONSTEXPR _Tp
353 quiet_NaN() _GLIBCXX_USE_NOEXCEPT { return _Tp(); }
354
355 /** The representation of a signaling Not a Number, if
356 @c has_signaling_NaN. */
357 static _GLIBCXX_CONSTEXPR _Tp
358 signaling_NaN() _GLIBCXX_USE_NOEXCEPT { return _Tp(); }
359
360 /** The minimum positive denormalized value. For types where
361 @c has_denorm is false, this is the minimum positive normalized
362 value. */
363 static _GLIBCXX_CONSTEXPR _Tp
364 denorm_min() _GLIBCXX_USE_NOEXCEPT { return _Tp(); }
365 };
366
367 // _GLIBCXX_RESOLVE_LIB_DEFECTS
368 // 559. numeric_limits<const T>
369
370 template<typename _Tp>
371 struct numeric_limits<const _Tp>
372 : public numeric_limits<_Tp> { };
373
374 template<typename _Tp>
375 struct numeric_limits<volatile _Tp>
376 : public numeric_limits<_Tp> { };
377
378 template<typename _Tp>
379 struct numeric_limits<const volatile _Tp>
380 : public numeric_limits<_Tp> { };
381
382 // Now there follow 16 explicit specializations. Yes, 16. Make sure
383 // you get the count right. (18 in C++11 mode, with char16_t and char32_t.)
384 // (+1 if char8_t is enabled.)
385
386 // _GLIBCXX_RESOLVE_LIB_DEFECTS
387 // 184. numeric_limits<bool> wording problems
388
389 /// numeric_limits<bool> specialization.
390 template<>
391 struct numeric_limits<bool>
392 {
393 static _GLIBCXX_USE_CONSTEXPR bool is_specialized = true;
394
395 static _GLIBCXX_CONSTEXPR bool
396 min() _GLIBCXX_USE_NOEXCEPT { return false; }
397
398 static _GLIBCXX_CONSTEXPR bool
399 max() _GLIBCXX_USE_NOEXCEPT { return true; }
400
401#if __cplusplus >= 201103L
402 static constexpr bool
403 lowest() noexcept { return min(); }
404#endif
405 static _GLIBCXX_USE_CONSTEXPR int digits = 1;
406 static _GLIBCXX_USE_CONSTEXPR int digits10 = 0;
407#if __cplusplus >= 201103L
408 static constexpr int max_digits10 = 0;
409#endif
410 static _GLIBCXX_USE_CONSTEXPR bool is_signed = false;
411 static _GLIBCXX_USE_CONSTEXPR bool is_integer = true;
412 static _GLIBCXX_USE_CONSTEXPR bool is_exact = true;
413 static _GLIBCXX_USE_CONSTEXPR int radix = 2;
414
415 static _GLIBCXX_CONSTEXPR bool
416 epsilon() _GLIBCXX_USE_NOEXCEPT { return false; }
417
418 static _GLIBCXX_CONSTEXPR bool
419 round_error() _GLIBCXX_USE_NOEXCEPT { return false; }
420
421 static _GLIBCXX_USE_CONSTEXPR int min_exponent = 0;
422 static _GLIBCXX_USE_CONSTEXPR int min_exponent10 = 0;
423 static _GLIBCXX_USE_CONSTEXPR int max_exponent = 0;
424 static _GLIBCXX_USE_CONSTEXPR int max_exponent10 = 0;
425
426 static _GLIBCXX_USE_CONSTEXPR bool has_infinity = false;
427 static _GLIBCXX_USE_CONSTEXPR bool has_quiet_NaN = false;
428 static _GLIBCXX_USE_CONSTEXPR bool has_signaling_NaN = false;
429 static _GLIBCXX_USE_CONSTEXPR float_denorm_style has_denorm
430 = denorm_absent;
431 static _GLIBCXX_USE_CONSTEXPR bool has_denorm_loss = false;
432
433 static _GLIBCXX_CONSTEXPR bool
434 infinity() _GLIBCXX_USE_NOEXCEPT { return false; }
435
436 static _GLIBCXX_CONSTEXPR bool
437 quiet_NaN() _GLIBCXX_USE_NOEXCEPT { return false; }
438
439 static _GLIBCXX_CONSTEXPR bool
440 signaling_NaN() _GLIBCXX_USE_NOEXCEPT { return false; }
441
442 static _GLIBCXX_CONSTEXPR bool
443 denorm_min() _GLIBCXX_USE_NOEXCEPT { return false; }
444
445 static _GLIBCXX_USE_CONSTEXPR bool is_iec559 = false;
446 static _GLIBCXX_USE_CONSTEXPR bool is_bounded = true;
447 static _GLIBCXX_USE_CONSTEXPR bool is_modulo = false;
448
449 // It is not clear what it means for a boolean type to trap.
450 // This is a DR on the LWG issue list. Here, I use integer
451 // promotion semantics.
452 static _GLIBCXX_USE_CONSTEXPR bool traps = __glibcxx_integral_traps;
453 static _GLIBCXX_USE_CONSTEXPR bool tinyness_before = false;
454 static _GLIBCXX_USE_CONSTEXPR float_round_style round_style
455 = round_toward_zero;
456 };
457
458 /// numeric_limits<char> specialization.
459 template<>
460 struct numeric_limits<char>
461 {
462 static _GLIBCXX_USE_CONSTEXPR bool is_specialized = true;
463
464 static _GLIBCXX_CONSTEXPR char
465 min() _GLIBCXX_USE_NOEXCEPT { return __glibcxx_min(char); }
466
467 static _GLIBCXX_CONSTEXPR char
468 max() _GLIBCXX_USE_NOEXCEPT { return __glibcxx_max(char); }
469
470#if __cplusplus >= 201103L
471 static constexpr char
472 lowest() noexcept { return min(); }
473#endif
474
475 static _GLIBCXX_USE_CONSTEXPR int digits = __glibcxx_digits (char);
476 static _GLIBCXX_USE_CONSTEXPR int digits10 = __glibcxx_digits10 (char);
477#if __cplusplus >= 201103L
478 static constexpr int max_digits10 = 0;
479#endif
480 static _GLIBCXX_USE_CONSTEXPR bool is_signed = __glibcxx_signed (char);
481 static _GLIBCXX_USE_CONSTEXPR bool is_integer = true;
482 static _GLIBCXX_USE_CONSTEXPR bool is_exact = true;
483 static _GLIBCXX_USE_CONSTEXPR int radix = 2;
484
485 static _GLIBCXX_CONSTEXPR char
486 epsilon() _GLIBCXX_USE_NOEXCEPT { return 0; }
487
488 static _GLIBCXX_CONSTEXPR char
489 round_error() _GLIBCXX_USE_NOEXCEPT { return 0; }
490
491 static _GLIBCXX_USE_CONSTEXPR int min_exponent = 0;
492 static _GLIBCXX_USE_CONSTEXPR int min_exponent10 = 0;
493 static _GLIBCXX_USE_CONSTEXPR int max_exponent = 0;
494 static _GLIBCXX_USE_CONSTEXPR int max_exponent10 = 0;
495
496 static _GLIBCXX_USE_CONSTEXPR bool has_infinity = false;
497 static _GLIBCXX_USE_CONSTEXPR bool has_quiet_NaN = false;
498 static _GLIBCXX_USE_CONSTEXPR bool has_signaling_NaN = false;
499 static _GLIBCXX_USE_CONSTEXPR float_denorm_style has_denorm
500 = denorm_absent;
501 static _GLIBCXX_USE_CONSTEXPR bool has_denorm_loss = false;
502
503 static _GLIBCXX_CONSTEXPR
504 char infinity() _GLIBCXX_USE_NOEXCEPT { return char(); }
505
506 static _GLIBCXX_CONSTEXPR char
507 quiet_NaN() _GLIBCXX_USE_NOEXCEPT { return char(); }
508
509 static _GLIBCXX_CONSTEXPR char
510 signaling_NaN() _GLIBCXX_USE_NOEXCEPT { return char(); }
511
512 static _GLIBCXX_CONSTEXPR char
513 denorm_min() _GLIBCXX_USE_NOEXCEPT { return static_cast<char>(0); }
514
515 static _GLIBCXX_USE_CONSTEXPR bool is_iec559 = false;
516 static _GLIBCXX_USE_CONSTEXPR bool is_bounded = true;
517 static _GLIBCXX_USE_CONSTEXPR bool is_modulo = !is_signed;
518
519 static _GLIBCXX_USE_CONSTEXPR bool traps = __glibcxx_integral_traps;
520 static _GLIBCXX_USE_CONSTEXPR bool tinyness_before = false;
521 static _GLIBCXX_USE_CONSTEXPR float_round_style round_style
522 = round_toward_zero;
523 };
524
525 /// numeric_limits<signed char> specialization.
526 template<>
527 struct numeric_limits<signed char>
528 {
529 static _GLIBCXX_USE_CONSTEXPR bool is_specialized = true;
530
531 static _GLIBCXX_CONSTEXPR signed char
532 min() _GLIBCXX_USE_NOEXCEPT { return -__SCHAR_MAX__ - 1; }
533
534 static _GLIBCXX_CONSTEXPR signed char
535 max() _GLIBCXX_USE_NOEXCEPT { return __SCHAR_MAX__; }
536
537#if __cplusplus >= 201103L
538 static constexpr signed char
539 lowest() noexcept { return min(); }
540#endif
541
542 static _GLIBCXX_USE_CONSTEXPR int digits = __glibcxx_digits (signed char);
543 static _GLIBCXX_USE_CONSTEXPR int digits10
544 = __glibcxx_digits10 (signed char);
545#if __cplusplus >= 201103L
546 static constexpr int max_digits10 = 0;
547#endif
548 static _GLIBCXX_USE_CONSTEXPR bool is_signed = true;
549 static _GLIBCXX_USE_CONSTEXPR bool is_integer = true;
550 static _GLIBCXX_USE_CONSTEXPR bool is_exact = true;
551 static _GLIBCXX_USE_CONSTEXPR int radix = 2;
552
553 static _GLIBCXX_CONSTEXPR signed char
554 epsilon() _GLIBCXX_USE_NOEXCEPT { return 0; }
555
556 static _GLIBCXX_CONSTEXPR signed char
557 round_error() _GLIBCXX_USE_NOEXCEPT { return 0; }
558
559 static _GLIBCXX_USE_CONSTEXPR int min_exponent = 0;
560 static _GLIBCXX_USE_CONSTEXPR int min_exponent10 = 0;
561 static _GLIBCXX_USE_CONSTEXPR int max_exponent = 0;
562 static _GLIBCXX_USE_CONSTEXPR int max_exponent10 = 0;
563
564 static _GLIBCXX_USE_CONSTEXPR bool has_infinity = false;
565 static _GLIBCXX_USE_CONSTEXPR bool has_quiet_NaN = false;
566 static _GLIBCXX_USE_CONSTEXPR bool has_signaling_NaN = false;
567 static _GLIBCXX_USE_CONSTEXPR float_denorm_style has_denorm
568 = denorm_absent;
569 static _GLIBCXX_USE_CONSTEXPR bool has_denorm_loss = false;
570
571 static _GLIBCXX_CONSTEXPR signed char
572 infinity() _GLIBCXX_USE_NOEXCEPT { return static_cast<signed char>(0); }
573
574 static _GLIBCXX_CONSTEXPR signed char
575 quiet_NaN() _GLIBCXX_USE_NOEXCEPT { return static_cast<signed char>(0); }
576
577 static _GLIBCXX_CONSTEXPR signed char
578 signaling_NaN() _GLIBCXX_USE_NOEXCEPT
579 { return static_cast<signed char>(0); }
580
581 static _GLIBCXX_CONSTEXPR signed char
582 denorm_min() _GLIBCXX_USE_NOEXCEPT
583 { return static_cast<signed char>(0); }
584
585 static _GLIBCXX_USE_CONSTEXPR bool is_iec559 = false;
586 static _GLIBCXX_USE_CONSTEXPR bool is_bounded = true;
587 static _GLIBCXX_USE_CONSTEXPR bool is_modulo = false;
588
589 static _GLIBCXX_USE_CONSTEXPR bool traps = __glibcxx_integral_traps;
590 static _GLIBCXX_USE_CONSTEXPR bool tinyness_before = false;
591 static _GLIBCXX_USE_CONSTEXPR float_round_style round_style
592 = round_toward_zero;
593 };
594
595 /// numeric_limits<unsigned char> specialization.
596 template<>
597 struct numeric_limits<unsigned char>
598 {
599 static _GLIBCXX_USE_CONSTEXPR bool is_specialized = true;
600
601 static _GLIBCXX_CONSTEXPR unsigned char
602 min() _GLIBCXX_USE_NOEXCEPT { return 0; }
603
604 static _GLIBCXX_CONSTEXPR unsigned char
605 max() _GLIBCXX_USE_NOEXCEPT { return __SCHAR_MAX__ * 2U + 1; }
606
607#if __cplusplus >= 201103L
608 static constexpr unsigned char
609 lowest() noexcept { return min(); }
610#endif
611
612 static _GLIBCXX_USE_CONSTEXPR int digits
613 = __glibcxx_digits (unsigned char);
614 static _GLIBCXX_USE_CONSTEXPR int digits10
615 = __glibcxx_digits10 (unsigned char);
616#if __cplusplus >= 201103L
617 static constexpr int max_digits10 = 0;
618#endif
619 static _GLIBCXX_USE_CONSTEXPR bool is_signed = false;
620 static _GLIBCXX_USE_CONSTEXPR bool is_integer = true;
621 static _GLIBCXX_USE_CONSTEXPR bool is_exact = true;
622 static _GLIBCXX_USE_CONSTEXPR int radix = 2;
623
624 static _GLIBCXX_CONSTEXPR unsigned char
625 epsilon() _GLIBCXX_USE_NOEXCEPT { return 0; }
626
627 static _GLIBCXX_CONSTEXPR unsigned char
628 round_error() _GLIBCXX_USE_NOEXCEPT { return 0; }
629
630 static _GLIBCXX_USE_CONSTEXPR int min_exponent = 0;
631 static _GLIBCXX_USE_CONSTEXPR int min_exponent10 = 0;
632 static _GLIBCXX_USE_CONSTEXPR int max_exponent = 0;
633 static _GLIBCXX_USE_CONSTEXPR int max_exponent10 = 0;
634
635 static _GLIBCXX_USE_CONSTEXPR bool has_infinity = false;
636 static _GLIBCXX_USE_CONSTEXPR bool has_quiet_NaN = false;
637 static _GLIBCXX_USE_CONSTEXPR bool has_signaling_NaN = false;
638 static _GLIBCXX_USE_CONSTEXPR float_denorm_style has_denorm
639 = denorm_absent;
640 static _GLIBCXX_USE_CONSTEXPR bool has_denorm_loss = false;
641
642 static _GLIBCXX_CONSTEXPR unsigned char
643 infinity() _GLIBCXX_USE_NOEXCEPT
644 { return static_cast<unsigned char>(0); }
645
646 static _GLIBCXX_CONSTEXPR unsigned char
647 quiet_NaN() _GLIBCXX_USE_NOEXCEPT
648 { return static_cast<unsigned char>(0); }
649
650 static _GLIBCXX_CONSTEXPR unsigned char
651 signaling_NaN() _GLIBCXX_USE_NOEXCEPT
652 { return static_cast<unsigned char>(0); }
653
654 static _GLIBCXX_CONSTEXPR unsigned char
655 denorm_min() _GLIBCXX_USE_NOEXCEPT
656 { return static_cast<unsigned char>(0); }
657
658 static _GLIBCXX_USE_CONSTEXPR bool is_iec559 = false;
659 static _GLIBCXX_USE_CONSTEXPR bool is_bounded = true;
660 static _GLIBCXX_USE_CONSTEXPR bool is_modulo = true;
661
662 static _GLIBCXX_USE_CONSTEXPR bool traps = __glibcxx_integral_traps;
663 static _GLIBCXX_USE_CONSTEXPR bool tinyness_before = false;
664 static _GLIBCXX_USE_CONSTEXPR float_round_style round_style
665 = round_toward_zero;
666 };
667
668 /// numeric_limits<wchar_t> specialization.
669 template<>
670 struct numeric_limits<wchar_t>
671 {
672 static _GLIBCXX_USE_CONSTEXPR bool is_specialized = true;
673
674 static _GLIBCXX_CONSTEXPR wchar_t
675 min() _GLIBCXX_USE_NOEXCEPT { return __glibcxx_min (wchar_t); }
676
677 static _GLIBCXX_CONSTEXPR wchar_t
678 max() _GLIBCXX_USE_NOEXCEPT { return __glibcxx_max (wchar_t); }
679
680#if __cplusplus >= 201103L
681 static constexpr wchar_t
682 lowest() noexcept { return min(); }
683#endif
684
685 static _GLIBCXX_USE_CONSTEXPR int digits = __glibcxx_digits (wchar_t);
686 static _GLIBCXX_USE_CONSTEXPR int digits10
687 = __glibcxx_digits10 (wchar_t);
688#if __cplusplus >= 201103L
689 static constexpr int max_digits10 = 0;
690#endif
691 static _GLIBCXX_USE_CONSTEXPR bool is_signed = __glibcxx_signed (wchar_t);
692 static _GLIBCXX_USE_CONSTEXPR bool is_integer = true;
693 static _GLIBCXX_USE_CONSTEXPR bool is_exact = true;
694 static _GLIBCXX_USE_CONSTEXPR int radix = 2;
695
696 static _GLIBCXX_CONSTEXPR wchar_t
697 epsilon() _GLIBCXX_USE_NOEXCEPT { return 0; }
698
699 static _GLIBCXX_CONSTEXPR wchar_t
700 round_error() _GLIBCXX_USE_NOEXCEPT { return 0; }
701
702 static _GLIBCXX_USE_CONSTEXPR int min_exponent = 0;
703 static _GLIBCXX_USE_CONSTEXPR int min_exponent10 = 0;
704 static _GLIBCXX_USE_CONSTEXPR int max_exponent = 0;
705 static _GLIBCXX_USE_CONSTEXPR int max_exponent10 = 0;
706
707 static _GLIBCXX_USE_CONSTEXPR bool has_infinity = false;
708 static _GLIBCXX_USE_CONSTEXPR bool has_quiet_NaN = false;
709 static _GLIBCXX_USE_CONSTEXPR bool has_signaling_NaN = false;
710 static _GLIBCXX_USE_CONSTEXPR float_denorm_style has_denorm
711 = denorm_absent;
712 static _GLIBCXX_USE_CONSTEXPR bool has_denorm_loss = false;
713
714 static _GLIBCXX_CONSTEXPR wchar_t
715 infinity() _GLIBCXX_USE_NOEXCEPT { return wchar_t(); }
716
717 static _GLIBCXX_CONSTEXPR wchar_t
718 quiet_NaN() _GLIBCXX_USE_NOEXCEPT { return wchar_t(); }
719
720 static _GLIBCXX_CONSTEXPR wchar_t
721 signaling_NaN() _GLIBCXX_USE_NOEXCEPT { return wchar_t(); }
722
723 static _GLIBCXX_CONSTEXPR wchar_t
724 denorm_min() _GLIBCXX_USE_NOEXCEPT { return wchar_t(); }
725
726 static _GLIBCXX_USE_CONSTEXPR bool is_iec559 = false;
727 static _GLIBCXX_USE_CONSTEXPR bool is_bounded = true;
728 static _GLIBCXX_USE_CONSTEXPR bool is_modulo = !is_signed;
729
730 static _GLIBCXX_USE_CONSTEXPR bool traps = __glibcxx_integral_traps;
731 static _GLIBCXX_USE_CONSTEXPR bool tinyness_before = false;
732 static _GLIBCXX_USE_CONSTEXPR float_round_style round_style
733 = round_toward_zero;
734 };
735
736#if _GLIBCXX_USE_CHAR8_T
737 /// numeric_limits<char8_t> specialization.
738 template<>
739 struct numeric_limits<char8_t>
740 {
741 static _GLIBCXX_USE_CONSTEXPR bool is_specialized = true;
742
743 static _GLIBCXX_CONSTEXPR char8_t
744 min() _GLIBCXX_USE_NOEXCEPT { return __glibcxx_min (char8_t); }
745
746 static _GLIBCXX_CONSTEXPR char8_t
747 max() _GLIBCXX_USE_NOEXCEPT { return __glibcxx_max (char8_t); }
748
749 static _GLIBCXX_CONSTEXPR char8_t
750 lowest() _GLIBCXX_USE_NOEXCEPT { return min(); }
751
752 static _GLIBCXX_USE_CONSTEXPR int digits = __glibcxx_digits (char8_t);
753 static _GLIBCXX_USE_CONSTEXPR int digits10 = __glibcxx_digits10 (char8_t);
754 static _GLIBCXX_USE_CONSTEXPR int max_digits10 = 0;
755 static _GLIBCXX_USE_CONSTEXPR bool is_signed = __glibcxx_signed (char8_t);
756 static _GLIBCXX_USE_CONSTEXPR bool is_integer = true;
757 static _GLIBCXX_USE_CONSTEXPR bool is_exact = true;
758 static _GLIBCXX_USE_CONSTEXPR int radix = 2;
759
760 static _GLIBCXX_CONSTEXPR char8_t
761 epsilon() _GLIBCXX_USE_NOEXCEPT { return 0; }
762
763 static _GLIBCXX_CONSTEXPR char8_t
764 round_error() _GLIBCXX_USE_NOEXCEPT { return 0; }
765
766 static _GLIBCXX_USE_CONSTEXPR int min_exponent = 0;
767 static _GLIBCXX_USE_CONSTEXPR int min_exponent10 = 0;
768 static _GLIBCXX_USE_CONSTEXPR int max_exponent = 0;
769 static _GLIBCXX_USE_CONSTEXPR int max_exponent10 = 0;
770
771 static _GLIBCXX_USE_CONSTEXPR bool has_infinity = false;
772 static _GLIBCXX_USE_CONSTEXPR bool has_quiet_NaN = false;
773 static _GLIBCXX_USE_CONSTEXPR bool has_signaling_NaN = false;
774 static _GLIBCXX_USE_CONSTEXPR float_denorm_style has_denorm
775 = denorm_absent;
776 static _GLIBCXX_USE_CONSTEXPR bool has_denorm_loss = false;
777
778 static _GLIBCXX_CONSTEXPR char8_t
779 infinity() _GLIBCXX_USE_NOEXCEPT { return char8_t(); }
780
781 static _GLIBCXX_CONSTEXPR char8_t
782 quiet_NaN() _GLIBCXX_USE_NOEXCEPT { return char8_t(); }
783
784 static _GLIBCXX_CONSTEXPR char8_t
785 signaling_NaN() _GLIBCXX_USE_NOEXCEPT { return char8_t(); }
786
787 static _GLIBCXX_CONSTEXPR char8_t
788 denorm_min() _GLIBCXX_USE_NOEXCEPT { return char8_t(); }
789
790 static _GLIBCXX_USE_CONSTEXPR bool is_iec559 = false;
791 static _GLIBCXX_USE_CONSTEXPR bool is_bounded = true;
792 static _GLIBCXX_USE_CONSTEXPR bool is_modulo = !is_signed;
793
794 static _GLIBCXX_USE_CONSTEXPR bool traps = __glibcxx_integral_traps;
795 static _GLIBCXX_USE_CONSTEXPR bool tinyness_before = false;
796 static _GLIBCXX_USE_CONSTEXPR float_round_style round_style
797 = round_toward_zero;
798 };
799#endif
800
801#if __cplusplus >= 201103L
802 /// numeric_limits<char16_t> specialization.
803 template<>
804 struct numeric_limits<char16_t>
805 {
806 static constexpr bool is_specialized = true;
807
808 static constexpr char16_t
809 min() noexcept { return __glibcxx_min (char16_t); }
810
811 static constexpr char16_t
812 max() noexcept { return __glibcxx_max (char16_t); }
813
814 static constexpr char16_t
815 lowest() noexcept { return min(); }
816
817 static constexpr int digits = __glibcxx_digits (char16_t);
818 static constexpr int digits10 = __glibcxx_digits10 (char16_t);
819 static constexpr int max_digits10 = 0;
820 static constexpr bool is_signed = __glibcxx_signed (char16_t);
821 static constexpr bool is_integer = true;
822 static constexpr bool is_exact = true;
823 static constexpr int radix = 2;
824
825 static constexpr char16_t
826 epsilon() noexcept { return 0; }
827
828 static constexpr char16_t
829 round_error() noexcept { return 0; }
830
831 static constexpr int min_exponent = 0;
832 static constexpr int min_exponent10 = 0;
833 static constexpr int max_exponent = 0;
834 static constexpr int max_exponent10 = 0;
835
836 static constexpr bool has_infinity = false;
837 static constexpr bool has_quiet_NaN = false;
838 static constexpr bool has_signaling_NaN = false;
839 static constexpr float_denorm_style has_denorm = denorm_absent;
840 static constexpr bool has_denorm_loss = false;
841
842 static constexpr char16_t
843 infinity() noexcept { return char16_t(); }
844
845 static constexpr char16_t
846 quiet_NaN() noexcept { return char16_t(); }
847
848 static constexpr char16_t
849 signaling_NaN() noexcept { return char16_t(); }
850
851 static constexpr char16_t
852 denorm_min() noexcept { return char16_t(); }
853
854 static constexpr bool is_iec559 = false;
855 static constexpr bool is_bounded = true;
856 static constexpr bool is_modulo = !is_signed;
857
858 static constexpr bool traps = __glibcxx_integral_traps;
859 static constexpr bool tinyness_before = false;
860 static constexpr float_round_style round_style = round_toward_zero;
861 };
862
863 /// numeric_limits<char32_t> specialization.
864 template<>
865 struct numeric_limits<char32_t>
866 {
867 static constexpr bool is_specialized = true;
868
869 static constexpr char32_t
870 min() noexcept { return __glibcxx_min (char32_t); }
871
872 static constexpr char32_t
873 max() noexcept { return __glibcxx_max (char32_t); }
874
875 static constexpr char32_t
876 lowest() noexcept { return min(); }
877
878 static constexpr int digits = __glibcxx_digits (char32_t);
879 static constexpr int digits10 = __glibcxx_digits10 (char32_t);
880 static constexpr int max_digits10 = 0;
881 static constexpr bool is_signed = __glibcxx_signed (char32_t);
882 static constexpr bool is_integer = true;
883 static constexpr bool is_exact = true;
884 static constexpr int radix = 2;
885
886 static constexpr char32_t
887 epsilon() noexcept { return 0; }
888
889 static constexpr char32_t
890 round_error() noexcept { return 0; }
891
892 static constexpr int min_exponent = 0;
893 static constexpr int min_exponent10 = 0;
894 static constexpr int max_exponent = 0;
895 static constexpr int max_exponent10 = 0;
896
897 static constexpr bool has_infinity = false;
898 static constexpr bool has_quiet_NaN = false;
899 static constexpr bool has_signaling_NaN = false;
900 static constexpr float_denorm_style has_denorm = denorm_absent;
901 static constexpr bool has_denorm_loss = false;
902
903 static constexpr char32_t
904 infinity() noexcept { return char32_t(); }
905
906 static constexpr char32_t
907 quiet_NaN() noexcept { return char32_t(); }
908
909 static constexpr char32_t
910 signaling_NaN() noexcept { return char32_t(); }
911
912 static constexpr char32_t
913 denorm_min() noexcept { return char32_t(); }
914
915 static constexpr bool is_iec559 = false;
916 static constexpr bool is_bounded = true;
917 static constexpr bool is_modulo = !is_signed;
918
919 static constexpr bool traps = __glibcxx_integral_traps;
920 static constexpr bool tinyness_before = false;
921 static constexpr float_round_style round_style = round_toward_zero;
922 };
923#endif
924
925 /// numeric_limits<short> specialization.
926 template<>
927 struct numeric_limits<short>
928 {
929 static _GLIBCXX_USE_CONSTEXPR bool is_specialized = true;
930
931 static _GLIBCXX_CONSTEXPR short
932 min() _GLIBCXX_USE_NOEXCEPT { return -__SHRT_MAX__ - 1; }
933
934 static _GLIBCXX_CONSTEXPR short
935 max() _GLIBCXX_USE_NOEXCEPT { return __SHRT_MAX__; }
936
937#if __cplusplus >= 201103L
938 static constexpr short
939 lowest() noexcept { return min(); }
940#endif
941
942 static _GLIBCXX_USE_CONSTEXPR int digits = __glibcxx_digits (short);
943 static _GLIBCXX_USE_CONSTEXPR int digits10 = __glibcxx_digits10 (short);
944#if __cplusplus >= 201103L
945 static constexpr int max_digits10 = 0;
946#endif
947 static _GLIBCXX_USE_CONSTEXPR bool is_signed = true;
948 static _GLIBCXX_USE_CONSTEXPR bool is_integer = true;
949 static _GLIBCXX_USE_CONSTEXPR bool is_exact = true;
950 static _GLIBCXX_USE_CONSTEXPR int radix = 2;
951
952 static _GLIBCXX_CONSTEXPR short
953 epsilon() _GLIBCXX_USE_NOEXCEPT { return 0; }
954
955 static _GLIBCXX_CONSTEXPR short
956 round_error() _GLIBCXX_USE_NOEXCEPT { return 0; }
957
958 static _GLIBCXX_USE_CONSTEXPR int min_exponent = 0;
959 static _GLIBCXX_USE_CONSTEXPR int min_exponent10 = 0;
960 static _GLIBCXX_USE_CONSTEXPR int max_exponent = 0;
961 static _GLIBCXX_USE_CONSTEXPR int max_exponent10 = 0;
962
963 static _GLIBCXX_USE_CONSTEXPR bool has_infinity = false;
964 static _GLIBCXX_USE_CONSTEXPR bool has_quiet_NaN = false;
965 static _GLIBCXX_USE_CONSTEXPR bool has_signaling_NaN = false;
966 static _GLIBCXX_USE_CONSTEXPR float_denorm_style has_denorm
967 = denorm_absent;
968 static _GLIBCXX_USE_CONSTEXPR bool has_denorm_loss = false;
969
970 static _GLIBCXX_CONSTEXPR short
971 infinity() _GLIBCXX_USE_NOEXCEPT { return short(); }
972
973 static _GLIBCXX_CONSTEXPR short
974 quiet_NaN() _GLIBCXX_USE_NOEXCEPT { return short(); }
975
976 static _GLIBCXX_CONSTEXPR short
977 signaling_NaN() _GLIBCXX_USE_NOEXCEPT { return short(); }
978
979 static _GLIBCXX_CONSTEXPR short
980 denorm_min() _GLIBCXX_USE_NOEXCEPT { return short(); }
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 = false;
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<unsigned short> specialization.
993 template<>
994 struct numeric_limits<unsigned short>
995 {
996 static _GLIBCXX_USE_CONSTEXPR bool is_specialized = true;
997
998 static _GLIBCXX_CONSTEXPR unsigned short
999 min() _GLIBCXX_USE_NOEXCEPT { return 0; }
1000
1001 static _GLIBCXX_CONSTEXPR unsigned short
1002 max() _GLIBCXX_USE_NOEXCEPT { return __SHRT_MAX__ * 2U + 1; }
1003
1004#if __cplusplus >= 201103L
1005 static constexpr unsigned short
1006 lowest() noexcept { return min(); }
1007#endif
1008
1009 static _GLIBCXX_USE_CONSTEXPR int digits
1010 = __glibcxx_digits (unsigned short);
1011 static _GLIBCXX_USE_CONSTEXPR int digits10
1012 = __glibcxx_digits10 (unsigned short);
1013#if __cplusplus >= 201103L
1014 static constexpr int max_digits10 = 0;
1015#endif
1016 static _GLIBCXX_USE_CONSTEXPR bool is_signed = false;
1017 static _GLIBCXX_USE_CONSTEXPR bool is_integer = true;
1018 static _GLIBCXX_USE_CONSTEXPR bool is_exact = true;
1019 static _GLIBCXX_USE_CONSTEXPR int radix = 2;
1020
1021 static _GLIBCXX_CONSTEXPR unsigned short
1022 epsilon() _GLIBCXX_USE_NOEXCEPT { return 0; }
1023
1024 static _GLIBCXX_CONSTEXPR unsigned short
1025 round_error() _GLIBCXX_USE_NOEXCEPT { return 0; }
1026
1027 static _GLIBCXX_USE_CONSTEXPR int min_exponent = 0;
1028 static _GLIBCXX_USE_CONSTEXPR int min_exponent10 = 0;
1029 static _GLIBCXX_USE_CONSTEXPR int max_exponent = 0;
1030 static _GLIBCXX_USE_CONSTEXPR int max_exponent10 = 0;
1031
1032 static _GLIBCXX_USE_CONSTEXPR bool has_infinity = false;
1033 static _GLIBCXX_USE_CONSTEXPR bool has_quiet_NaN = false;
1034 static _GLIBCXX_USE_CONSTEXPR bool has_signaling_NaN = false;
1035 static _GLIBCXX_USE_CONSTEXPR float_denorm_style has_denorm
1036 = denorm_absent;
1037 static _GLIBCXX_USE_CONSTEXPR bool has_denorm_loss = false;
1038
1039 static _GLIBCXX_CONSTEXPR unsigned short
1040 infinity() _GLIBCXX_USE_NOEXCEPT
1041 { return static_cast<unsigned short>(0); }
1042
1043 static _GLIBCXX_CONSTEXPR unsigned short
1044 quiet_NaN() _GLIBCXX_USE_NOEXCEPT
1045 { return static_cast<unsigned short>(0); }
1046
1047 static _GLIBCXX_CONSTEXPR unsigned short
1048 signaling_NaN() _GLIBCXX_USE_NOEXCEPT
1049 { return static_cast<unsigned short>(0); }
1050
1051 static _GLIBCXX_CONSTEXPR unsigned short
1052 denorm_min() _GLIBCXX_USE_NOEXCEPT
1053 { return static_cast<unsigned short>(0); }
1054
1055 static _GLIBCXX_USE_CONSTEXPR bool is_iec559 = false;
1056 static _GLIBCXX_USE_CONSTEXPR bool is_bounded = true;
1057 static _GLIBCXX_USE_CONSTEXPR bool is_modulo = true;
1058
1059 static _GLIBCXX_USE_CONSTEXPR bool traps = __glibcxx_integral_traps;
1060 static _GLIBCXX_USE_CONSTEXPR bool tinyness_before = false;
1061 static _GLIBCXX_USE_CONSTEXPR float_round_style round_style
1062 = round_toward_zero;
1063 };
1064
1065 /// numeric_limits<int> specialization.
1066 template<>
1067 struct numeric_limits<int>
1068 {
1069 static _GLIBCXX_USE_CONSTEXPR bool is_specialized = true;
1070
1071 static _GLIBCXX_CONSTEXPR int
1072 min() _GLIBCXX_USE_NOEXCEPT { return -__INT_MAX__ - 1; }
1073
1074 static _GLIBCXX_CONSTEXPR int
1075 max() _GLIBCXX_USE_NOEXCEPT { return __INT_MAX__; }
1076
1077#if __cplusplus >= 201103L
1078 static constexpr int
1079 lowest() noexcept { return min(); }
1080#endif
1081
1082 static _GLIBCXX_USE_CONSTEXPR int digits = __glibcxx_digits (int);
1083 static _GLIBCXX_USE_CONSTEXPR int digits10 = __glibcxx_digits10 (int);
1084#if __cplusplus >= 201103L
1085 static constexpr int max_digits10 = 0;
1086#endif
1087 static _GLIBCXX_USE_CONSTEXPR bool is_signed = true;
1088 static _GLIBCXX_USE_CONSTEXPR bool is_integer = true;
1089 static _GLIBCXX_USE_CONSTEXPR bool is_exact = true;
1090 static _GLIBCXX_USE_CONSTEXPR int radix = 2;
1091
1092 static _GLIBCXX_CONSTEXPR int
1093 epsilon() _GLIBCXX_USE_NOEXCEPT { return 0; }
1094
1095 static _GLIBCXX_CONSTEXPR int
1096 round_error() _GLIBCXX_USE_NOEXCEPT { return 0; }
1097
1098 static _GLIBCXX_USE_CONSTEXPR int min_exponent = 0;
1099 static _GLIBCXX_USE_CONSTEXPR int min_exponent10 = 0;
1100 static _GLIBCXX_USE_CONSTEXPR int max_exponent = 0;
1101 static _GLIBCXX_USE_CONSTEXPR int max_exponent10 = 0;
1102
1103 static _GLIBCXX_USE_CONSTEXPR bool has_infinity = false;
1104 static _GLIBCXX_USE_CONSTEXPR bool has_quiet_NaN = false;
1105 static _GLIBCXX_USE_CONSTEXPR bool has_signaling_NaN = false;
1106 static _GLIBCXX_USE_CONSTEXPR float_denorm_style has_denorm
1107 = denorm_absent;
1108 static _GLIBCXX_USE_CONSTEXPR bool has_denorm_loss = false;
1109
1110 static _GLIBCXX_CONSTEXPR int
1111 infinity() _GLIBCXX_USE_NOEXCEPT { return static_cast<int>(0); }
1112
1113 static _GLIBCXX_CONSTEXPR int
1114 quiet_NaN() _GLIBCXX_USE_NOEXCEPT { return static_cast<int>(0); }
1115
1116 static _GLIBCXX_CONSTEXPR int
1117 signaling_NaN() _GLIBCXX_USE_NOEXCEPT { return static_cast<int>(0); }
1118
1119 static _GLIBCXX_CONSTEXPR int
1120 denorm_min() _GLIBCXX_USE_NOEXCEPT { return static_cast<int>(0); }
1121
1122 static _GLIBCXX_USE_CONSTEXPR bool is_iec559 = false;
1123 static _GLIBCXX_USE_CONSTEXPR bool is_bounded = true;
1124 static _GLIBCXX_USE_CONSTEXPR bool is_modulo = false;
1125
1126 static _GLIBCXX_USE_CONSTEXPR bool traps = __glibcxx_integral_traps;
1127 static _GLIBCXX_USE_CONSTEXPR bool tinyness_before = false;
1128 static _GLIBCXX_USE_CONSTEXPR float_round_style round_style
1129 = round_toward_zero;
1130 };
1131
1132 /// numeric_limits<unsigned int> specialization.
1133 template<>
1134 struct numeric_limits<unsigned int>
1135 {
1136 static _GLIBCXX_USE_CONSTEXPR bool is_specialized = true;
1137
1138 static _GLIBCXX_CONSTEXPR unsigned int
1139 min() _GLIBCXX_USE_NOEXCEPT { return 0; }
1140
1141 static _GLIBCXX_CONSTEXPR unsigned int
1142 max() _GLIBCXX_USE_NOEXCEPT { return __INT_MAX__ * 2U + 1; }
1143
1144#if __cplusplus >= 201103L
1145 static constexpr unsigned int
1146 lowest() noexcept { return min(); }
1147#endif
1148
1149 static _GLIBCXX_USE_CONSTEXPR int digits
1150 = __glibcxx_digits (unsigned int);
1151 static _GLIBCXX_USE_CONSTEXPR int digits10
1152 = __glibcxx_digits10 (unsigned int);
1153#if __cplusplus >= 201103L
1154 static constexpr int max_digits10 = 0;
1155#endif
1156 static _GLIBCXX_USE_CONSTEXPR bool is_signed = false;
1157 static _GLIBCXX_USE_CONSTEXPR bool is_integer = true;
1158 static _GLIBCXX_USE_CONSTEXPR bool is_exact = true;
1159 static _GLIBCXX_USE_CONSTEXPR int radix = 2;
1160
1161 static _GLIBCXX_CONSTEXPR unsigned int
1162 epsilon() _GLIBCXX_USE_NOEXCEPT { return 0; }
1163
1164 static _GLIBCXX_CONSTEXPR unsigned int
1165 round_error() _GLIBCXX_USE_NOEXCEPT { return 0; }
1166
1167 static _GLIBCXX_USE_CONSTEXPR int min_exponent = 0;
1168 static _GLIBCXX_USE_CONSTEXPR int min_exponent10 = 0;
1169 static _GLIBCXX_USE_CONSTEXPR int max_exponent = 0;
1170 static _GLIBCXX_USE_CONSTEXPR int max_exponent10 = 0;
1171
1172 static _GLIBCXX_USE_CONSTEXPR bool has_infinity = false;
1173 static _GLIBCXX_USE_CONSTEXPR bool has_quiet_NaN = false;
1174 static _GLIBCXX_USE_CONSTEXPR bool has_signaling_NaN = false;
1175 static _GLIBCXX_USE_CONSTEXPR float_denorm_style has_denorm
1176 = denorm_absent;
1177 static _GLIBCXX_USE_CONSTEXPR bool has_denorm_loss = false;
1178
1179 static _GLIBCXX_CONSTEXPR unsigned int
1180 infinity() _GLIBCXX_USE_NOEXCEPT { return static_cast<unsigned int>(0); }
1181
1182 static _GLIBCXX_CONSTEXPR unsigned int
1183 quiet_NaN() _GLIBCXX_USE_NOEXCEPT
1184 { return static_cast<unsigned int>(0); }
1185
1186 static _GLIBCXX_CONSTEXPR unsigned int
1187 signaling_NaN() _GLIBCXX_USE_NOEXCEPT
1188 { return static_cast<unsigned int>(0); }
1189
1190 static _GLIBCXX_CONSTEXPR unsigned int
1191 denorm_min() _GLIBCXX_USE_NOEXCEPT
1192 { return static_cast<unsigned int>(0); }
1193
1194 static _GLIBCXX_USE_CONSTEXPR bool is_iec559 = false;
1195 static _GLIBCXX_USE_CONSTEXPR bool is_bounded = true;
1196 static _GLIBCXX_USE_CONSTEXPR bool is_modulo = true;
1197
1198 static _GLIBCXX_USE_CONSTEXPR bool traps = __glibcxx_integral_traps;
1199 static _GLIBCXX_USE_CONSTEXPR bool tinyness_before = false;
1200 static _GLIBCXX_USE_CONSTEXPR float_round_style round_style
1201 = round_toward_zero;
1202 };
1203
1204 /// numeric_limits<long> specialization.
1205 template<>
1206 struct numeric_limits<long>
1207 {
1208 static _GLIBCXX_USE_CONSTEXPR bool is_specialized = true;
1209
1210 static _GLIBCXX_CONSTEXPR long
1211 min() _GLIBCXX_USE_NOEXCEPT { return -__LONG_MAX__ - 1; }
1212
1213 static _GLIBCXX_CONSTEXPR long
1214 max() _GLIBCXX_USE_NOEXCEPT { return __LONG_MAX__; }
1215
1216#if __cplusplus >= 201103L
1217 static constexpr long
1218 lowest() noexcept { return min(); }
1219#endif
1220
1221 static _GLIBCXX_USE_CONSTEXPR int digits = __glibcxx_digits (long);
1222 static _GLIBCXX_USE_CONSTEXPR int digits10 = __glibcxx_digits10 (long);
1223#if __cplusplus >= 201103L
1224 static constexpr int max_digits10 = 0;
1225#endif
1226 static _GLIBCXX_USE_CONSTEXPR bool is_signed = true;
1227 static _GLIBCXX_USE_CONSTEXPR bool is_integer = true;
1228 static _GLIBCXX_USE_CONSTEXPR bool is_exact = true;
1229 static _GLIBCXX_USE_CONSTEXPR int radix = 2;
1230
1231 static _GLIBCXX_CONSTEXPR long
1232 epsilon() _GLIBCXX_USE_NOEXCEPT { return 0; }
1233
1234 static _GLIBCXX_CONSTEXPR long
1235 round_error() _GLIBCXX_USE_NOEXCEPT { return 0; }
1236
1237 static _GLIBCXX_USE_CONSTEXPR int min_exponent = 0;
1238 static _GLIBCXX_USE_CONSTEXPR int min_exponent10 = 0;
1239 static _GLIBCXX_USE_CONSTEXPR int max_exponent = 0;
1240 static _GLIBCXX_USE_CONSTEXPR int max_exponent10 = 0;
1241
1242 static _GLIBCXX_USE_CONSTEXPR bool has_infinity = false;
1243 static _GLIBCXX_USE_CONSTEXPR bool has_quiet_NaN = false;
1244 static _GLIBCXX_USE_CONSTEXPR bool has_signaling_NaN = false;
1245 static _GLIBCXX_USE_CONSTEXPR float_denorm_style has_denorm
1246 = denorm_absent;
1247 static _GLIBCXX_USE_CONSTEXPR bool has_denorm_loss = false;
1248
1249 static _GLIBCXX_CONSTEXPR long
1250 infinity() _GLIBCXX_USE_NOEXCEPT { return static_cast<long>(0); }
1251
1252 static _GLIBCXX_CONSTEXPR long
1253 quiet_NaN() _GLIBCXX_USE_NOEXCEPT { return static_cast<long>(0); }
1254
1255 static _GLIBCXX_CONSTEXPR long
1256 signaling_NaN() _GLIBCXX_USE_NOEXCEPT { return static_cast<long>(0); }
1257
1258 static _GLIBCXX_CONSTEXPR long
1259 denorm_min() _GLIBCXX_USE_NOEXCEPT { return static_cast<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 = false;
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<unsigned long> specialization.
1272 template<>
1273 struct numeric_limits<unsigned long>
1274 {
1275 static _GLIBCXX_USE_CONSTEXPR bool is_specialized = true;
1276
1277 static _GLIBCXX_CONSTEXPR unsigned long
1278 min() _GLIBCXX_USE_NOEXCEPT { return 0; }
1279
1280 static _GLIBCXX_CONSTEXPR unsigned long
1281 max() _GLIBCXX_USE_NOEXCEPT { return __LONG_MAX__ * 2UL + 1; }
1282
1283#if __cplusplus >= 201103L
1284 static constexpr unsigned long
1285 lowest() noexcept { return min(); }
1286#endif
1287
1288 static _GLIBCXX_USE_CONSTEXPR int digits
1289 = __glibcxx_digits (unsigned long);
1290 static _GLIBCXX_USE_CONSTEXPR int digits10
1291 = __glibcxx_digits10 (unsigned long);
1292#if __cplusplus >= 201103L
1293 static constexpr int max_digits10 = 0;
1294#endif
1295 static _GLIBCXX_USE_CONSTEXPR bool is_signed = false;
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 unsigned long
1301 epsilon() _GLIBCXX_USE_NOEXCEPT { return 0; }
1302
1303 static _GLIBCXX_CONSTEXPR unsigned 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 unsigned long
1319 infinity() _GLIBCXX_USE_NOEXCEPT
1320 { return static_cast<unsigned long>(0); }
1321
1322 static _GLIBCXX_CONSTEXPR unsigned long
1323 quiet_NaN() _GLIBCXX_USE_NOEXCEPT
1324 { return static_cast<unsigned long>(0); }
1325
1326 static _GLIBCXX_CONSTEXPR unsigned long
1327 signaling_NaN() _GLIBCXX_USE_NOEXCEPT
1328 { return static_cast<unsigned long>(0); }
1329
1330 static _GLIBCXX_CONSTEXPR unsigned long
1331 denorm_min() _GLIBCXX_USE_NOEXCEPT
1332 { return static_cast<unsigned long>(0); }
1333
1334 static _GLIBCXX_USE_CONSTEXPR bool is_iec559 = false;
1335 static _GLIBCXX_USE_CONSTEXPR bool is_bounded = true;
1336 static _GLIBCXX_USE_CONSTEXPR bool is_modulo = true;
1337
1338 static _GLIBCXX_USE_CONSTEXPR bool traps = __glibcxx_integral_traps;
1339 static _GLIBCXX_USE_CONSTEXPR bool tinyness_before = false;
1340 static _GLIBCXX_USE_CONSTEXPR float_round_style round_style
1341 = round_toward_zero;
1342 };
1343
1344 /// numeric_limits<long long> specialization.
1345 template<>
1346 struct numeric_limits<long long>
1347 {
1348 static _GLIBCXX_USE_CONSTEXPR bool is_specialized = true;
1349
1350 static _GLIBCXX_CONSTEXPR long long
1351 min() _GLIBCXX_USE_NOEXCEPT { return -__LONG_LONG_MAX__ - 1; }
1352
1353 static _GLIBCXX_CONSTEXPR long long
1354 max() _GLIBCXX_USE_NOEXCEPT { return __LONG_LONG_MAX__; }
1355
1356#if __cplusplus >= 201103L
1357 static constexpr long long
1358 lowest() noexcept { return min(); }
1359#endif
1360
1361 static _GLIBCXX_USE_CONSTEXPR int digits
1362 = __glibcxx_digits (long long);
1363 static _GLIBCXX_USE_CONSTEXPR int digits10
1364 = __glibcxx_digits10 (long long);
1365#if __cplusplus >= 201103L
1366 static constexpr int max_digits10 = 0;
1367#endif
1368 static _GLIBCXX_USE_CONSTEXPR bool is_signed = true;
1369 static _GLIBCXX_USE_CONSTEXPR bool is_integer = true;
1370 static _GLIBCXX_USE_CONSTEXPR bool is_exact = true;
1371 static _GLIBCXX_USE_CONSTEXPR int radix = 2;
1372
1373 static _GLIBCXX_CONSTEXPR long long
1374 epsilon() _GLIBCXX_USE_NOEXCEPT { return 0; }
1375
1376 static _GLIBCXX_CONSTEXPR long long
1377 round_error() _GLIBCXX_USE_NOEXCEPT { return 0; }
1378
1379 static _GLIBCXX_USE_CONSTEXPR int min_exponent = 0;
1380 static _GLIBCXX_USE_CONSTEXPR int min_exponent10 = 0;
1381 static _GLIBCXX_USE_CONSTEXPR int max_exponent = 0;
1382 static _GLIBCXX_USE_CONSTEXPR int max_exponent10 = 0;
1383
1384 static _GLIBCXX_USE_CONSTEXPR bool has_infinity = false;
1385 static _GLIBCXX_USE_CONSTEXPR bool has_quiet_NaN = false;
1386 static _GLIBCXX_USE_CONSTEXPR bool has_signaling_NaN = false;
1387 static _GLIBCXX_USE_CONSTEXPR float_denorm_style has_denorm
1388 = denorm_absent;
1389 static _GLIBCXX_USE_CONSTEXPR bool has_denorm_loss = false;
1390
1391 static _GLIBCXX_CONSTEXPR long long
1392 infinity() _GLIBCXX_USE_NOEXCEPT { return static_cast<long long>(0); }
1393
1394 static _GLIBCXX_CONSTEXPR long long
1395 quiet_NaN() _GLIBCXX_USE_NOEXCEPT { return static_cast<long long>(0); }
1396
1397 static _GLIBCXX_CONSTEXPR long long
1398 signaling_NaN() _GLIBCXX_USE_NOEXCEPT
1399 { return static_cast<long long>(0); }
1400
1401 static _GLIBCXX_CONSTEXPR long long
1402 denorm_min() _GLIBCXX_USE_NOEXCEPT { return static_cast<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 = false;
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 /// numeric_limits<unsigned long long> specialization.
1415 template<>
1416 struct numeric_limits<unsigned long long>
1417 {
1418 static _GLIBCXX_USE_CONSTEXPR bool is_specialized = true;
1419
1420 static _GLIBCXX_CONSTEXPR unsigned long long
1421 min() _GLIBCXX_USE_NOEXCEPT { return 0; }
1422
1423 static _GLIBCXX_CONSTEXPR unsigned long long
1424 max() _GLIBCXX_USE_NOEXCEPT { return __LONG_LONG_MAX__ * 2ULL + 1; }
1425
1426#if __cplusplus >= 201103L
1427 static constexpr unsigned long long
1428 lowest() noexcept { return min(); }
1429#endif
1430
1431 static _GLIBCXX_USE_CONSTEXPR int digits
1432 = __glibcxx_digits (unsigned long long);
1433 static _GLIBCXX_USE_CONSTEXPR int digits10
1434 = __glibcxx_digits10 (unsigned long long);
1435#if __cplusplus >= 201103L
1436 static constexpr int max_digits10 = 0;
1437#endif
1438 static _GLIBCXX_USE_CONSTEXPR bool is_signed = false;
1439 static _GLIBCXX_USE_CONSTEXPR bool is_integer = true;
1440 static _GLIBCXX_USE_CONSTEXPR bool is_exact = true;
1441 static _GLIBCXX_USE_CONSTEXPR int radix = 2;
1442
1443 static _GLIBCXX_CONSTEXPR unsigned long long
1444 epsilon() _GLIBCXX_USE_NOEXCEPT { return 0; }
1445
1446 static _GLIBCXX_CONSTEXPR unsigned long long
1447 round_error() _GLIBCXX_USE_NOEXCEPT { return 0; }
1448
1449 static _GLIBCXX_USE_CONSTEXPR int min_exponent = 0;
1450 static _GLIBCXX_USE_CONSTEXPR int min_exponent10 = 0;
1451 static _GLIBCXX_USE_CONSTEXPR int max_exponent = 0;
1452 static _GLIBCXX_USE_CONSTEXPR int max_exponent10 = 0;
1453
1454 static _GLIBCXX_USE_CONSTEXPR bool has_infinity = false;
1455 static _GLIBCXX_USE_CONSTEXPR bool has_quiet_NaN = false;
1456 static _GLIBCXX_USE_CONSTEXPR bool has_signaling_NaN = false;
1457 static _GLIBCXX_USE_CONSTEXPR float_denorm_style has_denorm
1458 = denorm_absent;
1459 static _GLIBCXX_USE_CONSTEXPR bool has_denorm_loss = false;
1460
1461 static _GLIBCXX_CONSTEXPR unsigned long long
1462 infinity() _GLIBCXX_USE_NOEXCEPT
1463 { return static_cast<unsigned long long>(0); }
1464
1465 static _GLIBCXX_CONSTEXPR unsigned long long
1466 quiet_NaN() _GLIBCXX_USE_NOEXCEPT
1467 { return static_cast<unsigned long long>(0); }
1468
1469 static _GLIBCXX_CONSTEXPR unsigned long long
1470 signaling_NaN() _GLIBCXX_USE_NOEXCEPT
1471 { return static_cast<unsigned long long>(0); }
1472
1473 static _GLIBCXX_CONSTEXPR unsigned long long
1474 denorm_min() _GLIBCXX_USE_NOEXCEPT
1475 { return static_cast<unsigned long long>(0); }
1476
1477 static _GLIBCXX_USE_CONSTEXPR bool is_iec559 = false;
1478 static _GLIBCXX_USE_CONSTEXPR bool is_bounded = true;
1479 static _GLIBCXX_USE_CONSTEXPR bool is_modulo = true;
1480
1481 static _GLIBCXX_USE_CONSTEXPR bool traps = __glibcxx_integral_traps;
1482 static _GLIBCXX_USE_CONSTEXPR bool tinyness_before = false;
1483 static _GLIBCXX_USE_CONSTEXPR float_round_style round_style
1484 = round_toward_zero;
1485 };
1486
1487#define __INT_N(TYPE, BITSIZE, EXT, UEXT) \
1488 __extension__ \
1489 template<> \
1490 struct numeric_limits<TYPE> \
1491 { \
1492 static _GLIBCXX_USE_CONSTEXPR bool is_specialized = true; \
1493 \
1494 static _GLIBCXX_CONSTEXPR TYPE \
1495 min() _GLIBCXX_USE_NOEXCEPT { return __glibcxx_min_b (TYPE, BITSIZE); } \
1496 \
1497 static _GLIBCXX_CONSTEXPR TYPE \
1498 max() _GLIBCXX_USE_NOEXCEPT { return __glibcxx_max_b (TYPE, BITSIZE); } \
1499 \
1500 static _GLIBCXX_USE_CONSTEXPR int digits \
1501 = BITSIZE - 1; \
1502 static _GLIBCXX_USE_CONSTEXPR int digits10 \
1503 = (BITSIZE - 1) * 643L / 2136; \
1504 \
1505 static _GLIBCXX_USE_CONSTEXPR bool is_signed = true; \
1506 static _GLIBCXX_USE_CONSTEXPR bool is_integer = true; \
1507 static _GLIBCXX_USE_CONSTEXPR bool is_exact = true; \
1508 static _GLIBCXX_USE_CONSTEXPR int radix = 2; \
1509 \
1510 static _GLIBCXX_CONSTEXPR TYPE \
1511 epsilon() _GLIBCXX_USE_NOEXCEPT { return 0; } \
1512 \
1513 static _GLIBCXX_CONSTEXPR TYPE \
1514 round_error() _GLIBCXX_USE_NOEXCEPT { return 0; } \
1515 \
1516 EXT \
1517 \
1518 static _GLIBCXX_USE_CONSTEXPR int min_exponent = 0; \
1519 static _GLIBCXX_USE_CONSTEXPR int min_exponent10 = 0; \
1520 static _GLIBCXX_USE_CONSTEXPR int max_exponent = 0; \
1521 static _GLIBCXX_USE_CONSTEXPR int max_exponent10 = 0; \
1522 \
1523 static _GLIBCXX_USE_CONSTEXPR bool has_infinity = false; \
1524 static _GLIBCXX_USE_CONSTEXPR bool has_quiet_NaN = false; \
1525 static _GLIBCXX_USE_CONSTEXPR bool has_signaling_NaN = false; \
1526 static _GLIBCXX_USE_CONSTEXPR float_denorm_style has_denorm \
1527 = denorm_absent; \
1528 static _GLIBCXX_USE_CONSTEXPR bool has_denorm_loss = false; \
1529 \
1530 static _GLIBCXX_CONSTEXPR TYPE \
1531 infinity() _GLIBCXX_USE_NOEXCEPT \
1532 { return static_cast<TYPE>(0); } \
1533 \
1534 static _GLIBCXX_CONSTEXPR TYPE \
1535 quiet_NaN() _GLIBCXX_USE_NOEXCEPT \
1536 { return static_cast<TYPE>(0); } \
1537 \
1538 static _GLIBCXX_CONSTEXPR TYPE \
1539 signaling_NaN() _GLIBCXX_USE_NOEXCEPT \
1540 { return static_cast<TYPE>(0); } \
1541 \
1542 static _GLIBCXX_CONSTEXPR TYPE \
1543 denorm_min() _GLIBCXX_USE_NOEXCEPT \
1544 { return static_cast<TYPE>(0); } \
1545 \
1546 static _GLIBCXX_USE_CONSTEXPR bool is_iec559 = false; \
1547 static _GLIBCXX_USE_CONSTEXPR bool is_bounded = true; \
1548 static _GLIBCXX_USE_CONSTEXPR bool is_modulo = false; \
1549 \
1550 static _GLIBCXX_USE_CONSTEXPR bool traps \
1551 = __glibcxx_integral_traps; \
1552 static _GLIBCXX_USE_CONSTEXPR bool tinyness_before = false; \
1553 static _GLIBCXX_USE_CONSTEXPR float_round_style round_style \
1554 = round_toward_zero; \
1555 }; \
1556 \
1557 __extension__ \
1558 template<> \
1559 struct numeric_limits<unsigned TYPE> \
1560 { \
1561 static _GLIBCXX_USE_CONSTEXPR bool is_specialized = true; \
1562 \
1563 static _GLIBCXX_CONSTEXPR unsigned TYPE \
1564 min() _GLIBCXX_USE_NOEXCEPT { return 0; } \
1565 \
1566 static _GLIBCXX_CONSTEXPR unsigned TYPE \
1567 max() _GLIBCXX_USE_NOEXCEPT \
1568 { return __glibcxx_max_b (unsigned TYPE, BITSIZE); } \
1569 \
1570 UEXT \
1571 \
1572 static _GLIBCXX_USE_CONSTEXPR int digits \
1573 = BITSIZE; \
1574 static _GLIBCXX_USE_CONSTEXPR int digits10 \
1575 = BITSIZE * 643L / 2136; \
1576 static _GLIBCXX_USE_CONSTEXPR bool is_signed = false; \
1577 static _GLIBCXX_USE_CONSTEXPR bool is_integer = true; \
1578 static _GLIBCXX_USE_CONSTEXPR bool is_exact = true; \
1579 static _GLIBCXX_USE_CONSTEXPR int radix = 2; \
1580 \
1581 static _GLIBCXX_CONSTEXPR unsigned TYPE \
1582 epsilon() _GLIBCXX_USE_NOEXCEPT { return 0; } \
1583 \
1584 static _GLIBCXX_CONSTEXPR unsigned TYPE \
1585 round_error() _GLIBCXX_USE_NOEXCEPT { return 0; } \
1586 \
1587 static _GLIBCXX_USE_CONSTEXPR int min_exponent = 0; \
1588 static _GLIBCXX_USE_CONSTEXPR int min_exponent10 = 0; \
1589 static _GLIBCXX_USE_CONSTEXPR int max_exponent = 0; \
1590 static _GLIBCXX_USE_CONSTEXPR int max_exponent10 = 0; \
1591 \
1592 static _GLIBCXX_USE_CONSTEXPR bool has_infinity = false; \
1593 static _GLIBCXX_USE_CONSTEXPR bool has_quiet_NaN = false; \
1594 static _GLIBCXX_USE_CONSTEXPR bool has_signaling_NaN = false; \
1595 static _GLIBCXX_USE_CONSTEXPR float_denorm_style has_denorm \
1596 = denorm_absent; \
1597 static _GLIBCXX_USE_CONSTEXPR bool has_denorm_loss = false; \
1598 \
1599 static _GLIBCXX_CONSTEXPR unsigned TYPE \
1600 infinity() _GLIBCXX_USE_NOEXCEPT \
1601 { return static_cast<unsigned TYPE>(0); } \
1602 \
1603 static _GLIBCXX_CONSTEXPR unsigned TYPE \
1604 quiet_NaN() _GLIBCXX_USE_NOEXCEPT \
1605 { return static_cast<unsigned TYPE>(0); } \
1606 \
1607 static _GLIBCXX_CONSTEXPR unsigned TYPE \
1608 signaling_NaN() _GLIBCXX_USE_NOEXCEPT \
1609 { return static_cast<unsigned TYPE>(0); } \
1610 \
1611 static _GLIBCXX_CONSTEXPR unsigned TYPE \
1612 denorm_min() _GLIBCXX_USE_NOEXCEPT \
1613 { return static_cast<unsigned TYPE>(0); } \
1614 \
1615 static _GLIBCXX_USE_CONSTEXPR bool is_iec559 = false; \
1616 static _GLIBCXX_USE_CONSTEXPR bool is_bounded = true; \
1617 static _GLIBCXX_USE_CONSTEXPR bool is_modulo = true; \
1618 \
1619 static _GLIBCXX_USE_CONSTEXPR bool traps = __glibcxx_integral_traps; \
1620 static _GLIBCXX_USE_CONSTEXPR bool tinyness_before = false; \
1621 static _GLIBCXX_USE_CONSTEXPR float_round_style round_style \
1622 = round_toward_zero; \
1623 };
1624
1625#if __cplusplus >= 201103L
1626
1627#define __INT_N_201103(TYPE) \
1628 static constexpr TYPE \
1629 lowest() noexcept { return min(); } \
1630 static constexpr int max_digits10 = 0;
1631
1632#define __INT_N_U201103(TYPE) \
1633 static constexpr unsigned TYPE \
1634 lowest() noexcept { return min(); } \
1635 static constexpr int max_digits10 = 0;
1636
1637#else
1638#define __INT_N_201103(TYPE)
1639#define __INT_N_U201103(TYPE)
1640#endif
1641
1642#ifdef __GLIBCXX_TYPE_INT_N_0
1643 __INT_N(__GLIBCXX_TYPE_INT_N_0, __GLIBCXX_BITSIZE_INT_N_0,
1644 __INT_N_201103 (__GLIBCXX_TYPE_INT_N_0),
1645 __INT_N_U201103 (__GLIBCXX_TYPE_INT_N_0))
1646#endif
1647#ifdef __GLIBCXX_TYPE_INT_N_1
1648 __INT_N (__GLIBCXX_TYPE_INT_N_1, __GLIBCXX_BITSIZE_INT_N_1,
1649 __INT_N_201103 (__GLIBCXX_TYPE_INT_N_1),
1650 __INT_N_U201103 (__GLIBCXX_TYPE_INT_N_1))
1651#endif
1652#ifdef __GLIBCXX_TYPE_INT_N_2
1653 __INT_N (__GLIBCXX_TYPE_INT_N_2, __GLIBCXX_BITSIZE_INT_N_2,
1654 __INT_N_201103 (__GLIBCXX_TYPE_INT_N_2),
1655 __INT_N_U201103 (__GLIBCXX_TYPE_INT_N_2))
1656#endif
1657#ifdef __GLIBCXX_TYPE_INT_N_3
1658 __INT_N (__GLIBCXX_TYPE_INT_N_3, __GLIBCXX_BITSIZE_INT_N_3,
1659 __INT_N_201103 (__GLIBCXX_TYPE_INT_N_3),
1660 __INT_N_U201103 (__GLIBCXX_TYPE_INT_N_3))
1661#endif
1662
1663#if defined __STRICT_ANSI__ && defined __SIZEOF_INT128__
1664 __INT_N(__int128, 128,
1665 __INT_N_201103 (__int128),
1666 __INT_N_U201103 (__int128))
1667#endif
1668
1669#undef __INT_N
1670#undef __INT_N_201103
1671#undef __INT_N_U201103
1672
1673
1674 /// numeric_limits<float> specialization.
1675 template<>
1676 struct numeric_limits<float>
1677 {
1678 static _GLIBCXX_USE_CONSTEXPR bool is_specialized = true;
1679
1680 static _GLIBCXX_CONSTEXPR float
1681 min() _GLIBCXX_USE_NOEXCEPT { return __FLT_MIN__; }
1682
1683 static _GLIBCXX_CONSTEXPR float
1684 max() _GLIBCXX_USE_NOEXCEPT { return __FLT_MAX__; }
1685
1686#if __cplusplus >= 201103L
1687 static constexpr float
1688 lowest() noexcept { return -__FLT_MAX__; }
1689#endif
1690
1691 static _GLIBCXX_USE_CONSTEXPR int digits = __FLT_MANT_DIG__;
1692 static _GLIBCXX_USE_CONSTEXPR int digits10 = __FLT_DIG__;
1693#if __cplusplus >= 201103L
1694 static constexpr int max_digits10
1695 = __glibcxx_max_digits10 (__FLT_MANT_DIG__);
1696#endif
1697 static _GLIBCXX_USE_CONSTEXPR bool is_signed = true;
1698 static _GLIBCXX_USE_CONSTEXPR bool is_integer = false;
1699 static _GLIBCXX_USE_CONSTEXPR bool is_exact = false;
1700 static _GLIBCXX_USE_CONSTEXPR int radix = __FLT_RADIX__;
1701
1702 static _GLIBCXX_CONSTEXPR float
1703 epsilon() _GLIBCXX_USE_NOEXCEPT { return __FLT_EPSILON__; }
1704
1705 static _GLIBCXX_CONSTEXPR float
1706 round_error() _GLIBCXX_USE_NOEXCEPT { return 0.5F; }
1707
1708 static _GLIBCXX_USE_CONSTEXPR int min_exponent = __FLT_MIN_EXP__;
1709 static _GLIBCXX_USE_CONSTEXPR int min_exponent10 = __FLT_MIN_10_EXP__;
1710 static _GLIBCXX_USE_CONSTEXPR int max_exponent = __FLT_MAX_EXP__;
1711 static _GLIBCXX_USE_CONSTEXPR int max_exponent10 = __FLT_MAX_10_EXP__;
1712
1713 static _GLIBCXX_USE_CONSTEXPR bool has_infinity = __FLT_HAS_INFINITY__;
1714 static _GLIBCXX_USE_CONSTEXPR bool has_quiet_NaN = __FLT_HAS_QUIET_NAN__;
1715 static _GLIBCXX_USE_CONSTEXPR bool has_signaling_NaN = has_quiet_NaN;
1716 static _GLIBCXX_USE_CONSTEXPR float_denorm_style has_denorm
1717 = bool(__FLT_HAS_DENORM__) ? denorm_present : denorm_absent;
1718 static _GLIBCXX_USE_CONSTEXPR bool has_denorm_loss
1719 = __glibcxx_float_has_denorm_loss;
1720
1721 static _GLIBCXX_CONSTEXPR float
1722 infinity() _GLIBCXX_USE_NOEXCEPT { return __builtin_huge_valf(); }
1723
1724 static _GLIBCXX_CONSTEXPR float
1725 quiet_NaN() _GLIBCXX_USE_NOEXCEPT { return __builtin_nanf(""); }
1726
1727 static _GLIBCXX_CONSTEXPR float
1728 signaling_NaN() _GLIBCXX_USE_NOEXCEPT { return __builtin_nansf(""); }
1729
1730 static _GLIBCXX_CONSTEXPR float
1731 denorm_min() _GLIBCXX_USE_NOEXCEPT { return __FLT_DENORM_MIN__; }
1732
1733 static _GLIBCXX_USE_CONSTEXPR bool is_iec559
1734 = has_infinity && has_quiet_NaN && has_denorm == denorm_present;
1735 static _GLIBCXX_USE_CONSTEXPR bool is_bounded = true;
1736 static _GLIBCXX_USE_CONSTEXPR bool is_modulo = false;
1737
1738 static _GLIBCXX_USE_CONSTEXPR bool traps = __glibcxx_float_traps;
1739 static _GLIBCXX_USE_CONSTEXPR bool tinyness_before
1740 = __glibcxx_float_tinyness_before;
1741 static _GLIBCXX_USE_CONSTEXPR float_round_style round_style
1742 = round_to_nearest;
1743 };
1744
1745#undef __glibcxx_float_has_denorm_loss
1746#undef __glibcxx_float_traps
1747#undef __glibcxx_float_tinyness_before
1748
1749 /// numeric_limits<double> specialization.
1750 template<>
1751 struct numeric_limits<double>
1752 {
1753 static _GLIBCXX_USE_CONSTEXPR bool is_specialized = true;
1754
1755 static _GLIBCXX_CONSTEXPR double
1756 min() _GLIBCXX_USE_NOEXCEPT { return __DBL_MIN__; }
1757
1758 static _GLIBCXX_CONSTEXPR double
1759 max() _GLIBCXX_USE_NOEXCEPT { return __DBL_MAX__; }
1760
1761#if __cplusplus >= 201103L
1762 static constexpr double
1763 lowest() noexcept { return -__DBL_MAX__; }
1764#endif
1765
1766 static _GLIBCXX_USE_CONSTEXPR int digits = __DBL_MANT_DIG__;
1767 static _GLIBCXX_USE_CONSTEXPR int digits10 = __DBL_DIG__;
1768#if __cplusplus >= 201103L
1769 static constexpr int max_digits10
1770 = __glibcxx_max_digits10 (__DBL_MANT_DIG__);
1771#endif
1772 static _GLIBCXX_USE_CONSTEXPR bool is_signed = true;
1773 static _GLIBCXX_USE_CONSTEXPR bool is_integer = false;
1774 static _GLIBCXX_USE_CONSTEXPR bool is_exact = false;
1775 static _GLIBCXX_USE_CONSTEXPR int radix = __FLT_RADIX__;
1776
1777 static _GLIBCXX_CONSTEXPR double
1778 epsilon() _GLIBCXX_USE_NOEXCEPT { return __DBL_EPSILON__; }
1779
1780 static _GLIBCXX_CONSTEXPR double
1781 round_error() _GLIBCXX_USE_NOEXCEPT { return 0.5; }
1782
1783 static _GLIBCXX_USE_CONSTEXPR int min_exponent = __DBL_MIN_EXP__;
1784 static _GLIBCXX_USE_CONSTEXPR int min_exponent10 = __DBL_MIN_10_EXP__;
1785 static _GLIBCXX_USE_CONSTEXPR int max_exponent = __DBL_MAX_EXP__;
1786 static _GLIBCXX_USE_CONSTEXPR int max_exponent10 = __DBL_MAX_10_EXP__;
1787
1788 static _GLIBCXX_USE_CONSTEXPR bool has_infinity = __DBL_HAS_INFINITY__;
1789 static _GLIBCXX_USE_CONSTEXPR bool has_quiet_NaN = __DBL_HAS_QUIET_NAN__;
1790 static _GLIBCXX_USE_CONSTEXPR bool has_signaling_NaN = has_quiet_NaN;
1791 static _GLIBCXX_USE_CONSTEXPR float_denorm_style has_denorm
1792 = bool(__DBL_HAS_DENORM__) ? denorm_present : denorm_absent;
1793 static _GLIBCXX_USE_CONSTEXPR bool has_denorm_loss
1794 = __glibcxx_double_has_denorm_loss;
1795
1796 static _GLIBCXX_CONSTEXPR double
1797 infinity() _GLIBCXX_USE_NOEXCEPT { return __builtin_huge_val(); }
1798
1799 static _GLIBCXX_CONSTEXPR double
1800 quiet_NaN() _GLIBCXX_USE_NOEXCEPT { return __builtin_nan(""); }
1801
1802 static _GLIBCXX_CONSTEXPR double
1803 signaling_NaN() _GLIBCXX_USE_NOEXCEPT { return __builtin_nans(""); }
1804
1805 static _GLIBCXX_CONSTEXPR double
1806 denorm_min() _GLIBCXX_USE_NOEXCEPT { return __DBL_DENORM_MIN__; }
1807
1808 static _GLIBCXX_USE_CONSTEXPR bool is_iec559
1809 = has_infinity && has_quiet_NaN && has_denorm == denorm_present;
1810 static _GLIBCXX_USE_CONSTEXPR bool is_bounded = true;
1811 static _GLIBCXX_USE_CONSTEXPR bool is_modulo = false;
1812
1813 static _GLIBCXX_USE_CONSTEXPR bool traps = __glibcxx_double_traps;
1814 static _GLIBCXX_USE_CONSTEXPR bool tinyness_before
1815 = __glibcxx_double_tinyness_before;
1816 static _GLIBCXX_USE_CONSTEXPR float_round_style round_style
1817 = round_to_nearest;
1818 };
1819
1820#undef __glibcxx_double_has_denorm_loss
1821#undef __glibcxx_double_traps
1822#undef __glibcxx_double_tinyness_before
1823
1824 /// numeric_limits<long double> specialization.
1825 template<>
1826 struct numeric_limits<long double>
1827 {
1828 static _GLIBCXX_USE_CONSTEXPR bool is_specialized = true;
1829
1830 static _GLIBCXX_CONSTEXPR long double
1831 min() _GLIBCXX_USE_NOEXCEPT { return __LDBL_MIN__; }
1832
1833 static _GLIBCXX_CONSTEXPR long double
1834 max() _GLIBCXX_USE_NOEXCEPT { return __LDBL_MAX__; }
1835
1836#if __cplusplus >= 201103L
1837 static constexpr long double
1838 lowest() noexcept { return -__LDBL_MAX__; }
1839#endif
1840
1841 static _GLIBCXX_USE_CONSTEXPR int digits = __LDBL_MANT_DIG__;
1842 static _GLIBCXX_USE_CONSTEXPR int digits10 = __LDBL_DIG__;
1843#if __cplusplus >= 201103L
1844 static _GLIBCXX_USE_CONSTEXPR int max_digits10
1845 = __glibcxx_max_digits10 (__LDBL_MANT_DIG__);
1846#endif
1847 static _GLIBCXX_USE_CONSTEXPR bool is_signed = true;
1848 static _GLIBCXX_USE_CONSTEXPR bool is_integer = false;
1849 static _GLIBCXX_USE_CONSTEXPR bool is_exact = false;
1850 static _GLIBCXX_USE_CONSTEXPR int radix = __FLT_RADIX__;
1851
1852 static _GLIBCXX_CONSTEXPR long double
1853 epsilon() _GLIBCXX_USE_NOEXCEPT { return __LDBL_EPSILON__; }
1854
1855 static _GLIBCXX_CONSTEXPR long double
1856 round_error() _GLIBCXX_USE_NOEXCEPT { return 0.5L; }
1857
1858 static _GLIBCXX_USE_CONSTEXPR int min_exponent = __LDBL_MIN_EXP__;
1859 static _GLIBCXX_USE_CONSTEXPR int min_exponent10 = __LDBL_MIN_10_EXP__;
1860 static _GLIBCXX_USE_CONSTEXPR int max_exponent = __LDBL_MAX_EXP__;
1861 static _GLIBCXX_USE_CONSTEXPR int max_exponent10 = __LDBL_MAX_10_EXP__;
1862
1863 static _GLIBCXX_USE_CONSTEXPR bool has_infinity = __LDBL_HAS_INFINITY__;
1864 static _GLIBCXX_USE_CONSTEXPR bool has_quiet_NaN = __LDBL_HAS_QUIET_NAN__;
1865 static _GLIBCXX_USE_CONSTEXPR bool has_signaling_NaN = has_quiet_NaN;
1866 static _GLIBCXX_USE_CONSTEXPR float_denorm_style has_denorm
1867 = bool(__LDBL_HAS_DENORM__) ? denorm_present : denorm_absent;
1868 static _GLIBCXX_USE_CONSTEXPR bool has_denorm_loss
1869 = __glibcxx_long_double_has_denorm_loss;
1870
1871 static _GLIBCXX_CONSTEXPR long double
1872 infinity() _GLIBCXX_USE_NOEXCEPT { return __builtin_huge_vall(); }
1873
1874 static _GLIBCXX_CONSTEXPR long double
1875 quiet_NaN() _GLIBCXX_USE_NOEXCEPT { return __builtin_nanl(""); }
1876
1877 static _GLIBCXX_CONSTEXPR long double
1878 signaling_NaN() _GLIBCXX_USE_NOEXCEPT { return __builtin_nansl(""); }
1879
1880 static _GLIBCXX_CONSTEXPR long double
1881 denorm_min() _GLIBCXX_USE_NOEXCEPT { return __LDBL_DENORM_MIN__; }
1882
1883 static _GLIBCXX_USE_CONSTEXPR bool is_iec559
1884 = has_infinity && has_quiet_NaN && has_denorm == denorm_present;
1885 static _GLIBCXX_USE_CONSTEXPR bool is_bounded = true;
1886 static _GLIBCXX_USE_CONSTEXPR bool is_modulo = false;
1887
1888 static _GLIBCXX_USE_CONSTEXPR bool traps = __glibcxx_long_double_traps;
1889 static _GLIBCXX_USE_CONSTEXPR bool tinyness_before =
1890 __glibcxx_long_double_tinyness_before;
1891 static _GLIBCXX_USE_CONSTEXPR float_round_style round_style =
1892 round_to_nearest;
1893 };
1894
1895#undef __glibcxx_long_double_has_denorm_loss
1896#undef __glibcxx_long_double_traps
1897#undef __glibcxx_long_double_tinyness_before
1898
1899#define __glibcxx_concat3_(P,M,S) P ## M ## S
1900#define __glibcxx_concat3(P,M,S) __glibcxx_concat3_ (P,M,S)
1901
1902#if __cplusplus >= 201103L
1903# define __max_digits10 max_digits10
1904#endif
1905
1906#define __glibcxx_float_n(BITSIZE) \
1907 __extension__ \
1908 template<> \
1909 struct numeric_limits<_Float##BITSIZE> \
1910 { \
1911 static _GLIBCXX_USE_CONSTEXPR bool is_specialized = true; \
1912 \
1913 static _GLIBCXX_CONSTEXPR _Float##BITSIZE \
1914 min() _GLIBCXX_USE_NOEXCEPT \
1915 { return __glibcxx_concat3 (__FLT, BITSIZE, _MIN__); } \
1916 \
1917 static _GLIBCXX_CONSTEXPR _Float##BITSIZE \
1918 max() _GLIBCXX_USE_NOEXCEPT \
1919 { return __glibcxx_concat3 (__FLT, BITSIZE, _MAX__); } \
1920 \
1921 static _GLIBCXX_CONSTEXPR _Float##BITSIZE \
1922 lowest() _GLIBCXX_USE_NOEXCEPT \
1923 { return -__glibcxx_concat3 (__FLT, BITSIZE, _MAX__); } \
1924 \
1925 static _GLIBCXX_USE_CONSTEXPR int digits \
1926 = __glibcxx_concat3 (__FLT, BITSIZE, _MANT_DIG__); \
1927 static _GLIBCXX_USE_CONSTEXPR int digits10 \
1928 = __glibcxx_concat3 (__FLT, BITSIZE, _DIG__); \
1929 static _GLIBCXX_USE_CONSTEXPR int __max_digits10 \
1930 = __glibcxx_max_digits10 (__glibcxx_concat3 (__FLT, BITSIZE, \
1931 _MANT_DIG__)); \
1932 static _GLIBCXX_USE_CONSTEXPR bool is_signed = true; \
1933 static _GLIBCXX_USE_CONSTEXPR bool is_integer = false; \
1934 static _GLIBCXX_USE_CONSTEXPR bool is_exact = false; \
1935 static _GLIBCXX_USE_CONSTEXPR int radix = __FLT_RADIX__; \
1936 \
1937 static _GLIBCXX_CONSTEXPR _Float##BITSIZE \
1938 epsilon() _GLIBCXX_USE_NOEXCEPT \
1939 { return __glibcxx_concat3 (__FLT, BITSIZE, _EPSILON__); } \
1940 \
1941 static _GLIBCXX_CONSTEXPR _Float##BITSIZE \
1942 round_error() _GLIBCXX_USE_NOEXCEPT { return 0.5F##BITSIZE; } \
1943 \
1944 static _GLIBCXX_USE_CONSTEXPR int min_exponent \
1945 = __glibcxx_concat3 (__FLT, BITSIZE, _MIN_EXP__); \
1946 static _GLIBCXX_USE_CONSTEXPR int min_exponent10 \
1947 = __glibcxx_concat3 (__FLT, BITSIZE, _MIN_10_EXP__); \
1948 static _GLIBCXX_USE_CONSTEXPR int max_exponent \
1949 = __glibcxx_concat3 (__FLT, BITSIZE, _MAX_EXP__); \
1950 static _GLIBCXX_USE_CONSTEXPR int max_exponent10 \
1951 = __glibcxx_concat3 (__FLT, BITSIZE, _MAX_10_EXP__); \
1952 \
1953 static _GLIBCXX_USE_CONSTEXPR bool has_infinity \
1954 = __glibcxx_concat3 (__FLT, BITSIZE, _HAS_INFINITY__); \
1955 static _GLIBCXX_USE_CONSTEXPR bool has_quiet_NaN \
1956 = __glibcxx_concat3 (__FLT, BITSIZE, _HAS_QUIET_NAN__); \
1957 static _GLIBCXX_USE_CONSTEXPR bool has_signaling_NaN \
1958 = has_quiet_NaN; \
1959 static _GLIBCXX_USE_CONSTEXPR float_denorm_style has_denorm \
1960 = bool(__glibcxx_concat3 (__FLT, BITSIZE, _HAS_DENORM__)) \
1961 ? denorm_present : denorm_absent; \
1962 static _GLIBCXX_USE_CONSTEXPR bool has_denorm_loss = false; \
1963 \
1964 static _GLIBCXX_CONSTEXPR _Float##BITSIZE \
1965 infinity() _GLIBCXX_USE_NOEXCEPT \
1966 { return __builtin_huge_valf##BITSIZE(); } \
1967 \
1968 static _GLIBCXX_CONSTEXPR _Float##BITSIZE \
1969 quiet_NaN() _GLIBCXX_USE_NOEXCEPT \
1970 { return __builtin_nanf##BITSIZE(""); } \
1971 \
1972 static _GLIBCXX_CONSTEXPR _Float##BITSIZE \
1973 signaling_NaN() _GLIBCXX_USE_NOEXCEPT \
1974 { return __builtin_nansf##BITSIZE(""); } \
1975 \
1976 static _GLIBCXX_CONSTEXPR _Float##BITSIZE \
1977 denorm_min() _GLIBCXX_USE_NOEXCEPT \
1978 { return __glibcxx_concat3 (__FLT, BITSIZE, _DENORM_MIN__); } \
1979 \
1980 static _GLIBCXX_USE_CONSTEXPR bool is_iec559 \
1981 = has_infinity && has_quiet_NaN && has_denorm == denorm_present;\
1982 static _GLIBCXX_USE_CONSTEXPR bool is_bounded = true; \
1983 static _GLIBCXX_USE_CONSTEXPR bool is_modulo = false; \
1984 \
1985 static _GLIBCXX_USE_CONSTEXPR bool traps = false; \
1986 static _GLIBCXX_USE_CONSTEXPR bool tinyness_before = false; \
1987 static _GLIBCXX_USE_CONSTEXPR float_round_style round_style \
1988 = round_to_nearest; \
1989 }; \
1990
1991#ifdef __STDCPP_FLOAT16_T__
1992__glibcxx_float_n(16)
1993#endif
1994#ifdef __FLT32_DIG__
1995__glibcxx_float_n(32)
1996#endif
1997#ifdef __FLT64_DIG__
1998__glibcxx_float_n(64)
1999#endif
2000#ifdef __FLT128_DIG__
2001__glibcxx_float_n(128)
2002#endif
2003#undef __glibcxx_float_n
2004#undef __glibcxx_concat3
2005#undef __glibcxx_concat3_
2006
2007#if __cplusplus >= 201103L
2008# undef __max_digits10
2009#endif
2010
2011#ifdef __STDCPP_BFLOAT16_T__
2012 __extension__
2013 template<>
2014 struct numeric_limits<__gnu_cxx::__bfloat16_t>
2015 {
2016 static _GLIBCXX_USE_CONSTEXPR bool is_specialized = true;
2017
2018 static _GLIBCXX_CONSTEXPR __gnu_cxx::__bfloat16_t
2019 min() _GLIBCXX_USE_NOEXCEPT
2020 { return __BFLT16_MIN__; }
2021
2022 static _GLIBCXX_CONSTEXPR __gnu_cxx::__bfloat16_t
2023 max() _GLIBCXX_USE_NOEXCEPT
2024 { return __BFLT16_MAX__; }
2025
2026 static _GLIBCXX_CONSTEXPR __gnu_cxx::__bfloat16_t
2027 lowest() _GLIBCXX_USE_NOEXCEPT
2028 { return -__BFLT16_MAX__; }
2029
2030 static _GLIBCXX_USE_CONSTEXPR int digits = __BFLT16_MANT_DIG__;
2031 static _GLIBCXX_USE_CONSTEXPR int digits10 = __BFLT16_DIG__;
2032#if __cplusplus >= 201103L
2033 static _GLIBCXX_USE_CONSTEXPR int max_digits10
2034 = __glibcxx_max_digits10 (__BFLT16_MANT_DIG__);
2035#endif
2036 static _GLIBCXX_USE_CONSTEXPR bool is_signed = true;
2037 static _GLIBCXX_USE_CONSTEXPR bool is_integer = false;
2038 static _GLIBCXX_USE_CONSTEXPR bool is_exact = false;
2039 static _GLIBCXX_USE_CONSTEXPR int radix = __FLT_RADIX__;
2040
2041 static _GLIBCXX_CONSTEXPR __gnu_cxx::__bfloat16_t
2042 epsilon() _GLIBCXX_USE_NOEXCEPT
2043 { return __BFLT16_EPSILON__; }
2044
2045 static _GLIBCXX_CONSTEXPR __gnu_cxx::__bfloat16_t
2046 round_error() _GLIBCXX_USE_NOEXCEPT { return 0.5BF16; }
2047
2048 static _GLIBCXX_USE_CONSTEXPR int min_exponent = __BFLT16_MIN_EXP__;
2049 static _GLIBCXX_USE_CONSTEXPR int min_exponent10 = __BFLT16_MIN_10_EXP__;
2050 static _GLIBCXX_USE_CONSTEXPR int max_exponent = __BFLT16_MAX_EXP__;
2051 static _GLIBCXX_USE_CONSTEXPR int max_exponent10 = __BFLT16_MAX_10_EXP__;
2052
2053 static _GLIBCXX_USE_CONSTEXPR bool has_infinity
2054 = __BFLT16_HAS_INFINITY__;
2055 static _GLIBCXX_USE_CONSTEXPR bool has_quiet_NaN
2056 = __BFLT16_HAS_QUIET_NAN__;
2057 static _GLIBCXX_USE_CONSTEXPR bool has_signaling_NaN = has_quiet_NaN;
2058 static _GLIBCXX_USE_CONSTEXPR float_denorm_style has_denorm
2059 = bool(__BFLT16_HAS_DENORM__) ? denorm_present : denorm_absent;
2060 static _GLIBCXX_USE_CONSTEXPR bool has_denorm_loss = false;
2061
2062 static _GLIBCXX_CONSTEXPR __gnu_cxx::__bfloat16_t
2063 infinity() _GLIBCXX_USE_NOEXCEPT
2064 { return __gnu_cxx::__bfloat16_t(__builtin_huge_valf()); }
2065
2066 static _GLIBCXX_CONSTEXPR __gnu_cxx::__bfloat16_t
2067 quiet_NaN() _GLIBCXX_USE_NOEXCEPT
2068 { return __gnu_cxx::__bfloat16_t(__builtin_nanf("")); }
2069
2070 static _GLIBCXX_CONSTEXPR __gnu_cxx::__bfloat16_t
2071 signaling_NaN() _GLIBCXX_USE_NOEXCEPT
2072 { return __builtin_nansf16b(""); }
2073
2074 static _GLIBCXX_CONSTEXPR __gnu_cxx::__bfloat16_t
2075 denorm_min() _GLIBCXX_USE_NOEXCEPT
2076 { return __BFLT16_DENORM_MIN__; }
2077
2078 static _GLIBCXX_USE_CONSTEXPR bool is_iec559
2079 = has_infinity && has_quiet_NaN && has_denorm == denorm_present;
2080 static _GLIBCXX_USE_CONSTEXPR bool is_bounded = true;
2081 static _GLIBCXX_USE_CONSTEXPR bool is_modulo = false;
2082
2083 static _GLIBCXX_USE_CONSTEXPR bool traps = false;
2084 static _GLIBCXX_USE_CONSTEXPR bool tinyness_before = false;
2085 static _GLIBCXX_USE_CONSTEXPR float_round_style round_style
2086 = round_to_nearest;
2087 };
2088#endif // __STDCPP_BFLOAT16_T__
2089
2090#if defined(_GLIBCXX_USE_FLOAT128)
2091// We either need Q literal suffixes, or IEEE double.
2092#if ! defined(__STRICT_ANSI__) || defined(_GLIBCXX_DOUBLE_IS_IEEE_BINARY64)
2093 __extension__
2094 template<>
2095 struct numeric_limits<__float128>
2096 {
2097 static _GLIBCXX_USE_CONSTEXPR bool is_specialized = true;
2098
2099 static _GLIBCXX_CONSTEXPR __float128
2100 min() _GLIBCXX_USE_NOEXCEPT
2101 {
2102#ifdef __STRICT_ANSI__
2103 // 0x1.0p-30 * 0x1.0p-16352
2104 return double(9.3132257461547852e-10) * _S_1pm16352();
2105#else
2106 return __extension__ 0x1.0p-16382Q;
2107#endif
2108 }
2109
2110 static _GLIBCXX_CONSTEXPR __float128
2111 max() _GLIBCXX_USE_NOEXCEPT
2112 {
2113#ifdef __STRICT_ANSI__
2114 // (0x1.fffffffffffffp+127 + 0x0.fffffffffffffp+75 + 0x0.ffp+23)
2115 // * 0x1.0p16256
2116 return (__float128(double(3.4028236692093843e+38))
2117 + double(3.7778931862957153e+22) + double(8.35584e+6))
2118 * _S_1p16256();
2119#else
2120 return __extension__ 0x1.ffffffffffffffffffffffffffffp+16383Q;
2121#endif
2122 }
2123
2124 static _GLIBCXX_CONSTEXPR __float128
2125 lowest() _GLIBCXX_USE_NOEXCEPT
2126 { return -max(); }
2127
2128 static _GLIBCXX_USE_CONSTEXPR int digits = 113;
2129 static _GLIBCXX_USE_CONSTEXPR int digits10 = 33;
2130#if __cplusplus >= 201103L
2131 static constexpr int max_digits10 = 36;
2132#endif
2133 static _GLIBCXX_USE_CONSTEXPR bool is_signed = true;
2134 static _GLIBCXX_USE_CONSTEXPR bool is_integer = false;
2135 static _GLIBCXX_USE_CONSTEXPR bool is_exact = false;
2136 static _GLIBCXX_USE_CONSTEXPR int radix = __FLT_RADIX__;
2137
2138 static _GLIBCXX_CONSTEXPR __float128
2139 epsilon() _GLIBCXX_USE_NOEXCEPT
2140 { return double(1.9259299443872359e-34); }
2141
2142 static _GLIBCXX_CONSTEXPR __float128
2143 round_error() _GLIBCXX_USE_NOEXCEPT { return 0.5; }
2144
2145 static _GLIBCXX_USE_CONSTEXPR int min_exponent = -16381;
2146 static _GLIBCXX_USE_CONSTEXPR int min_exponent10 = -4931;
2147 static _GLIBCXX_USE_CONSTEXPR int max_exponent = 16384;
2148 static _GLIBCXX_USE_CONSTEXPR int max_exponent10 = 4932;
2149
2150 static _GLIBCXX_USE_CONSTEXPR bool has_infinity = 1;
2151 static _GLIBCXX_USE_CONSTEXPR bool has_quiet_NaN = 1;
2152#if __has_builtin(__builtin_nansq) \
2153 || (__has_builtin(__builtin_bit_cast) && __has_builtin(__builtin_nansf128))
2154 static _GLIBCXX_USE_CONSTEXPR bool has_signaling_NaN = true;
2155#else
2156 static _GLIBCXX_USE_CONSTEXPR bool has_signaling_NaN = false;
2157#endif
2158 static _GLIBCXX_USE_CONSTEXPR float_denorm_style has_denorm
2159 = denorm_present;
2160 static _GLIBCXX_USE_CONSTEXPR bool has_denorm_loss = false;
2161
2162 static _GLIBCXX_CONSTEXPR __float128
2163 infinity() _GLIBCXX_USE_NOEXCEPT
2164 { return __builtin_huge_val(); }
2165
2166 static _GLIBCXX_CONSTEXPR __float128
2167 quiet_NaN() _GLIBCXX_USE_NOEXCEPT
2168 { return __builtin_nan(""); }
2169
2170 static _GLIBCXX_CONSTEXPR __float128
2171 signaling_NaN() _GLIBCXX_USE_NOEXCEPT
2172 {
2173#if __has_builtin(__builtin_nansq)
2174 return __builtin_nansq("");
2175#elif __has_builtin(__builtin_bit_cast) && __has_builtin(__builtin_nansf128)
2176 return __builtin_bit_cast(__float128, __builtin_nansf128(""));
2177#else
2178 return quiet_NaN();
2179#endif
2180 }
2181
2182 static _GLIBCXX_CONSTEXPR __float128
2183 denorm_min() _GLIBCXX_USE_NOEXCEPT
2184 {
2185#if defined(__STRICT_ANSI__) || defined(__INTEL_COMPILER)
2186 // 0x1.0p-142 * 0x1.0p-16352
2187 return double(1.7936620343357659e-43) * _S_1pm16352();
2188#else
2189 return __extension__ 0x1.0p-16494Q;
2190#endif
2191 }
2192
2193 static _GLIBCXX_USE_CONSTEXPR bool is_iec559 = has_signaling_NaN;
2194 static _GLIBCXX_USE_CONSTEXPR bool is_bounded = true;
2195 static _GLIBCXX_USE_CONSTEXPR bool is_modulo = false;
2196
2197 static _GLIBCXX_USE_CONSTEXPR bool traps = false;
2198 static _GLIBCXX_USE_CONSTEXPR bool tinyness_before = false;
2199 static _GLIBCXX_USE_CONSTEXPR float_round_style round_style
2200 = round_to_nearest;
2201
2202#if defined(__STRICT_ANSI__) || defined(__INTEL_COMPILER)
2203 private:
2204 static _GLIBCXX_CONSTEXPR __float128
2205 _S_4p(__float128 __v) _GLIBCXX_USE_NOEXCEPT
2206 { return __v * __v * __v * __v; }
2207
2208 static _GLIBCXX_CONSTEXPR __float128
2209 _S_1pm4088() _GLIBCXX_USE_NOEXCEPT
2210 { return _S_4p(/* 0x1.0p-1022 */ double(2.2250738585072014e-308)); }
2211
2212 static _GLIBCXX_CONSTEXPR __float128
2213 _S_1pm16352() _GLIBCXX_USE_NOEXCEPT
2214 { return _S_4p(_S_1pm4088()); }
2215
2216 static _GLIBCXX_CONSTEXPR __float128
2217 _S_1p4064() _GLIBCXX_USE_NOEXCEPT
2218 { return _S_4p(/* 0x1.0p+1016 */ double(7.0222388080559215e+305)); }
2219
2220 static _GLIBCXX_CONSTEXPR __float128
2221 _S_1p16256() _GLIBCXX_USE_NOEXCEPT
2222 { return _S_4p(_S_1p4064()); }
2223#endif
2224 };
2225#endif // !__STRICT_ANSI__ || DOUBLE_IS_IEEE_BINARY64
2226#endif // _GLIBCXX_USE_FLOAT128
2227
2228_GLIBCXX_END_NAMESPACE_VERSION
2229} // namespace
2230
2231#undef __glibcxx_signed
2232#undef __glibcxx_min
2233#undef __glibcxx_max
2234#undef __glibcxx_digits
2235#undef __glibcxx_digits10
2236#undef __glibcxx_max_digits10
2237
2238#pragma GCC diagnostic pop
2239#endif // _GLIBCXX_NUMERIC_LIMITS
c++config.h
std
ISO C++ entities toplevel namespace is std.
std::float_round_style
float_round_style
Describes the rounding style for floating-point types.
Definition limits:175
std::round_toward_zero
@ round_toward_zero
To zero.
Definition limits:177
std::round_toward_infinity
@ round_toward_infinity
To infinity.
Definition limits:179
std::round_to_nearest
@ round_to_nearest
To the nearest representable value.
Definition limits:178
std::round_toward_neg_infinity
@ round_toward_neg_infinity
To negative infinity.
Definition limits:180
std::round_indeterminate
@ round_indeterminate
Intermediate.
Definition limits:176
std::float_denorm_style
float_denorm_style
Describes the denormalization for floating-point types.
Definition limits:190
std::denorm_present
@ denorm_present
The type allows denormalized values.
Definition limits:196
std::denorm_indeterminate
@ denorm_indeterminate
Indeterminate at compile time whether denormalized values are allowed.
Definition limits:192
std::denorm_absent
@ denorm_absent
The type does not allow denormalized values.
Definition limits:194
__gnu_cxx
GNU extensions for public use.
std::__numeric_limits_base
Part of std::numeric_limits.
Definition limits:210
std::__numeric_limits_base::is_modulo
static constexpr bool is_modulo
Definition limits:295
std::__numeric_limits_base::has_quiet_NaN
static constexpr bool has_quiet_NaN
Definition limits:266
std::__numeric_limits_base::is_integer
static constexpr bool is_integer
Definition limits:233
std::__numeric_limits_base::max_digits10
static constexpr int max_digits10
Definition limits:226
std::__numeric_limits_base::min_exponent
static constexpr int min_exponent
Definition limits:246
std::__numeric_limits_base::digits
static constexpr int digits
Definition limits:218
std::__numeric_limits_base::is_bounded
static constexpr bool is_bounded
Definition limits:286
std::__numeric_limits_base::has_denorm_loss
static constexpr bool has_denorm_loss
Definition limits:277
std::__numeric_limits_base::is_iec559
static constexpr bool is_iec559
Definition limits:281
std::__numeric_limits_base::is_exact
static constexpr bool is_exact
Definition limits:238
std::__numeric_limits_base::traps
static constexpr bool traps
Definition limits:298
std::__numeric_limits_base::has_signaling_NaN
static constexpr bool has_signaling_NaN
Definition limits:270
std::__numeric_limits_base::is_specialized
static constexpr bool is_specialized
Definition limits:213
std::__numeric_limits_base::max_exponent
static constexpr int max_exponent
Definition limits:255
std::__numeric_limits_base::is_signed
static constexpr bool is_signed
Definition limits:230
std::__numeric_limits_base::digits10
static constexpr int digits10
Definition limits:221
std::__numeric_limits_base::min_exponent10
static constexpr int min_exponent10
Definition limits:250
std::__numeric_limits_base::tinyness_before
static constexpr bool tinyness_before
Definition limits:301
std::__numeric_limits_base::round_style
static constexpr float_round_style round_style
Definition limits:306
std::__numeric_limits_base::has_infinity
static constexpr bool has_infinity
Definition limits:262
std::__numeric_limits_base::radix
static constexpr int radix
Definition limits:242
std::__numeric_limits_base::max_exponent10
static constexpr int max_exponent10
Definition limits:259
std::__numeric_limits_base::has_denorm
static constexpr float_denorm_style has_denorm
Definition limits:273
std::numeric_limits
Properties of fundamental types.
Definition limits:320
std::numeric_limits::max
static constexpr _Tp max() noexcept
Definition limits:328
std::numeric_limits::epsilon
static constexpr _Tp epsilon() noexcept
Definition limits:340
std::numeric_limits::quiet_NaN
static constexpr _Tp quiet_NaN() noexcept
Definition limits:353
std::numeric_limits::lowest
static constexpr _Tp lowest() noexcept
Definition limits:334
std::numeric_limits::min
static constexpr _Tp min() noexcept
Definition limits:324
std::numeric_limits::denorm_min
static constexpr _Tp denorm_min() noexcept
Definition limits:364
std::numeric_limits::infinity
static constexpr _Tp infinity() noexcept
Definition limits:348
std::numeric_limits::round_error
static constexpr _Tp round_error() noexcept
Definition limits:344
std::numeric_limits::signaling_NaN
static constexpr _Tp signaling_NaN() noexcept
Definition limits:358