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