31#ifndef ETL_LIMITS_INCLUDED
32#define ETL_LIMITS_INCLUDED
39#if ETL_NOT_USING_STL && defined(ETL_COMPILER_ARM5) && !defined(__USE_C99_MATH)
41 #define __USE_C99_MATH
51#if defined(ETL_COMPILER_MICROSOFT)
53 #pragma warning(disable : 26812)
57#define ETL_LOG10_OF_2(x) (((x) * 301) / 1000)
59#if !defined(LDBL_MIN) && defined(DBL_MIN)
62 #define LDBL_MIN DBL_MIN
63 #define LDBL_MAX DBL_MAX
64 #define LDBL_EPSILON DBL_EPSILON
65 #define LDBL_MANT_DIG DBL_MANT_DIG
66 #define LDBL_DIG DBL_DIG
67 #define LDBL_MIN_EXP DBL_MIN_EXP
68 #define LDBL_MIN_10_EXP DBL_MIN_10_EXP
69 #define LDBL_MAX_EXP DBL_MAX_EXP
70 #define LDBL_MAX_10_EXP DBL_MAX_10_EXP
76 #define HUGE_VALF FLT_MAX
77 #define HUGE_VAL DBL_MAX
78 #define HUGE_VALL LDBL_MAX
81#if defined(ETL_NO_CPP_NAN_SUPPORT)
83 #define ETL_NAN (double)NAN
84 #define ETL_NANF (float)NAN
85 #define ETL_NANL (long double)NAN
86 #define ETL_HAS_NAN true
88 #define ETL_NAN (double)0.0
89 #define ETL_NANF (float)0.0
90 #define ETL_NANL (long double)0.0
91 #define ETL_HAS_NAN false
94 #define ETL_NAN nan("")
95 #define ETL_NANF nanf("")
96 #define ETL_NANL nanl("")
97 #define ETL_HAS_NAN true
102 enum float_round_style
104 round_indeterminate = -1,
105 round_toward_zero = 0,
106 round_to_nearest = 1,
107 round_toward_infinity = 2,
108 round_toward_neg_infinity = 3,
111 enum float_denorm_style
113 denorm_indeterminate = -1,
118 namespace private_limits
122 template <
typename T =
void>
123 class integral_limits_common
127 static ETL_CONSTANT
bool is_specialized =
true;
128 static ETL_CONSTANT
bool is_integer =
true;
129 static ETL_CONSTANT
bool is_exact =
true;
130 static ETL_CONSTANT
int max_digits10 = 0;
131 static ETL_CONSTANT
int radix = 2;
132 static ETL_CONSTANT
int min_exponent = 0;
133 static ETL_CONSTANT
int min_exponent10 = 0;
134 static ETL_CONSTANT
int max_exponent = 0;
135 static ETL_CONSTANT
int max_exponent10 = 0;
136 static ETL_CONSTANT
bool has_infinity =
false;
137 static ETL_CONSTANT
bool has_quiet_NaN =
false;
138 static ETL_CONSTANT
bool has_signaling_NaN =
false;
139 static ETL_CONSTANT
bool has_denorm_loss =
false;
140 static ETL_CONSTANT
bool is_iec559 =
false;
141 static ETL_CONSTANT
bool is_bounded =
true;
142 static ETL_CONSTANT
bool traps =
false;
143 static ETL_CONSTANT
bool tinyness_before =
false;
144 static ETL_CONSTANT float_denorm_style has_denorm = denorm_absent;
145 static ETL_CONSTANT float_round_style round_style = round_toward_zero;
148 template <
typename T>
149 ETL_CONSTANT
bool integral_limits_common<T>::is_specialized;
151 template <
typename T>
152 ETL_CONSTANT
bool integral_limits_common<T>::is_integer;
154 template <
typename T>
155 ETL_CONSTANT
bool integral_limits_common<T>::is_exact;
157 template <
typename T>
158 ETL_CONSTANT
int integral_limits_common<T>::max_digits10;
160 template <
typename T>
161 ETL_CONSTANT
int integral_limits_common<T>::radix;
163 template <
typename T>
164 ETL_CONSTANT
int integral_limits_common<T>::min_exponent;
166 template <
typename T>
167 ETL_CONSTANT
int integral_limits_common<T>::min_exponent10;
169 template <
typename T>
170 ETL_CONSTANT
int integral_limits_common<T>::max_exponent;
172 template <
typename T>
173 ETL_CONSTANT
int integral_limits_common<T>::max_exponent10;
175 template <
typename T>
176 ETL_CONSTANT
bool integral_limits_common<T>::has_infinity;
178 template <
typename T>
179 ETL_CONSTANT
bool integral_limits_common<T>::has_quiet_NaN;
181 template <
typename T>
182 ETL_CONSTANT
bool integral_limits_common<T>::has_signaling_NaN;
184 template <
typename T>
185 ETL_CONSTANT
bool integral_limits_common<T>::has_denorm_loss;
187 template <
typename T>
188 ETL_CONSTANT
bool integral_limits_common<T>::is_iec559;
190 template <
typename T>
191 ETL_CONSTANT
bool integral_limits_common<T>::is_bounded;
193 template <
typename T>
194 ETL_CONSTANT
bool integral_limits_common<T>::traps;
196 template <
typename T>
197 ETL_CONSTANT
bool integral_limits_common<T>::tinyness_before;
199 template <
typename T>
200 ETL_CONSTANT float_denorm_style integral_limits_common<T>::has_denorm;
202 template <
typename T>
203 ETL_CONSTANT float_round_style integral_limits_common<T>::round_style;
207 template <
typename T =
void>
208 struct integral_limits_bool
210 static ETL_CONSTANT
int digits = 1;
211 static ETL_CONSTANT
int digits10 = 0;
212 static ETL_CONSTANT
bool is_signed =
false;
213 static ETL_CONSTANT
bool is_modulo =
false;
216 template <
typename T>
217 ETL_CONSTANT
int integral_limits_bool<T>::digits;
219 template <
typename T>
220 ETL_CONSTANT
int integral_limits_bool<T>::digits10;
222 template <
typename T>
223 ETL_CONSTANT
bool integral_limits_bool<T>::is_signed;
225 template <
typename T>
226 ETL_CONSTANT
bool integral_limits_bool<T>::is_modulo;
230 template <
typename T =
void>
231 struct integral_limits_char
234 static ETL_CONSTANT
int digits10 = ETL_LOG10_OF_2(digits);
239 template <
typename T>
240 ETL_CONSTANT
int integral_limits_char<T>::digits;
242 template <
typename T>
243 ETL_CONSTANT
int integral_limits_char<T>::digits10;
245 template <
typename T>
246 ETL_CONSTANT
bool integral_limits_char<T>::is_signed;
248 template <
typename T>
249 ETL_CONSTANT
bool integral_limits_char<T>::is_modulo;
253 template <
typename T =
void>
254 struct integral_limits_unsigned_char
256 static ETL_CONSTANT
int digits = (CHAR_BIT *
sizeof(
unsigned char));
257 static ETL_CONSTANT
int digits10 = ETL_LOG10_OF_2(digits);
258 static ETL_CONSTANT
bool is_signed =
false;
259 static ETL_CONSTANT
bool is_modulo =
true;
262 template <
typename T>
263 ETL_CONSTANT
int integral_limits_unsigned_char<T>::digits;
265 template <
typename T>
266 ETL_CONSTANT
int integral_limits_unsigned_char<T>::digits10;
268 template <
typename T>
269 ETL_CONSTANT
bool integral_limits_unsigned_char<T>::is_signed;
271 template <
typename T>
272 ETL_CONSTANT
bool integral_limits_unsigned_char<T>::is_modulo;
276 template <
typename T =
void>
277 struct integral_limits_signed_char
279 static ETL_CONSTANT
int digits = (CHAR_BIT *
sizeof(char)) - 1;
280 static ETL_CONSTANT
int digits10 = ETL_LOG10_OF_2(digits);
281 static ETL_CONSTANT
bool is_signed =
true;
282 static ETL_CONSTANT
bool is_modulo =
false;
285 template <
typename T>
286 ETL_CONSTANT
int integral_limits_signed_char<T>::digits;
288 template <
typename T>
289 ETL_CONSTANT
int integral_limits_signed_char<T>::digits10;
291 template <
typename T>
292 ETL_CONSTANT
bool integral_limits_signed_char<T>::is_signed;
294 template <
typename T>
295 ETL_CONSTANT
bool integral_limits_signed_char<T>::is_modulo;
297#if ETL_HAS_NATIVE_CHAR8_T
300 template <
typename T =
void>
301 struct integral_limits_char8_t
304 static ETL_CONSTANT
int digits10 = ETL_LOG10_OF_2(digits);
306 static ETL_CONSTANT
bool is_modulo =
false;
309 template <
typename T>
310 ETL_CONSTANT
int integral_limits_char8_t<T>::digits;
312 template <
typename T>
313 ETL_CONSTANT
int integral_limits_char8_t<T>::digits10;
315 template <
typename T>
316 ETL_CONSTANT
bool integral_limits_char8_t<T>::is_signed;
318 template <
typename T>
319 ETL_CONSTANT
bool integral_limits_char8_t<T>::is_modulo;
322#if ETL_HAS_NATIVE_CHAR16_T
325 template <
typename T =
void>
326 struct integral_limits_char16_t
328 static ETL_CONSTANT
int digits = (CHAR_BIT *
sizeof(char16_t));
329 static ETL_CONSTANT
int digits10 = ETL_LOG10_OF_2(digits);
330 static ETL_CONSTANT
bool is_signed =
false;
331 static ETL_CONSTANT
bool is_modulo =
true;
334 template <
typename T>
335 ETL_CONSTANT
int integral_limits_char16_t<T>::digits;
337 template <
typename T>
338 ETL_CONSTANT
int integral_limits_char16_t<T>::digits10;
340 template <
typename T>
341 ETL_CONSTANT
bool integral_limits_char16_t<T>::is_signed;
343 template <
typename T>
344 ETL_CONSTANT
bool integral_limits_char16_t<T>::is_modulo;
347#if ETL_HAS_NATIVE_CHAR32_T
350 template <
typename T =
void>
351 struct integral_limits_char32_t
353 static ETL_CONSTANT
int digits = (CHAR_BIT *
sizeof(char32_t));
354 static ETL_CONSTANT
int digits10 = ETL_LOG10_OF_2(digits);
355 static ETL_CONSTANT
bool is_signed =
false;
356 static ETL_CONSTANT
bool is_modulo =
true;
359 template <
typename T>
360 ETL_CONSTANT
int integral_limits_char32_t<T>::digits;
362 template <
typename T>
363 ETL_CONSTANT
int integral_limits_char32_t<T>::digits10;
365 template <
typename T>
366 ETL_CONSTANT
bool integral_limits_char32_t<T>::is_signed;
368 template <
typename T>
369 ETL_CONSTANT
bool integral_limits_char32_t<T>::is_modulo;
374 template <
typename T =
void>
375 struct integral_limits_wchar_t
378 static ETL_CONSTANT
int digits10 = ETL_LOG10_OF_2(digits);
383 template <
typename T>
384 ETL_CONSTANT
int integral_limits_wchar_t<T>::digits;
386 template <
typename T>
387 ETL_CONSTANT
int integral_limits_wchar_t<T>::digits10;
389 template <
typename T>
390 ETL_CONSTANT
bool integral_limits_wchar_t<T>::is_signed;
392 template <
typename T>
393 ETL_CONSTANT
bool integral_limits_wchar_t<T>::is_modulo;
397 template <
typename T =
void>
398 struct integral_limits_short
400 static ETL_CONSTANT
int digits = (CHAR_BIT *
sizeof(short)) - 1;
401 static ETL_CONSTANT
int digits10 = ETL_LOG10_OF_2(digits);
402 static ETL_CONSTANT
bool is_signed =
true;
403 static ETL_CONSTANT
bool is_modulo =
false;
406 template <
typename T>
407 ETL_CONSTANT
int integral_limits_short<T>::digits;
409 template <
typename T>
410 ETL_CONSTANT
int integral_limits_short<T>::digits10;
412 template <
typename T>
413 ETL_CONSTANT
bool integral_limits_short<T>::is_signed;
415 template <
typename T>
416 ETL_CONSTANT
bool integral_limits_short<T>::is_modulo;
420 template <
typename T =
void>
421 struct integral_limits_unsigned_short
423 static ETL_CONSTANT
int digits = (CHAR_BIT *
sizeof(
unsigned short));
424 static ETL_CONSTANT
int digits10 = ETL_LOG10_OF_2(digits);
425 static ETL_CONSTANT
bool is_signed =
false;
426 static ETL_CONSTANT
bool is_modulo =
true;
429 template <
typename T>
430 ETL_CONSTANT
int integral_limits_unsigned_short<T>::digits;
432 template <
typename T>
433 ETL_CONSTANT
int integral_limits_unsigned_short<T>::digits10;
435 template <
typename T>
436 ETL_CONSTANT
bool integral_limits_unsigned_short<T>::is_signed;
438 template <
typename T>
439 ETL_CONSTANT
bool integral_limits_unsigned_short<T>::is_modulo;
443 template <
typename T =
void>
444 struct integral_limits_int
446 static ETL_CONSTANT
int digits = (CHAR_BIT *
sizeof(int)) - 1;
447 static ETL_CONSTANT
int digits10 = ETL_LOG10_OF_2(digits);
448 static ETL_CONSTANT
bool is_signed =
true;
449 static ETL_CONSTANT
bool is_modulo =
false;
452 template <
typename T>
453 ETL_CONSTANT
int integral_limits_int<T>::digits;
455 template <
typename T>
456 ETL_CONSTANT
int integral_limits_int<T>::digits10;
458 template <
typename T>
459 ETL_CONSTANT
bool integral_limits_int<T>::is_signed;
461 template <
typename T>
462 ETL_CONSTANT
bool integral_limits_int<T>::is_modulo;
466 template <
typename T =
void>
467 struct integral_limits_unsigned_int
469 static ETL_CONSTANT
int digits = (CHAR_BIT *
sizeof(
unsigned int));
470 static ETL_CONSTANT
int digits10 = ETL_LOG10_OF_2(digits);
471 static ETL_CONSTANT
bool is_signed =
false;
472 static ETL_CONSTANT
bool is_modulo =
true;
475 template <
typename T>
476 ETL_CONSTANT
int integral_limits_unsigned_int<T>::digits;
478 template <
typename T>
479 ETL_CONSTANT
int integral_limits_unsigned_int<T>::digits10;
481 template <
typename T>
482 ETL_CONSTANT
bool integral_limits_unsigned_int<T>::is_signed;
484 template <
typename T>
485 ETL_CONSTANT
bool integral_limits_unsigned_int<T>::is_modulo;
489 template <
typename T =
void>
490 struct integral_limits_long
492 static ETL_CONSTANT
int digits = (CHAR_BIT *
sizeof(long)) - 1;
493 static ETL_CONSTANT
int digits10 = ETL_LOG10_OF_2(digits);
494 static ETL_CONSTANT
bool is_signed =
true;
495 static ETL_CONSTANT
bool is_modulo =
false;
498 template <
typename T>
499 ETL_CONSTANT
int integral_limits_long<T>::digits;
501 template <
typename T>
502 ETL_CONSTANT
int integral_limits_long<T>::digits10;
504 template <
typename T>
505 ETL_CONSTANT
bool integral_limits_long<T>::is_signed;
507 template <
typename T>
508 ETL_CONSTANT
bool integral_limits_long<T>::is_modulo;
512 template <
typename T =
void>
513 struct integral_limits_unsigned_long
515 static ETL_CONSTANT
int digits = (CHAR_BIT *
sizeof(
unsigned long));
516 static ETL_CONSTANT
int digits10 = ETL_LOG10_OF_2(digits);
517 static ETL_CONSTANT
bool is_signed =
false;
518 static ETL_CONSTANT
bool is_modulo =
true;
521 template <
typename T>
522 ETL_CONSTANT
int integral_limits_unsigned_long<T>::digits;
524 template <
typename T>
525 ETL_CONSTANT
int integral_limits_unsigned_long<T>::digits10;
527 template <
typename T>
528 ETL_CONSTANT
bool integral_limits_unsigned_long<T>::is_signed;
530 template <
typename T>
531 ETL_CONSTANT
bool integral_limits_unsigned_long<T>::is_modulo;
535 template <
typename T =
void>
536 struct integral_limits_long_long
538 static ETL_CONSTANT
int digits = (CHAR_BIT *
sizeof(
long long)) - 1;
539 static ETL_CONSTANT
int digits10 = ETL_LOG10_OF_2(digits);
540 static ETL_CONSTANT
bool is_signed =
true;
541 static ETL_CONSTANT
bool is_modulo =
false;
544 template <
typename T>
545 ETL_CONSTANT
int integral_limits_long_long<T>::digits;
547 template <
typename T>
548 ETL_CONSTANT
int integral_limits_long_long<T>::digits10;
550 template <
typename T>
551 ETL_CONSTANT
bool integral_limits_long_long<T>::is_signed;
553 template <
typename T>
554 ETL_CONSTANT
bool integral_limits_long_long<T>::is_modulo;
558 template <
typename T =
void>
559 struct integral_limits_unsigned_long_long
561 static ETL_CONSTANT
int digits = (CHAR_BIT *
sizeof(
unsigned long long));
562 static ETL_CONSTANT
int digits10 = ETL_LOG10_OF_2(digits);
563 static ETL_CONSTANT
bool is_signed =
false;
564 static ETL_CONSTANT
bool is_modulo =
true;
567 template <
typename T>
568 ETL_CONSTANT
int integral_limits_unsigned_long_long<T>::digits;
570 template <
typename T>
571 ETL_CONSTANT
int integral_limits_unsigned_long_long<T>::digits10;
573 template <
typename T>
574 ETL_CONSTANT
bool integral_limits_unsigned_long_long<T>::is_signed;
576 template <
typename T>
577 ETL_CONSTANT
bool integral_limits_unsigned_long_long<T>::is_modulo;
581 template <
typename T =
void>
582 class floating_point_limits_common
586 static ETL_CONSTANT
bool is_specialized =
true;
587 static ETL_CONSTANT
bool is_signed =
true;
588 static ETL_CONSTANT
bool is_integer =
false;
589 static ETL_CONSTANT
bool is_exact =
false;
590 static ETL_CONSTANT
int radix = 2;
591 static ETL_CONSTANT
bool has_infinity =
true;
592 static ETL_CONSTANT
bool has_quiet_NaN = ETL_HAS_NAN;
593 static ETL_CONSTANT
bool has_signaling_NaN = ETL_HAS_NAN;
594 static ETL_CONSTANT
bool has_denorm_loss =
false;
595 static ETL_CONSTANT
bool is_iec559 =
false;
596 static ETL_CONSTANT
bool is_bounded =
true;
597 static ETL_CONSTANT
bool is_modulo =
false;
598 static ETL_CONSTANT
bool traps =
false;
599 static ETL_CONSTANT
bool tinyness_before =
false;
600 static ETL_CONSTANT float_denorm_style has_denorm = denorm_indeterminate;
601 static ETL_CONSTANT float_round_style round_style = round_indeterminate;
603 static float round_error() {
return float(0.5); }
606 template <
typename T>
607 ETL_CONSTANT
bool floating_point_limits_common<T>::is_specialized;
609 template <
typename T>
610 ETL_CONSTANT
bool floating_point_limits_common<T>::is_integer;
612 template <
typename T>
613 ETL_CONSTANT
bool floating_point_limits_common<T>::is_exact;
615 template <
typename T>
616 ETL_CONSTANT
int floating_point_limits_common<T>::radix;
618 template <
typename T>
619 ETL_CONSTANT
bool floating_point_limits_common<T>::has_infinity;
621 template <
typename T>
622 ETL_CONSTANT
bool floating_point_limits_common<T>::has_quiet_NaN;
624 template <
typename T>
625 ETL_CONSTANT
bool floating_point_limits_common<T>::has_signaling_NaN;
627 template <
typename T>
628 ETL_CONSTANT
bool floating_point_limits_common<T>::has_denorm_loss;
630 template <
typename T>
631 ETL_CONSTANT
bool floating_point_limits_common<T>::is_iec559;
633 template <
typename T>
634 ETL_CONSTANT
bool floating_point_limits_common<T>::is_bounded;
636 template <
typename T>
637 ETL_CONSTANT
bool floating_point_limits_common<T>::traps;
639 template <
typename T>
640 ETL_CONSTANT
bool floating_point_limits_common<T>::tinyness_before;
642 template <
typename T>
643 ETL_CONSTANT float_denorm_style floating_point_limits_common<T>::has_denorm;
645 template <
typename T>
646 ETL_CONSTANT float_round_style floating_point_limits_common<T>::round_style;
650 template <
typename T =
void>
651 struct floating_point_limits_float
653 static ETL_CONSTANT
int digits = FLT_MANT_DIG;
654 static ETL_CONSTANT
int digits10 = FLT_DIG;
655 static ETL_CONSTANT
int max_digits10 = ETL_LOG10_OF_2(FLT_MANT_DIG) + 2;
657 static ETL_CONSTANT
int min_exponent = FLT_MIN_EXP;
658 static ETL_CONSTANT
int min_exponent10 = FLT_MIN_10_EXP;
659 static ETL_CONSTANT
int max_exponent = FLT_MAX_EXP;
660 static ETL_CONSTANT
int max_exponent10 = FLT_MAX_10_EXP;
663 template <
typename T>
664 ETL_CONSTANT
int floating_point_limits_float<T>::digits;
666 template <
typename T>
667 ETL_CONSTANT
int floating_point_limits_float<T>::digits10;
669 template <
typename T>
670 ETL_CONSTANT
int floating_point_limits_float<T>::max_digits10;
672 template <
typename T>
673 ETL_CONSTANT
int floating_point_limits_float<T>::min_exponent;
675 template <
typename T>
676 ETL_CONSTANT
int floating_point_limits_float<T>::min_exponent10;
678 template <
typename T>
679 ETL_CONSTANT
int floating_point_limits_float<T>::max_exponent;
681 template <
typename T>
682 ETL_CONSTANT
int floating_point_limits_float<T>::max_exponent10;
686 template <
typename T =
void>
687 struct floating_point_limits_double
689 static ETL_CONSTANT
int digits = DBL_MANT_DIG;
690 static ETL_CONSTANT
int digits10 = DBL_DIG;
691 static ETL_CONSTANT
int max_digits10 = ETL_LOG10_OF_2(DBL_MANT_DIG) + 2;
693 static ETL_CONSTANT
int min_exponent = DBL_MIN_EXP;
694 static ETL_CONSTANT
int min_exponent10 = DBL_MIN_10_EXP;
695 static ETL_CONSTANT
int max_exponent = DBL_MAX_EXP;
696 static ETL_CONSTANT
int max_exponent10 = DBL_MAX_10_EXP;
699 template <
typename T>
700 ETL_CONSTANT
int floating_point_limits_double<T>::digits;
702 template <
typename T>
703 ETL_CONSTANT
int floating_point_limits_double<T>::digits10;
705 template <
typename T>
706 ETL_CONSTANT
int floating_point_limits_double<T>::max_digits10;
708 template <
typename T>
709 ETL_CONSTANT
int floating_point_limits_double<T>::min_exponent;
711 template <
typename T>
712 ETL_CONSTANT
int floating_point_limits_double<T>::min_exponent10;
714 template <
typename T>
715 ETL_CONSTANT
int floating_point_limits_double<T>::max_exponent;
717 template <
typename T>
718 ETL_CONSTANT
int floating_point_limits_double<T>::max_exponent10;
722 template <
typename T =
void>
723 struct floating_point_limits_long_double
725 static ETL_CONSTANT
int digits = LDBL_MANT_DIG;
726 static ETL_CONSTANT
int digits10 = LDBL_DIG;
727 static ETL_CONSTANT
int max_digits10 = ETL_LOG10_OF_2(LDBL_MANT_DIG) + 2;
729 static ETL_CONSTANT
int min_exponent = LDBL_MIN_EXP;
730 static ETL_CONSTANT
int min_exponent10 = LDBL_MIN_10_EXP;
731 static ETL_CONSTANT
int max_exponent = LDBL_MAX_EXP;
732 static ETL_CONSTANT
int max_exponent10 = LDBL_MAX_10_EXP;
735 template <
typename T>
736 ETL_CONSTANT
int floating_point_limits_long_double<T>::digits;
738 template <
typename T>
739 ETL_CONSTANT
int floating_point_limits_long_double<T>::digits10;
741 template <
typename T>
742 ETL_CONSTANT
int floating_point_limits_long_double<T>::max_digits10;
744 template <
typename T>
745 ETL_CONSTANT
int floating_point_limits_long_double<T>::min_exponent;
747 template <
typename T>
748 ETL_CONSTANT
int floating_point_limits_long_double<T>::min_exponent10;
750 template <
typename T>
751 ETL_CONSTANT
int floating_point_limits_long_double<T>::max_exponent;
753 template <
typename T>
754 ETL_CONSTANT
int floating_point_limits_long_double<T>::max_exponent10;
759 template <
typename T>
760 class numeric_limits;
762 template <
typename T>
763 class numeric_limits<const T> :
public numeric_limits<T> { };
765 template <
typename T>
766 class numeric_limits<volatile T> :
public numeric_limits<T> { };
768 template <
typename T>
769 class numeric_limits<const volatile T> :
public numeric_limits<T> { };
774 class numeric_limits<bool> :
public private_limits::integral_limits_common<>,
775 public private_limits::integral_limits_bool<>
779 static ETL_CONSTEXPR
bool min() {
return false; }
780 static ETL_CONSTEXPR
bool max() {
return true; }
781 static ETL_CONSTEXPR
bool lowest() {
return false; }
782 static ETL_CONSTEXPR
bool epsilon() {
return false; }
783 static ETL_CONSTEXPR
bool round_error() {
return false; }
784 static ETL_CONSTEXPR
bool denorm_min() {
return false; }
785 static ETL_CONSTEXPR
bool infinity() {
return false; }
786 static ETL_CONSTEXPR
bool quiet_NaN() {
return false; }
787 static ETL_CONSTEXPR
bool signaling_NaN() {
return false; }
793 class numeric_limits<char> :
public private_limits::integral_limits_common<>,
794 public private_limits::integral_limits_char<>
798 static ETL_CONSTEXPR
char min() {
return char(CHAR_MIN); }
799 static ETL_CONSTEXPR
char max() {
return char(CHAR_MAX); }
800 static ETL_CONSTEXPR
char lowest() {
return char(CHAR_MIN); }
801 static ETL_CONSTEXPR
char epsilon() {
return 0; }
802 static ETL_CONSTEXPR
char round_error() {
return 0; }
803 static ETL_CONSTEXPR
char denorm_min() {
return 0; }
804 static ETL_CONSTEXPR
char infinity() {
return 0; }
805 static ETL_CONSTEXPR
char quiet_NaN() {
return 0; }
806 static ETL_CONSTEXPR
char signaling_NaN() {
return 0; }
812 class numeric_limits<unsigned char> :
public private_limits::integral_limits_common<>,
813 public private_limits::integral_limits_unsigned_char<>
817 static ETL_CONSTEXPR
unsigned char min() {
return 0U; }
818 static ETL_CONSTEXPR
unsigned char max() {
return UCHAR_MAX; }
819 static ETL_CONSTEXPR
unsigned char lowest() {
return 0U; }
820 static ETL_CONSTEXPR
unsigned char epsilon() {
return 0U; }
821 static ETL_CONSTEXPR
unsigned char round_error() {
return 0U; }
822 static ETL_CONSTEXPR
unsigned char denorm_min() {
return 0U; }
823 static ETL_CONSTEXPR
unsigned char infinity() {
return 0U; }
824 static ETL_CONSTEXPR
unsigned char quiet_NaN() {
return 0U; }
825 static ETL_CONSTEXPR
unsigned char signaling_NaN() {
return 0U; }
831 class numeric_limits<signed char> :
public private_limits::integral_limits_common<>,
832 public private_limits::integral_limits_signed_char<>
836 static ETL_CONSTEXPR
signed char min() {
return SCHAR_MIN; }
837 static ETL_CONSTEXPR
signed char max() {
return SCHAR_MAX; }
838 static ETL_CONSTEXPR
signed char lowest() {
return SCHAR_MIN; }
839 static ETL_CONSTEXPR
signed char epsilon() {
return 0; }
840 static ETL_CONSTEXPR
signed char round_error() {
return 0; }
841 static ETL_CONSTEXPR
signed char denorm_min() {
return 0; }
842 static ETL_CONSTEXPR
signed char infinity() {
return 0; }
843 static ETL_CONSTEXPR
signed char quiet_NaN() {
return 0; }
844 static ETL_CONSTEXPR
signed char signaling_NaN() {
return 0; }
847#if ETL_HAS_NATIVE_CHAR8_T
851 class numeric_limits<char8_t> :
public private_limits::integral_limits_common<>,
852 public private_limits::integral_limits_char8_t<>
856 static ETL_CONSTEXPR
char8_t min() {
return char8_t(CHAR_MIN); }
857 static ETL_CONSTEXPR
char8_t max() {
return char8_t(CHAR_MAX); }
858 static ETL_CONSTEXPR
char8_t lowest() {
return char8_t(CHAR_MIN); }
859 static ETL_CONSTEXPR
char8_t epsilon() {
return 0; }
860 static ETL_CONSTEXPR
char8_t round_error() {
return 0; }
861 static ETL_CONSTEXPR
char8_t denorm_min() {
return 0; }
862 static ETL_CONSTEXPR
char8_t infinity() {
return 0; }
863 static ETL_CONSTEXPR
char8_t quiet_NaN() {
return 0; }
864 static ETL_CONSTEXPR
char8_t signaling_NaN() {
return 0; }
868#if ETL_HAS_NATIVE_CHAR16_T
872 class numeric_limits<char16_t> :
public private_limits::integral_limits_common<>,
873 public private_limits::integral_limits_char16_t<>
877 static ETL_CONSTEXPR
char16_t min() {
return 0U; }
878 static ETL_CONSTEXPR
char16_t max() {
return UINT_LEAST16_MAX; }
879 static ETL_CONSTEXPR
char16_t lowest() {
return 0U; }
880 static ETL_CONSTEXPR
char16_t epsilon() {
return 0U; }
881 static ETL_CONSTEXPR
char16_t round_error() {
return 0U; }
882 static ETL_CONSTEXPR
char16_t denorm_min() {
return 0U; }
883 static ETL_CONSTEXPR
char16_t infinity() {
return 0U; }
884 static ETL_CONSTEXPR
char16_t quiet_NaN() {
return 0U; }
885 static ETL_CONSTEXPR
char16_t signaling_NaN() {
return 0U; }
889#if ETL_HAS_NATIVE_CHAR32_T
893 class numeric_limits<char32_t> :
public private_limits::integral_limits_common<>,
894 public private_limits::integral_limits_char32_t<>
898 static ETL_CONSTEXPR
char32_t min() {
return 0U; }
899 static ETL_CONSTEXPR
char32_t max() {
return UINT_LEAST32_MAX; }
900 static ETL_CONSTEXPR
char32_t lowest() {
return 0U; }
901 static ETL_CONSTEXPR
char32_t epsilon() {
return 0U; }
902 static ETL_CONSTEXPR
char32_t round_error() {
return 0U; }
903 static ETL_CONSTEXPR
char32_t denorm_min() {
return 0U; }
904 static ETL_CONSTEXPR
char32_t infinity() {
return 0U; }
905 static ETL_CONSTEXPR
char32_t quiet_NaN() {
return 0U; }
906 static ETL_CONSTEXPR
char32_t signaling_NaN() {
return 0U; }
913 class numeric_limits<wchar_t> :
public private_limits::integral_limits_common<>,
914 public private_limits::integral_limits_wchar_t<>
918 static ETL_CONSTEXPR
wchar_t min() {
return WCHAR_MIN; }
919 static ETL_CONSTEXPR
wchar_t max() {
return WCHAR_MAX; }
920 static ETL_CONSTEXPR
wchar_t lowest() {
return WCHAR_MIN; }
921 static ETL_CONSTEXPR
wchar_t epsilon() {
return wchar_t(0); }
922 static ETL_CONSTEXPR
wchar_t round_error() {
return wchar_t(0); }
923 static ETL_CONSTEXPR
wchar_t denorm_min() {
return wchar_t(0); }
924 static ETL_CONSTEXPR
wchar_t infinity() {
return wchar_t(0); }
925 static ETL_CONSTEXPR
wchar_t quiet_NaN() {
return wchar_t(0); }
926 static ETL_CONSTEXPR
wchar_t signaling_NaN() {
return wchar_t(0); }
932 class numeric_limits<short> :
public private_limits::integral_limits_common<>,
933 public private_limits::integral_limits_short<>
937 static ETL_CONSTEXPR
short min() {
return SHRT_MIN; }
938 static ETL_CONSTEXPR
short max() {
return SHRT_MAX; }
939 static ETL_CONSTEXPR
short lowest() {
return SHRT_MIN; }
940 static ETL_CONSTEXPR
short epsilon() {
return 0; }
941 static ETL_CONSTEXPR
short round_error() {
return 0; }
942 static ETL_CONSTEXPR
short denorm_min() {
return 0; }
943 static ETL_CONSTEXPR
short infinity() {
return 0; }
944 static ETL_CONSTEXPR
short quiet_NaN() {
return 0; }
945 static ETL_CONSTEXPR
short signaling_NaN() {
return 0; }
951 class numeric_limits<unsigned short> :
public private_limits::integral_limits_common<>,
952 public private_limits::integral_limits_unsigned_short<>
956 static ETL_CONSTEXPR
unsigned short min() {
return 0U; }
957 static ETL_CONSTEXPR
unsigned short max() {
return USHRT_MAX; }
958 static ETL_CONSTEXPR
unsigned short lowest() {
return 0U; }
959 static ETL_CONSTEXPR
unsigned short epsilon() {
return 0U; }
960 static ETL_CONSTEXPR
unsigned short round_error() {
return 0U; }
961 static ETL_CONSTEXPR
unsigned short denorm_min() {
return 0U; }
962 static ETL_CONSTEXPR
unsigned short infinity() {
return 0U; }
963 static ETL_CONSTEXPR
unsigned short quiet_NaN() {
return 0U; }
964 static ETL_CONSTEXPR
unsigned short signaling_NaN() {
return 0U; }
970 class numeric_limits<int> :
public private_limits::integral_limits_common<>,
971 public private_limits::integral_limits_int<>
975 static ETL_CONSTEXPR
int min() {
return INT_MIN; }
976 static ETL_CONSTEXPR
int max() {
return INT_MAX; }
977 static ETL_CONSTEXPR
int lowest() {
return INT_MIN; }
978 static ETL_CONSTEXPR
int epsilon() {
return 0; }
979 static ETL_CONSTEXPR
int round_error() {
return 0; }
980 static ETL_CONSTEXPR
int denorm_min() {
return 0; }
981 static ETL_CONSTEXPR
int infinity() {
return 0; }
982 static ETL_CONSTEXPR
int quiet_NaN() {
return 0; }
983 static ETL_CONSTEXPR
int signaling_NaN() {
return 0; }
989 class numeric_limits<unsigned int> :
public private_limits::integral_limits_common<>,
990 public private_limits::integral_limits_unsigned_int<>
994 static ETL_CONSTEXPR
unsigned int min() {
return 0U; }
995 static ETL_CONSTEXPR
unsigned int max() {
return UINT_MAX; }
996 static ETL_CONSTEXPR
unsigned int lowest() {
return 0U; }
997 static ETL_CONSTEXPR
unsigned int epsilon() {
return 0U; }
998 static ETL_CONSTEXPR
unsigned int round_error() {
return 0U; }
999 static ETL_CONSTEXPR
unsigned int denorm_min() {
return 0U; }
1000 static ETL_CONSTEXPR
unsigned int infinity() {
return 0U; }
1001 static ETL_CONSTEXPR
unsigned int quiet_NaN() {
return 0U; }
1002 static ETL_CONSTEXPR
unsigned int signaling_NaN() {
return 0U; }
1008 class numeric_limits<long> :
public private_limits::integral_limits_common<>,
1009 public private_limits::integral_limits_long<>
1013 static ETL_CONSTEXPR
long min() {
return LONG_MIN; }
1014 static ETL_CONSTEXPR
long max() {
return LONG_MAX; }
1015 static ETL_CONSTEXPR
long lowest() {
return LONG_MIN; }
1016 static ETL_CONSTEXPR
long epsilon() {
return 0; }
1017 static ETL_CONSTEXPR
long round_error() {
return 0; }
1018 static ETL_CONSTEXPR
long denorm_min() {
return 0; }
1019 static ETL_CONSTEXPR
long infinity() {
return 0; }
1020 static ETL_CONSTEXPR
long quiet_NaN() {
return 0; }
1021 static ETL_CONSTEXPR
long signaling_NaN() {
return 0; }
1027 class numeric_limits<unsigned long> :
public private_limits::integral_limits_common<>,
1028 public private_limits::integral_limits_unsigned_long<>
1032 static ETL_CONSTEXPR
unsigned long min() {
return 0U; }
1033 static ETL_CONSTEXPR
unsigned long max() {
return ULONG_MAX; }
1034 static ETL_CONSTEXPR
unsigned long lowest() {
return 0U; }
1035 static ETL_CONSTEXPR
unsigned long epsilon() {
return 0U; }
1036 static ETL_CONSTEXPR
unsigned long round_error() {
return 0U; }
1037 static ETL_CONSTEXPR
unsigned long denorm_min() {
return 0U; }
1038 static ETL_CONSTEXPR
unsigned long infinity() {
return 0U; }
1039 static ETL_CONSTEXPR
unsigned long quiet_NaN() {
return 0U; }
1040 static ETL_CONSTEXPR
unsigned long signaling_NaN() {
return 0U; }
1046 class numeric_limits<long long> :
public private_limits::integral_limits_common<>,
1047 public private_limits::integral_limits_long_long<>
1051 static ETL_CONSTEXPR
long long min() {
return LLONG_MIN; }
1052 static ETL_CONSTEXPR
long long max() {
return LLONG_MAX; }
1053 static ETL_CONSTEXPR
long long lowest() {
return LLONG_MIN; }
1054 static ETL_CONSTEXPR
long long epsilon() {
return 0; }
1055 static ETL_CONSTEXPR
long long round_error() {
return 0; }
1056 static ETL_CONSTEXPR
long long denorm_min() {
return 0; }
1057 static ETL_CONSTEXPR
long long infinity() {
return 0; }
1058 static ETL_CONSTEXPR
long long quiet_NaN() {
return 0; }
1059 static ETL_CONSTEXPR
long long signaling_NaN() {
return 0; }
1065 class numeric_limits<unsigned long long> :
public private_limits::integral_limits_common<>,
1066 public private_limits::integral_limits_unsigned_long_long<>
1070 static ETL_CONSTEXPR
unsigned long long min() {
return 0U; }
1071 static ETL_CONSTEXPR
unsigned long long max() {
return ULLONG_MAX; }
1072 static ETL_CONSTEXPR
unsigned long long lowest() {
return 0U; }
1073 static ETL_CONSTEXPR
unsigned long long epsilon() {
return 0U; }
1074 static ETL_CONSTEXPR
unsigned long long round_error() {
return 0U; }
1075 static ETL_CONSTEXPR
unsigned long long denorm_min() {
return 0U; }
1076 static ETL_CONSTEXPR
unsigned long long infinity() {
return 0U; }
1077 static ETL_CONSTEXPR
unsigned long long quiet_NaN() {
return 0U; }
1078 static ETL_CONSTEXPR
unsigned long long signaling_NaN() {
return 0U; }
1084 class numeric_limits<float> :
public private_limits::floating_point_limits_common<>,
1085 public private_limits::floating_point_limits_float<>
1089 static ETL_CONSTEXPR
float min() {
return FLT_MIN; }
1090 static ETL_CONSTEXPR
float max() {
return FLT_MAX; }
1091 static ETL_CONSTEXPR
float lowest() {
return -FLT_MAX; }
1092 static ETL_CONSTEXPR
float epsilon() {
return FLT_EPSILON; }
1093 static ETL_CONSTEXPR
float denorm_min() {
return FLT_MIN; }
1094 static ETL_CONSTEXPR
float infinity() {
return HUGE_VALF; }
1095 static float quiet_NaN() {
return ETL_NANF; }
1096 static float signaling_NaN() {
return ETL_NANF; }
1102 class numeric_limits<double> :
public private_limits::floating_point_limits_common<>,
1103 public private_limits::floating_point_limits_double<>
1107 static ETL_CONSTEXPR
double min() {
return DBL_MIN; }
1108 static ETL_CONSTEXPR
double max() {
return DBL_MAX; }
1109 static ETL_CONSTEXPR
double lowest() {
return -DBL_MAX; }
1110 static ETL_CONSTEXPR
double epsilon() {
return DBL_EPSILON; }
1111 static ETL_CONSTEXPR
double denorm_min() {
return DBL_MIN; }
1112 static ETL_CONSTEXPR
double infinity() {
return HUGE_VAL; }
1113 static double quiet_NaN() {
return ETL_NAN; }
1114 static double signaling_NaN() {
return ETL_NAN; }
1120 class numeric_limits<long double> :
public private_limits::floating_point_limits_common<>,
1121 public private_limits::floating_point_limits_long_double<>
1125 static ETL_CONSTEXPR
long double min() {
return LDBL_MIN; }
1126 static ETL_CONSTEXPR
long double max() {
return LDBL_MAX; }
1127 static ETL_CONSTEXPR
long double lowest() {
return -LDBL_MAX; }
1128 static ETL_CONSTEXPR
long double epsilon() {
return LDBL_EPSILON; }
1129 static ETL_CONSTEXPR
long double denorm_min() {
return LDBL_MIN; }
1130 static ETL_CONSTEXPR
long double infinity() {
return HUGE_VALL; }
1131 static long double quiet_NaN() {
return ETL_NANL; }
1132 static long double signaling_NaN() {
return ETL_NANL; }
1142 enum float_round_style
1144 round_indeterminate = std::round_indeterminate,
1145 round_toward_zero = std::round_toward_zero,
1146 round_to_nearest = std::round_to_nearest,
1147 round_toward_infinity = std::round_toward_infinity,
1148 round_toward_neg_infinity = std::round_toward_neg_infinity,
1151 enum float_denorm_style
1153 denorm_indeterminate = std::denorm_indeterminate,
1154 denorm_absent = std::denorm_absent,
1155 denorm_present = std::denorm_present
1159 template <
typename T>
1160 using numeric_limits = std::numeric_limits<T>;
1162 template <
typename T>
1170#if defined(ETL_COMPILER_MICROSOFT)
1171 #pragma warning(pop)
Definition: limits.h:1164
is_signed
Definition: type_traits_generator.h:1011
is_unsigned
Definition: type_traits_generator.h:1021
bitset_ext
Definition: absolute.h:38