source: Daodan/MSYS2/mingw32/include/c++/11.2.0/limits@ 1194

Last change on this file since 1194 was 1166, checked in by rossy, 3 years ago

Daodan: Replace MinGW build env with an up-to-date MSYS2 env

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