31#ifndef ETL_LIMITS_INCLUDED
32#define ETL_LIMITS_INCLUDED
38#if ETL_NOT_USING_STL && defined(ETL_COMPILER_ARM5) && !defined(__USE_C99_MATH)
40 #define __USE_C99_MATH
50#if defined(ETL_COMPILER_MICROSOFT)
52 #pragma warning(disable : 26812)
56 #define ETL_LOG10_OF_2(x) (((x) * 301) / 1000)
58#if !defined(LDBL_MIN) && defined(DBL_MIN)
61 #define LDBL_MIN DBL_MIN
62 #define LDBL_MAX DBL_MAX
63 #define LDBL_EPSILON DBL_EPSILON
64 #define LDBL_MANT_DIG DBL_MANT_DIG
65 #define LDBL_DIG DBL_DIG
66 #define LDBL_MIN_EXP DBL_MIN_EXP
67 #define LDBL_MIN_10_EXP DBL_MIN_10_EXP
68 #define LDBL_MAX_EXP DBL_MAX_EXP
69 #define LDBL_MAX_10_EXP DBL_MAX_10_EXP
75 #define HUGE_VALF FLT_MAX
76 #define HUGE_VAL DBL_MAX
77 #define HUGE_VALL LDBL_MAX
80#if defined(ETL_NO_CPP_NAN_SUPPORT)
84 #define ETL_NAN static_cast<double>(NAN)
85 #define ETL_NANL static_cast<long double>(NAN)
86 #define ETL_HAS_NAN true
90 #define ETL_NANF HUGE_VALF
91 #define ETL_NAN HUGE_VAL
92 #define ETL_NANL HUGE_VALL
93 #define ETL_HAS_NAN false
97 #define ETL_NANF nanf("")
98 #define ETL_NAN nan("")
99 #define ETL_NANL nanl("")
100 #define ETL_HAS_NAN true
105 enum float_round_style
107 round_indeterminate = -1,
108 round_toward_zero = 0,
109 round_to_nearest = 1,
110 round_toward_infinity = 2,
111 round_toward_neg_infinity = 3,
114 enum float_denorm_style
116 denorm_indeterminate = -1,
121 namespace private_limits
125 template <
typename T =
void>
126 class integral_limits_common
130 static ETL_CONSTANT
bool is_specialized =
true;
131 static ETL_CONSTANT
bool is_integer =
true;
132 static ETL_CONSTANT
bool is_exact =
true;
133 static ETL_CONSTANT
int max_digits10 = 0;
134 static ETL_CONSTANT
int radix = 2;
135 static ETL_CONSTANT
int min_exponent = 0;
136 static ETL_CONSTANT
int min_exponent10 = 0;
137 static ETL_CONSTANT
int max_exponent = 0;
138 static ETL_CONSTANT
int max_exponent10 = 0;
139 static ETL_CONSTANT
bool has_infinity =
false;
140 static ETL_CONSTANT
bool has_quiet_NaN =
false;
141 static ETL_CONSTANT
bool has_signaling_NaN =
false;
142 static ETL_CONSTANT
bool has_denorm_loss =
false;
143 static ETL_CONSTANT
bool is_iec559 =
false;
144 static ETL_CONSTANT
bool is_bounded =
true;
145 static ETL_CONSTANT
bool traps =
false;
146 static ETL_CONSTANT
bool tinyness_before =
false;
147 static ETL_CONSTANT float_denorm_style has_denorm = denorm_absent;
148 static ETL_CONSTANT float_round_style round_style = round_toward_zero;
151 template <
typename T>
152 ETL_CONSTANT
bool integral_limits_common<T>::is_specialized;
154 template <
typename T>
155 ETL_CONSTANT
bool integral_limits_common<T>::is_integer;
157 template <
typename T>
158 ETL_CONSTANT
bool integral_limits_common<T>::is_exact;
160 template <
typename T>
161 ETL_CONSTANT
int integral_limits_common<T>::max_digits10;
163 template <
typename T>
164 ETL_CONSTANT
int integral_limits_common<T>::radix;
166 template <
typename T>
167 ETL_CONSTANT
int integral_limits_common<T>::min_exponent;
169 template <
typename T>
170 ETL_CONSTANT
int integral_limits_common<T>::min_exponent10;
172 template <
typename T>
173 ETL_CONSTANT
int integral_limits_common<T>::max_exponent;
175 template <
typename T>
176 ETL_CONSTANT
int integral_limits_common<T>::max_exponent10;
178 template <
typename T>
179 ETL_CONSTANT
bool integral_limits_common<T>::has_infinity;
181 template <
typename T>
182 ETL_CONSTANT
bool integral_limits_common<T>::has_quiet_NaN;
184 template <
typename T>
185 ETL_CONSTANT
bool integral_limits_common<T>::has_signaling_NaN;
187 template <
typename T>
188 ETL_CONSTANT
bool integral_limits_common<T>::has_denorm_loss;
190 template <
typename T>
191 ETL_CONSTANT
bool integral_limits_common<T>::is_iec559;
193 template <
typename T>
194 ETL_CONSTANT
bool integral_limits_common<T>::is_bounded;
196 template <
typename T>
197 ETL_CONSTANT
bool integral_limits_common<T>::traps;
199 template <
typename T>
200 ETL_CONSTANT
bool integral_limits_common<T>::tinyness_before;
202 template <
typename T>
203 ETL_CONSTANT float_denorm_style integral_limits_common<T>::has_denorm;
205 template <
typename T>
206 ETL_CONSTANT float_round_style integral_limits_common<T>::round_style;
210 template <
typename T =
void>
211 struct integral_limits_bool
213 static ETL_CONSTANT
int digits = 1;
214 static ETL_CONSTANT
int digits10 = 0;
215 static ETL_CONSTANT
bool is_signed =
false;
216 static ETL_CONSTANT
bool is_modulo =
false;
219 template <
typename T>
220 ETL_CONSTANT
int integral_limits_bool<T>::digits;
222 template <
typename T>
223 ETL_CONSTANT
int integral_limits_bool<T>::digits10;
225 template <
typename T>
226 ETL_CONSTANT
bool integral_limits_bool<T>::is_signed;
228 template <
typename T>
229 ETL_CONSTANT
bool integral_limits_bool<T>::is_modulo;
233 template <
typename T =
void>
234 struct integral_limits_char
236 static ETL_CONSTANT
int digits = (CHAR_BIT *
sizeof(char)) - (etl::is_signed<char>::value ? 1 : 0);
237 static ETL_CONSTANT
int digits10 = ETL_LOG10_OF_2(digits);
238 static ETL_CONSTANT
bool is_signed = etl::is_signed<char>::value;
239 static ETL_CONSTANT
bool is_modulo = etl::is_unsigned<char>::value;
242 template <
typename T>
243 ETL_CONSTANT
int integral_limits_char<T>::digits;
245 template <
typename T>
246 ETL_CONSTANT
int integral_limits_char<T>::digits10;
248 template <
typename T>
249 ETL_CONSTANT
bool integral_limits_char<T>::is_signed;
251 template <
typename T>
252 ETL_CONSTANT
bool integral_limits_char<T>::is_modulo;
256 template <
typename T =
void>
257 struct integral_limits_unsigned_char
259 static ETL_CONSTANT
int digits = (CHAR_BIT *
sizeof(
unsigned char));
260 static ETL_CONSTANT
int digits10 = ETL_LOG10_OF_2(digits);
261 static ETL_CONSTANT
bool is_signed =
false;
262 static ETL_CONSTANT
bool is_modulo =
true;
265 template <
typename T>
266 ETL_CONSTANT
int integral_limits_unsigned_char<T>::digits;
268 template <
typename T>
269 ETL_CONSTANT
int integral_limits_unsigned_char<T>::digits10;
271 template <
typename T>
272 ETL_CONSTANT
bool integral_limits_unsigned_char<T>::is_signed;
274 template <
typename T>
275 ETL_CONSTANT
bool integral_limits_unsigned_char<T>::is_modulo;
279 template <
typename T =
void>
280 struct integral_limits_signed_char
282 static ETL_CONSTANT
int digits = (CHAR_BIT *
sizeof(char)) - 1;
283 static ETL_CONSTANT
int digits10 = ETL_LOG10_OF_2(digits);
284 static ETL_CONSTANT
bool is_signed =
true;
285 static ETL_CONSTANT
bool is_modulo =
false;
288 template <
typename T>
289 ETL_CONSTANT
int integral_limits_signed_char<T>::digits;
291 template <
typename T>
292 ETL_CONSTANT
int integral_limits_signed_char<T>::digits10;
294 template <
typename T>
295 ETL_CONSTANT
bool integral_limits_signed_char<T>::is_signed;
297 template <
typename T>
298 ETL_CONSTANT
bool integral_limits_signed_char<T>::is_modulo;
300#if ETL_HAS_NATIVE_CHAR8_T
303 template <
typename T =
void>
304 struct integral_limits_char8_t
306 static ETL_CONSTANT
int digits = (CHAR_BIT *
sizeof(char8_t)) - (etl::is_signed<char8_t>::value ? 1 : 0);
307 static ETL_CONSTANT
int digits10 = ETL_LOG10_OF_2(digits);
308 static ETL_CONSTANT
bool is_signed = etl::is_signed<char8_t>::value;
309 static ETL_CONSTANT
bool is_modulo =
false;
312 template <
typename T>
313 ETL_CONSTANT
int integral_limits_char8_t<T>::digits;
315 template <
typename T>
316 ETL_CONSTANT
int integral_limits_char8_t<T>::digits10;
318 template <
typename T>
319 ETL_CONSTANT
bool integral_limits_char8_t<T>::is_signed;
321 template <
typename T>
322 ETL_CONSTANT
bool integral_limits_char8_t<T>::is_modulo;
325#if ETL_HAS_NATIVE_CHAR16_T
328 template <
typename T =
void>
329 struct integral_limits_char16_t
331 static ETL_CONSTANT
int digits = (CHAR_BIT *
sizeof(char16_t));
332 static ETL_CONSTANT
int digits10 = ETL_LOG10_OF_2(digits);
333 static ETL_CONSTANT
bool is_signed =
false;
334 static ETL_CONSTANT
bool is_modulo =
true;
337 template <
typename T>
338 ETL_CONSTANT
int integral_limits_char16_t<T>::digits;
340 template <
typename T>
341 ETL_CONSTANT
int integral_limits_char16_t<T>::digits10;
343 template <
typename T>
344 ETL_CONSTANT
bool integral_limits_char16_t<T>::is_signed;
346 template <
typename T>
347 ETL_CONSTANT
bool integral_limits_char16_t<T>::is_modulo;
350#if ETL_HAS_NATIVE_CHAR32_T
353 template <
typename T =
void>
354 struct integral_limits_char32_t
356 static ETL_CONSTANT
int digits = (CHAR_BIT *
sizeof(char32_t));
357 static ETL_CONSTANT
int digits10 = ETL_LOG10_OF_2(digits);
358 static ETL_CONSTANT
bool is_signed =
false;
359 static ETL_CONSTANT
bool is_modulo =
true;
362 template <
typename T>
363 ETL_CONSTANT
int integral_limits_char32_t<T>::digits;
365 template <
typename T>
366 ETL_CONSTANT
int integral_limits_char32_t<T>::digits10;
368 template <
typename T>
369 ETL_CONSTANT
bool integral_limits_char32_t<T>::is_signed;
371 template <
typename T>
372 ETL_CONSTANT
bool integral_limits_char32_t<T>::is_modulo;
377 template <
typename T =
void>
378 struct integral_limits_wchar_t
380 static ETL_CONSTANT
int digits = (CHAR_BIT *
sizeof(wchar_t)) - (etl::is_signed<wchar_t>::value ? 1 : 0);
381 static ETL_CONSTANT
int digits10 = ETL_LOG10_OF_2(digits);
382 static ETL_CONSTANT
bool is_signed = etl::is_signed<wchar_t>::value;
383 static ETL_CONSTANT
bool is_modulo = etl::is_unsigned<wchar_t>::value;
386 template <
typename T>
387 ETL_CONSTANT
int integral_limits_wchar_t<T>::digits;
389 template <
typename T>
390 ETL_CONSTANT
int integral_limits_wchar_t<T>::digits10;
392 template <
typename T>
393 ETL_CONSTANT
bool integral_limits_wchar_t<T>::is_signed;
395 template <
typename T>
396 ETL_CONSTANT
bool integral_limits_wchar_t<T>::is_modulo;
400 template <
typename T =
void>
401 struct integral_limits_short
403 static ETL_CONSTANT
int digits = (CHAR_BIT *
sizeof(short)) - 1;
404 static ETL_CONSTANT
int digits10 = ETL_LOG10_OF_2(digits);
405 static ETL_CONSTANT
bool is_signed =
true;
406 static ETL_CONSTANT
bool is_modulo =
false;
409 template <
typename T>
410 ETL_CONSTANT
int integral_limits_short<T>::digits;
412 template <
typename T>
413 ETL_CONSTANT
int integral_limits_short<T>::digits10;
415 template <
typename T>
416 ETL_CONSTANT
bool integral_limits_short<T>::is_signed;
418 template <
typename T>
419 ETL_CONSTANT
bool integral_limits_short<T>::is_modulo;
423 template <
typename T =
void>
424 struct integral_limits_unsigned_short
426 static ETL_CONSTANT
int digits = (CHAR_BIT *
sizeof(
unsigned short));
427 static ETL_CONSTANT
int digits10 = ETL_LOG10_OF_2(digits);
428 static ETL_CONSTANT
bool is_signed =
false;
429 static ETL_CONSTANT
bool is_modulo =
true;
432 template <
typename T>
433 ETL_CONSTANT
int integral_limits_unsigned_short<T>::digits;
435 template <
typename T>
436 ETL_CONSTANT
int integral_limits_unsigned_short<T>::digits10;
438 template <
typename T>
439 ETL_CONSTANT
bool integral_limits_unsigned_short<T>::is_signed;
441 template <
typename T>
442 ETL_CONSTANT
bool integral_limits_unsigned_short<T>::is_modulo;
446 template <
typename T =
void>
447 struct integral_limits_int
449 static ETL_CONSTANT
int digits = (CHAR_BIT *
sizeof(int)) - 1;
450 static ETL_CONSTANT
int digits10 = ETL_LOG10_OF_2(digits);
451 static ETL_CONSTANT
bool is_signed =
true;
452 static ETL_CONSTANT
bool is_modulo =
false;
455 template <
typename T>
456 ETL_CONSTANT
int integral_limits_int<T>::digits;
458 template <
typename T>
459 ETL_CONSTANT
int integral_limits_int<T>::digits10;
461 template <
typename T>
462 ETL_CONSTANT
bool integral_limits_int<T>::is_signed;
464 template <
typename T>
465 ETL_CONSTANT
bool integral_limits_int<T>::is_modulo;
469 template <
typename T =
void>
470 struct integral_limits_unsigned_int
472 static ETL_CONSTANT
int digits = (CHAR_BIT *
sizeof(
unsigned int));
473 static ETL_CONSTANT
int digits10 = ETL_LOG10_OF_2(digits);
474 static ETL_CONSTANT
bool is_signed =
false;
475 static ETL_CONSTANT
bool is_modulo =
true;
478 template <
typename T>
479 ETL_CONSTANT
int integral_limits_unsigned_int<T>::digits;
481 template <
typename T>
482 ETL_CONSTANT
int integral_limits_unsigned_int<T>::digits10;
484 template <
typename T>
485 ETL_CONSTANT
bool integral_limits_unsigned_int<T>::is_signed;
487 template <
typename T>
488 ETL_CONSTANT
bool integral_limits_unsigned_int<T>::is_modulo;
492 template <
typename T =
void>
493 struct integral_limits_long
495 static ETL_CONSTANT
int digits = (CHAR_BIT *
sizeof(long)) - 1;
496 static ETL_CONSTANT
int digits10 = ETL_LOG10_OF_2(digits);
497 static ETL_CONSTANT
bool is_signed =
true;
498 static ETL_CONSTANT
bool is_modulo =
false;
501 template <
typename T>
502 ETL_CONSTANT
int integral_limits_long<T>::digits;
504 template <
typename T>
505 ETL_CONSTANT
int integral_limits_long<T>::digits10;
507 template <
typename T>
508 ETL_CONSTANT
bool integral_limits_long<T>::is_signed;
510 template <
typename T>
511 ETL_CONSTANT
bool integral_limits_long<T>::is_modulo;
515 template <
typename T =
void>
516 struct integral_limits_unsigned_long
518 static ETL_CONSTANT
int digits = (CHAR_BIT *
sizeof(
unsigned long));
519 static ETL_CONSTANT
int digits10 = ETL_LOG10_OF_2(digits);
520 static ETL_CONSTANT
bool is_signed =
false;
521 static ETL_CONSTANT
bool is_modulo =
true;
524 template <
typename T>
525 ETL_CONSTANT
int integral_limits_unsigned_long<T>::digits;
527 template <
typename T>
528 ETL_CONSTANT
int integral_limits_unsigned_long<T>::digits10;
530 template <
typename T>
531 ETL_CONSTANT
bool integral_limits_unsigned_long<T>::is_signed;
533 template <
typename T>
534 ETL_CONSTANT
bool integral_limits_unsigned_long<T>::is_modulo;
538 template <
typename T =
void>
539 struct integral_limits_long_long
541 static ETL_CONSTANT
int digits = (CHAR_BIT *
sizeof(
long long)) - 1;
542 static ETL_CONSTANT
int digits10 = ETL_LOG10_OF_2(digits);
543 static ETL_CONSTANT
bool is_signed =
true;
544 static ETL_CONSTANT
bool is_modulo =
false;
547 template <
typename T>
548 ETL_CONSTANT
int integral_limits_long_long<T>::digits;
550 template <
typename T>
551 ETL_CONSTANT
int integral_limits_long_long<T>::digits10;
553 template <
typename T>
554 ETL_CONSTANT
bool integral_limits_long_long<T>::is_signed;
556 template <
typename T>
557 ETL_CONSTANT
bool integral_limits_long_long<T>::is_modulo;
561 template <
typename T =
void>
562 struct integral_limits_unsigned_long_long
564 static ETL_CONSTANT
int digits = (CHAR_BIT *
sizeof(
unsigned long long));
565 static ETL_CONSTANT
int digits10 = ETL_LOG10_OF_2(digits);
566 static ETL_CONSTANT
bool is_signed =
false;
567 static ETL_CONSTANT
bool is_modulo =
true;
570 template <
typename T>
571 ETL_CONSTANT
int integral_limits_unsigned_long_long<T>::digits;
573 template <
typename T>
574 ETL_CONSTANT
int integral_limits_unsigned_long_long<T>::digits10;
576 template <
typename T>
577 ETL_CONSTANT
bool integral_limits_unsigned_long_long<T>::is_signed;
579 template <
typename T>
580 ETL_CONSTANT
bool integral_limits_unsigned_long_long<T>::is_modulo;
584 template <
typename T =
void>
585 class floating_point_limits_common
589 static ETL_CONSTANT
bool is_specialized =
true;
590 static ETL_CONSTANT
bool is_signed =
true;
591 static ETL_CONSTANT
bool is_integer =
false;
592 static ETL_CONSTANT
bool is_exact =
false;
593 static ETL_CONSTANT
int radix = 2;
594 static ETL_CONSTANT
bool has_infinity =
true;
595 static ETL_CONSTANT
bool has_quiet_NaN = ETL_HAS_NAN;
596 static ETL_CONSTANT
bool has_signaling_NaN = ETL_HAS_NAN;
597 static ETL_CONSTANT
bool has_denorm_loss =
false;
598 static ETL_CONSTANT
bool is_iec559 =
false;
599 static ETL_CONSTANT
bool is_bounded =
true;
600 static ETL_CONSTANT
bool is_modulo =
false;
601 static ETL_CONSTANT
bool traps =
false;
602 static ETL_CONSTANT
bool tinyness_before =
false;
603 static ETL_CONSTANT float_denorm_style has_denorm = denorm_indeterminate;
604 static ETL_CONSTANT float_round_style round_style = round_indeterminate;
607 template <
typename T>
608 ETL_CONSTANT
bool floating_point_limits_common<T>::is_specialized;
610 template <
typename T>
611 ETL_CONSTANT
bool floating_point_limits_common<T>::is_signed;
613 template <
typename T>
614 ETL_CONSTANT
bool floating_point_limits_common<T>::is_integer;
616 template <
typename T>
617 ETL_CONSTANT
bool floating_point_limits_common<T>::is_exact;
619 template <
typename T>
620 ETL_CONSTANT
int floating_point_limits_common<T>::radix;
622 template <
typename T>
623 ETL_CONSTANT
bool floating_point_limits_common<T>::has_infinity;
625 template <
typename T>
626 ETL_CONSTANT
bool floating_point_limits_common<T>::has_quiet_NaN;
628 template <
typename T>
629 ETL_CONSTANT
bool floating_point_limits_common<T>::has_signaling_NaN;
631 template <
typename T>
632 ETL_CONSTANT
bool floating_point_limits_common<T>::has_denorm_loss;
634 template <
typename T>
635 ETL_CONSTANT
bool floating_point_limits_common<T>::is_iec559;
637 template <
typename T>
638 ETL_CONSTANT
bool floating_point_limits_common<T>::is_bounded;
640 template <
typename T>
641 ETL_CONSTANT
bool floating_point_limits_common<T>::is_modulo;
643 template <
typename T>
644 ETL_CONSTANT
bool floating_point_limits_common<T>::traps;
646 template <
typename T>
647 ETL_CONSTANT
bool floating_point_limits_common<T>::tinyness_before;
649 template <
typename T>
650 ETL_CONSTANT float_denorm_style floating_point_limits_common<T>::has_denorm;
652 template <
typename T>
653 ETL_CONSTANT float_round_style floating_point_limits_common<T>::round_style;
657 template <
typename T =
void>
658 struct floating_point_limits_float
660 static ETL_CONSTANT
int digits = FLT_MANT_DIG;
661 static ETL_CONSTANT
int digits10 = FLT_DIG;
662 static ETL_CONSTANT
int max_digits10 = ETL_LOG10_OF_2(FLT_MANT_DIG) + 2;
664 static ETL_CONSTANT
int min_exponent = FLT_MIN_EXP;
665 static ETL_CONSTANT
int min_exponent10 = FLT_MIN_10_EXP;
666 static ETL_CONSTANT
int max_exponent = FLT_MAX_EXP;
667 static ETL_CONSTANT
int max_exponent10 = FLT_MAX_10_EXP;
670 template <
typename T>
671 ETL_CONSTANT
int floating_point_limits_float<T>::digits;
673 template <
typename T>
674 ETL_CONSTANT
int floating_point_limits_float<T>::digits10;
676 template <
typename T>
677 ETL_CONSTANT
int floating_point_limits_float<T>::max_digits10;
679 template <
typename T>
680 ETL_CONSTANT
int floating_point_limits_float<T>::min_exponent;
682 template <
typename T>
683 ETL_CONSTANT
int floating_point_limits_float<T>::min_exponent10;
685 template <
typename T>
686 ETL_CONSTANT
int floating_point_limits_float<T>::max_exponent;
688 template <
typename T>
689 ETL_CONSTANT
int floating_point_limits_float<T>::max_exponent10;
693 template <
typename T =
void>
694 struct floating_point_limits_double
696 static ETL_CONSTANT
int digits = DBL_MANT_DIG;
697 static ETL_CONSTANT
int digits10 = DBL_DIG;
698 static ETL_CONSTANT
int max_digits10 = ETL_LOG10_OF_2(DBL_MANT_DIG) + 2;
700 static ETL_CONSTANT
int min_exponent = DBL_MIN_EXP;
701 static ETL_CONSTANT
int min_exponent10 = DBL_MIN_10_EXP;
702 static ETL_CONSTANT
int max_exponent = DBL_MAX_EXP;
703 static ETL_CONSTANT
int max_exponent10 = DBL_MAX_10_EXP;
706 template <
typename T>
707 ETL_CONSTANT
int floating_point_limits_double<T>::digits;
709 template <
typename T>
710 ETL_CONSTANT
int floating_point_limits_double<T>::digits10;
712 template <
typename T>
713 ETL_CONSTANT
int floating_point_limits_double<T>::max_digits10;
715 template <
typename T>
716 ETL_CONSTANT
int floating_point_limits_double<T>::min_exponent;
718 template <
typename T>
719 ETL_CONSTANT
int floating_point_limits_double<T>::min_exponent10;
721 template <
typename T>
722 ETL_CONSTANT
int floating_point_limits_double<T>::max_exponent;
724 template <
typename T>
725 ETL_CONSTANT
int floating_point_limits_double<T>::max_exponent10;
729 template <
typename T =
void>
730 struct floating_point_limits_long_double
732 static ETL_CONSTANT
int digits = LDBL_MANT_DIG;
733 static ETL_CONSTANT
int digits10 = LDBL_DIG;
734 static ETL_CONSTANT
int max_digits10 = ETL_LOG10_OF_2(LDBL_MANT_DIG) + 2;
736 static ETL_CONSTANT
int min_exponent = LDBL_MIN_EXP;
737 static ETL_CONSTANT
int min_exponent10 = LDBL_MIN_10_EXP;
738 static ETL_CONSTANT
int max_exponent = LDBL_MAX_EXP;
739 static ETL_CONSTANT
int max_exponent10 = LDBL_MAX_10_EXP;
742 template <
typename T>
743 ETL_CONSTANT
int floating_point_limits_long_double<T>::digits;
745 template <
typename T>
746 ETL_CONSTANT
int floating_point_limits_long_double<T>::digits10;
748 template <
typename T>
749 ETL_CONSTANT
int floating_point_limits_long_double<T>::max_digits10;
751 template <
typename T>
752 ETL_CONSTANT
int floating_point_limits_long_double<T>::min_exponent;
754 template <
typename T>
755 ETL_CONSTANT
int floating_point_limits_long_double<T>::min_exponent10;
757 template <
typename T>
758 ETL_CONSTANT
int floating_point_limits_long_double<T>::max_exponent;
760 template <
typename T>
761 ETL_CONSTANT
int floating_point_limits_long_double<T>::max_exponent10;
766 template <
typename T>
769 template <
typename T>
772 template <
typename T>
775 template <
typename T>
781 class numeric_limits<bool> :
public private_limits::integral_limits_common<>,
782 public private_limits::integral_limits_bool<>
786 static ETL_CONSTEXPR
bool min() {
return false; }
787 static ETL_CONSTEXPR
bool max() {
return true; }
788 static ETL_CONSTEXPR
bool lowest() {
return false; }
789 static ETL_CONSTEXPR
bool epsilon() {
return false; }
790 static ETL_CONSTEXPR
bool round_error() {
return false; }
791 static ETL_CONSTEXPR
bool denorm_min() {
return false; }
792 static ETL_CONSTEXPR
bool infinity() {
return false; }
793 static ETL_CONSTEXPR
bool quiet_NaN() {
return false; }
794 static ETL_CONSTEXPR
bool signaling_NaN() {
return false; }
800 class numeric_limits<char> :
public private_limits::integral_limits_common<>,
801 public private_limits::integral_limits_char<>
805 static ETL_CONSTEXPR
char min() {
return char(CHAR_MIN); }
806 static ETL_CONSTEXPR
char max() {
return char(CHAR_MAX); }
807 static ETL_CONSTEXPR
char lowest() {
return char(CHAR_MIN); }
808 static ETL_CONSTEXPR
char epsilon() {
return 0; }
809 static ETL_CONSTEXPR
char round_error() {
return 0; }
810 static ETL_CONSTEXPR
char denorm_min() {
return 0; }
811 static ETL_CONSTEXPR
char infinity() {
return 0; }
812 static ETL_CONSTEXPR
char quiet_NaN() {
return 0; }
813 static ETL_CONSTEXPR
char signaling_NaN() {
return 0; }
819 class numeric_limits<unsigned char> :
public private_limits::integral_limits_common<>,
820 public private_limits::integral_limits_unsigned_char<>
824 static ETL_CONSTEXPR
unsigned char min() {
return 0U; }
825 static ETL_CONSTEXPR
unsigned char max() {
return UCHAR_MAX; }
826 static ETL_CONSTEXPR
unsigned char lowest() {
return 0U; }
827 static ETL_CONSTEXPR
unsigned char epsilon() {
return 0U; }
828 static ETL_CONSTEXPR
unsigned char round_error() {
return 0U; }
829 static ETL_CONSTEXPR
unsigned char denorm_min() {
return 0U; }
830 static ETL_CONSTEXPR
unsigned char infinity() {
return 0U; }
831 static ETL_CONSTEXPR
unsigned char quiet_NaN() {
return 0U; }
832 static ETL_CONSTEXPR
unsigned char signaling_NaN() {
return 0U; }
838 class numeric_limits<signed char> :
public private_limits::integral_limits_common<>,
839 public private_limits::integral_limits_signed_char<>
843 static ETL_CONSTEXPR
signed char min() {
return SCHAR_MIN; }
844 static ETL_CONSTEXPR
signed char max() {
return SCHAR_MAX; }
845 static ETL_CONSTEXPR
signed char lowest() {
return SCHAR_MIN; }
846 static ETL_CONSTEXPR
signed char epsilon() {
return 0; }
847 static ETL_CONSTEXPR
signed char round_error() {
return 0; }
848 static ETL_CONSTEXPR
signed char denorm_min() {
return 0; }
849 static ETL_CONSTEXPR
signed char infinity() {
return 0; }
850 static ETL_CONSTEXPR
signed char quiet_NaN() {
return 0; }
851 static ETL_CONSTEXPR
signed char signaling_NaN() {
return 0; }
854#if ETL_HAS_NATIVE_CHAR8_T
858 class numeric_limits<char8_t> :
public private_limits::integral_limits_common<>,
859 public private_limits::integral_limits_char8_t<>
863 static ETL_CONSTEXPR
char8_t min() {
return char8_t(CHAR_MIN); }
864 static ETL_CONSTEXPR
char8_t max() {
return char8_t(CHAR_MAX); }
865 static ETL_CONSTEXPR
char8_t lowest() {
return char8_t(CHAR_MIN); }
866 static ETL_CONSTEXPR
char8_t epsilon() {
return 0; }
867 static ETL_CONSTEXPR
char8_t round_error() {
return 0; }
868 static ETL_CONSTEXPR
char8_t denorm_min() {
return 0; }
869 static ETL_CONSTEXPR
char8_t infinity() {
return 0; }
870 static ETL_CONSTEXPR
char8_t quiet_NaN() {
return 0; }
871 static ETL_CONSTEXPR
char8_t signaling_NaN() {
return 0; }
875#if ETL_HAS_NATIVE_CHAR16_T
879 class numeric_limits<char16_t> :
public private_limits::integral_limits_common<>,
880 public private_limits::integral_limits_char16_t<>
884 static ETL_CONSTEXPR
char16_t min() {
return 0U; }
885 static ETL_CONSTEXPR
char16_t max() {
return UINT_LEAST16_MAX; }
886 static ETL_CONSTEXPR
char16_t lowest() {
return 0U; }
887 static ETL_CONSTEXPR
char16_t epsilon() {
return 0U; }
888 static ETL_CONSTEXPR
char16_t round_error() {
return 0U; }
889 static ETL_CONSTEXPR
char16_t denorm_min() {
return 0U; }
890 static ETL_CONSTEXPR
char16_t infinity() {
return 0U; }
891 static ETL_CONSTEXPR
char16_t quiet_NaN() {
return 0U; }
892 static ETL_CONSTEXPR
char16_t signaling_NaN() {
return 0U; }
896#if ETL_HAS_NATIVE_CHAR32_T
900 class numeric_limits<char32_t> :
public private_limits::integral_limits_common<>,
901 public private_limits::integral_limits_char32_t<>
905 static ETL_CONSTEXPR
char32_t min() {
return 0U; }
906 static ETL_CONSTEXPR
char32_t max() {
return UINT_LEAST32_MAX; }
907 static ETL_CONSTEXPR
char32_t lowest() {
return 0U; }
908 static ETL_CONSTEXPR
char32_t epsilon() {
return 0U; }
909 static ETL_CONSTEXPR
char32_t round_error() {
return 0U; }
910 static ETL_CONSTEXPR
char32_t denorm_min() {
return 0U; }
911 static ETL_CONSTEXPR
char32_t infinity() {
return 0U; }
912 static ETL_CONSTEXPR
char32_t quiet_NaN() {
return 0U; }
913 static ETL_CONSTEXPR
char32_t signaling_NaN() {
return 0U; }
920 class numeric_limits<wchar_t> :
public private_limits::integral_limits_common<>,
921 public private_limits::integral_limits_wchar_t<>
925 static ETL_CONSTEXPR
wchar_t min() {
return WCHAR_MIN; }
926 static ETL_CONSTEXPR
wchar_t max() {
return WCHAR_MAX; }
927 static ETL_CONSTEXPR
wchar_t lowest() {
return WCHAR_MIN; }
928 static ETL_CONSTEXPR
wchar_t epsilon() {
return wchar_t(0); }
929 static ETL_CONSTEXPR
wchar_t round_error() {
return wchar_t(0); }
930 static ETL_CONSTEXPR
wchar_t denorm_min() {
return wchar_t(0); }
931 static ETL_CONSTEXPR
wchar_t infinity() {
return wchar_t(0); }
932 static ETL_CONSTEXPR
wchar_t quiet_NaN() {
return wchar_t(0); }
933 static ETL_CONSTEXPR
wchar_t signaling_NaN() {
return wchar_t(0); }
939 class numeric_limits<short> :
public private_limits::integral_limits_common<>,
940 public private_limits::integral_limits_short<>
944 static ETL_CONSTEXPR
short min() {
return SHRT_MIN; }
945 static ETL_CONSTEXPR
short max() {
return SHRT_MAX; }
946 static ETL_CONSTEXPR
short lowest() {
return SHRT_MIN; }
947 static ETL_CONSTEXPR
short epsilon() {
return 0; }
948 static ETL_CONSTEXPR
short round_error() {
return 0; }
949 static ETL_CONSTEXPR
short denorm_min() {
return 0; }
950 static ETL_CONSTEXPR
short infinity() {
return 0; }
951 static ETL_CONSTEXPR
short quiet_NaN() {
return 0; }
952 static ETL_CONSTEXPR
short signaling_NaN() {
return 0; }
958 class numeric_limits<unsigned short> :
public private_limits::integral_limits_common<>,
959 public private_limits::integral_limits_unsigned_short<>
963 static ETL_CONSTEXPR
unsigned short min() {
return 0U; }
964 static ETL_CONSTEXPR
unsigned short max() {
return USHRT_MAX; }
965 static ETL_CONSTEXPR
unsigned short lowest() {
return 0U; }
966 static ETL_CONSTEXPR
unsigned short epsilon() {
return 0U; }
967 static ETL_CONSTEXPR
unsigned short round_error() {
return 0U; }
968 static ETL_CONSTEXPR
unsigned short denorm_min() {
return 0U; }
969 static ETL_CONSTEXPR
unsigned short infinity() {
return 0U; }
970 static ETL_CONSTEXPR
unsigned short quiet_NaN() {
return 0U; }
971 static ETL_CONSTEXPR
unsigned short signaling_NaN() {
return 0U; }
977 class numeric_limits<int> :
public private_limits::integral_limits_common<>,
978 public private_limits::integral_limits_int<>
982 static ETL_CONSTEXPR
int min() {
return INT_MIN; }
983 static ETL_CONSTEXPR
int max() {
return INT_MAX; }
984 static ETL_CONSTEXPR
int lowest() {
return INT_MIN; }
985 static ETL_CONSTEXPR
int epsilon() {
return 0; }
986 static ETL_CONSTEXPR
int round_error() {
return 0; }
987 static ETL_CONSTEXPR
int denorm_min() {
return 0; }
988 static ETL_CONSTEXPR
int infinity() {
return 0; }
989 static ETL_CONSTEXPR
int quiet_NaN() {
return 0; }
990 static ETL_CONSTEXPR
int signaling_NaN() {
return 0; }
996 class numeric_limits<unsigned int> :
public private_limits::integral_limits_common<>,
997 public private_limits::integral_limits_unsigned_int<>
1001 static ETL_CONSTEXPR
unsigned int min() {
return 0U; }
1002 static ETL_CONSTEXPR
unsigned int max() {
return UINT_MAX; }
1003 static ETL_CONSTEXPR
unsigned int lowest() {
return 0U; }
1004 static ETL_CONSTEXPR
unsigned int epsilon() {
return 0U; }
1005 static ETL_CONSTEXPR
unsigned int round_error() {
return 0U; }
1006 static ETL_CONSTEXPR
unsigned int denorm_min() {
return 0U; }
1007 static ETL_CONSTEXPR
unsigned int infinity() {
return 0U; }
1008 static ETL_CONSTEXPR
unsigned int quiet_NaN() {
return 0U; }
1009 static ETL_CONSTEXPR
unsigned int signaling_NaN() {
return 0U; }
1015 class numeric_limits<long> :
public private_limits::integral_limits_common<>,
1016 public private_limits::integral_limits_long<>
1020 static ETL_CONSTEXPR
long min() {
return LONG_MIN; }
1021 static ETL_CONSTEXPR
long max() {
return LONG_MAX; }
1022 static ETL_CONSTEXPR
long lowest() {
return LONG_MIN; }
1023 static ETL_CONSTEXPR
long epsilon() {
return 0; }
1024 static ETL_CONSTEXPR
long round_error() {
return 0; }
1025 static ETL_CONSTEXPR
long denorm_min() {
return 0; }
1026 static ETL_CONSTEXPR
long infinity() {
return 0; }
1027 static ETL_CONSTEXPR
long quiet_NaN() {
return 0; }
1028 static ETL_CONSTEXPR
long signaling_NaN() {
return 0; }
1034 class numeric_limits<unsigned long> :
public private_limits::integral_limits_common<>,
1035 public private_limits::integral_limits_unsigned_long<>
1039 static ETL_CONSTEXPR
unsigned long min() {
return 0U; }
1040 static ETL_CONSTEXPR
unsigned long max() {
return ULONG_MAX; }
1041 static ETL_CONSTEXPR
unsigned long lowest() {
return 0U; }
1042 static ETL_CONSTEXPR
unsigned long epsilon() {
return 0U; }
1043 static ETL_CONSTEXPR
unsigned long round_error() {
return 0U; }
1044 static ETL_CONSTEXPR
unsigned long denorm_min() {
return 0U; }
1045 static ETL_CONSTEXPR
unsigned long infinity() {
return 0U; }
1046 static ETL_CONSTEXPR
unsigned long quiet_NaN() {
return 0U; }
1047 static ETL_CONSTEXPR
unsigned long signaling_NaN() {
return 0U; }
1053 class numeric_limits<long long> :
public private_limits::integral_limits_common<>,
1054 public private_limits::integral_limits_long_long<>
1058 static ETL_CONSTEXPR
long long min() {
return LLONG_MIN; }
1059 static ETL_CONSTEXPR
long long max() {
return LLONG_MAX; }
1060 static ETL_CONSTEXPR
long long lowest() {
return LLONG_MIN; }
1061 static ETL_CONSTEXPR
long long epsilon() {
return 0; }
1062 static ETL_CONSTEXPR
long long round_error() {
return 0; }
1063 static ETL_CONSTEXPR
long long denorm_min() {
return 0; }
1064 static ETL_CONSTEXPR
long long infinity() {
return 0; }
1065 static ETL_CONSTEXPR
long long quiet_NaN() {
return 0; }
1066 static ETL_CONSTEXPR
long long signaling_NaN() {
return 0; }
1072 class numeric_limits<unsigned long long> :
public private_limits::integral_limits_common<>,
1073 public private_limits::integral_limits_unsigned_long_long<>
1077 static ETL_CONSTEXPR
unsigned long long min() {
return 0U; }
1078 static ETL_CONSTEXPR
unsigned long long max() {
return ULLONG_MAX; }
1079 static ETL_CONSTEXPR
unsigned long long lowest() {
return 0U; }
1080 static ETL_CONSTEXPR
unsigned long long epsilon() {
return 0U; }
1081 static ETL_CONSTEXPR
unsigned long long round_error() {
return 0U; }
1082 static ETL_CONSTEXPR
unsigned long long denorm_min() {
return 0U; }
1083 static ETL_CONSTEXPR
unsigned long long infinity() {
return 0U; }
1084 static ETL_CONSTEXPR
unsigned long long quiet_NaN() {
return 0U; }
1085 static ETL_CONSTEXPR
unsigned long long signaling_NaN() {
return 0U; }
1091 class numeric_limits<float> :
public private_limits::floating_point_limits_common<>,
1092 public private_limits::floating_point_limits_float<>
1096 static ETL_CONSTEXPR
float min() {
return FLT_MIN; }
1097 static ETL_CONSTEXPR
float max() {
return FLT_MAX; }
1098 static ETL_CONSTEXPR
float lowest() {
return -FLT_MAX; }
1099 static ETL_CONSTEXPR
float epsilon() {
return FLT_EPSILON; }
1100 static ETL_CONSTEXPR
float denorm_min() {
return FLT_MIN; }
1101 static ETL_CONSTEXPR
float infinity() {
return HUGE_VALF; }
1102 static float round_error() {
return 0.5f; }
1103 static float quiet_NaN() {
return ETL_NANF; }
1104 static float signaling_NaN() {
return ETL_NANF; }
1110 class numeric_limits<double> :
public private_limits::floating_point_limits_common<>,
1111 public private_limits::floating_point_limits_double<>
1115 static ETL_CONSTEXPR
double min() {
return DBL_MIN; }
1116 static ETL_CONSTEXPR
double max() {
return DBL_MAX; }
1117 static ETL_CONSTEXPR
double lowest() {
return -DBL_MAX; }
1118 static ETL_CONSTEXPR
double epsilon() {
return DBL_EPSILON; }
1119 static ETL_CONSTEXPR
double denorm_min() {
return DBL_MIN; }
1120 static ETL_CONSTEXPR
double infinity() {
return HUGE_VAL; }
1121 static double round_error() {
return 0.5; }
1122 static double quiet_NaN() {
return ETL_NAN; }
1123 static double signaling_NaN() {
return ETL_NAN; }
1129 class numeric_limits<long double> :
public private_limits::floating_point_limits_common<>,
1130 public private_limits::floating_point_limits_long_double<>
1134 static ETL_CONSTEXPR
long double min() {
return LDBL_MIN; }
1135 static ETL_CONSTEXPR
long double max() {
return LDBL_MAX; }
1136 static ETL_CONSTEXPR
long double lowest() {
return -LDBL_MAX; }
1137 static ETL_CONSTEXPR
long double epsilon() {
return LDBL_EPSILON; }
1138 static ETL_CONSTEXPR
long double denorm_min() {
return LDBL_MIN; }
1139 static ETL_CONSTEXPR
long double infinity() {
return HUGE_VALL; }
1140 static long double round_error() {
return 0.5L; }
1141 static long double quiet_NaN() {
return ETL_NANL; }
1142 static long double signaling_NaN() {
return ETL_NANL; }
1152 enum float_round_style
1154 round_indeterminate = std::round_indeterminate,
1155 round_toward_zero = std::round_toward_zero,
1156 round_to_nearest = std::round_to_nearest,
1157 round_toward_infinity = std::round_toward_infinity,
1158 round_toward_neg_infinity = std::round_toward_neg_infinity,
1162 enum float_denorm_style
1164 denorm_indeterminate = std::denorm_indeterminate,
1165 denorm_absent = std::denorm_absent,
1166 denorm_present = std::denorm_present
1171 template <
typename T>
1174 template <
typename T>
1182#if defined(ETL_COMPILER_MICROSOFT)
1183 #pragma warning(pop)
bitset_ext
Definition absolute.h:39