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