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
49#if defined(ETL_COMPILER_MICROSOFT)
51 #pragma warning(disable : 26812)
55 #define ETL_LOG10_OF_2(x) (((x) * 301) / 1000)
57 #if !defined(LDBL_MIN) && defined(DBL_MIN)
60 #define LDBL_MIN DBL_MIN
61 #define LDBL_MAX DBL_MAX
62 #define LDBL_EPSILON DBL_EPSILON
63 #define LDBL_MANT_DIG DBL_MANT_DIG
64 #define LDBL_DIG DBL_DIG
65 #define LDBL_MIN_EXP DBL_MIN_EXP
66 #define LDBL_MIN_10_EXP DBL_MIN_10_EXP
67 #define LDBL_MAX_EXP DBL_MAX_EXP
68 #define LDBL_MAX_10_EXP DBL_MAX_10_EXP
71 #if !defined(HUGE_VAL)
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>
774 template <
typename T>
779 template <
typename T>
788 :
public private_limits::integral_limits_common<>
789 ,
public private_limits::integral_limits_bool<>
793 static ETL_CONSTEXPR
bool min()
797 static ETL_CONSTEXPR
bool max()
801 static ETL_CONSTEXPR
bool lowest()
805 static ETL_CONSTEXPR
bool epsilon()
809 static ETL_CONSTEXPR
bool round_error()
813 static ETL_CONSTEXPR
bool denorm_min()
817 static ETL_CONSTEXPR
bool infinity()
821 static ETL_CONSTEXPR
bool quiet_NaN()
825 static ETL_CONSTEXPR
bool signaling_NaN()
835 :
public private_limits::integral_limits_common<>
836 ,
public private_limits::integral_limits_char<>
840 static ETL_CONSTEXPR
char min()
842 return char(CHAR_MIN);
844 static ETL_CONSTEXPR
char max()
846 return char(CHAR_MAX);
848 static ETL_CONSTEXPR
char lowest()
850 return char(CHAR_MIN);
852 static ETL_CONSTEXPR
char epsilon()
856 static ETL_CONSTEXPR
char round_error()
860 static ETL_CONSTEXPR
char denorm_min()
864 static ETL_CONSTEXPR
char infinity()
868 static ETL_CONSTEXPR
char quiet_NaN()
872 static ETL_CONSTEXPR
char signaling_NaN()
882 :
public private_limits::integral_limits_common<>
883 ,
public private_limits::integral_limits_unsigned_char<>
887 static ETL_CONSTEXPR
unsigned char min()
891 static ETL_CONSTEXPR
unsigned char max()
895 static ETL_CONSTEXPR
unsigned char lowest()
899 static ETL_CONSTEXPR
unsigned char epsilon()
903 static ETL_CONSTEXPR
unsigned char round_error()
907 static ETL_CONSTEXPR
unsigned char denorm_min()
911 static ETL_CONSTEXPR
unsigned char infinity()
915 static ETL_CONSTEXPR
unsigned char quiet_NaN()
919 static ETL_CONSTEXPR
unsigned char signaling_NaN()
929 :
public private_limits::integral_limits_common<>
930 ,
public private_limits::integral_limits_signed_char<>
934 static ETL_CONSTEXPR
signed char min()
938 static ETL_CONSTEXPR
signed char max()
942 static ETL_CONSTEXPR
signed char lowest()
946 static ETL_CONSTEXPR
signed char epsilon()
950 static ETL_CONSTEXPR
signed char round_error()
954 static ETL_CONSTEXPR
signed char denorm_min()
958 static ETL_CONSTEXPR
signed char infinity()
962 static ETL_CONSTEXPR
signed char quiet_NaN()
966 static ETL_CONSTEXPR
signed char signaling_NaN()
972 #if ETL_HAS_NATIVE_CHAR8_T
977 :
public private_limits::integral_limits_common<>
978 ,
public private_limits::integral_limits_char8_t<>
982 static ETL_CONSTEXPR
char8_t min()
984 return char8_t(CHAR_MIN);
986 static ETL_CONSTEXPR
char8_t max()
988 return char8_t(CHAR_MAX);
990 static ETL_CONSTEXPR
char8_t lowest()
992 return char8_t(CHAR_MIN);
994 static ETL_CONSTEXPR
char8_t epsilon()
998 static ETL_CONSTEXPR
char8_t round_error()
1002 static ETL_CONSTEXPR
char8_t denorm_min()
1006 static ETL_CONSTEXPR
char8_t infinity()
1010 static ETL_CONSTEXPR
char8_t quiet_NaN()
1014 static ETL_CONSTEXPR
char8_t signaling_NaN()
1021 #if ETL_HAS_NATIVE_CHAR16_T
1026 :
public private_limits::integral_limits_common<>
1027 ,
public private_limits::integral_limits_char16_t<>
1031 static ETL_CONSTEXPR
char16_t min()
1035 static ETL_CONSTEXPR
char16_t max()
1037 return UINT_LEAST16_MAX;
1039 static ETL_CONSTEXPR
char16_t lowest()
1043 static ETL_CONSTEXPR
char16_t epsilon()
1047 static ETL_CONSTEXPR
char16_t round_error()
1051 static ETL_CONSTEXPR
char16_t denorm_min()
1055 static ETL_CONSTEXPR
char16_t infinity()
1059 static ETL_CONSTEXPR
char16_t quiet_NaN()
1063 static ETL_CONSTEXPR
char16_t signaling_NaN()
1070 #if ETL_HAS_NATIVE_CHAR32_T
1075 :
public private_limits::integral_limits_common<>
1076 ,
public private_limits::integral_limits_char32_t<>
1080 static ETL_CONSTEXPR
char32_t min()
1084 static ETL_CONSTEXPR
char32_t max()
1086 return UINT_LEAST32_MAX;
1088 static ETL_CONSTEXPR
char32_t lowest()
1092 static ETL_CONSTEXPR
char32_t epsilon()
1096 static ETL_CONSTEXPR
char32_t round_error()
1100 static ETL_CONSTEXPR
char32_t denorm_min()
1104 static ETL_CONSTEXPR
char32_t infinity()
1108 static ETL_CONSTEXPR
char32_t quiet_NaN()
1112 static ETL_CONSTEXPR
char32_t signaling_NaN()
1123 :
public private_limits::integral_limits_common<>
1124 ,
public private_limits::integral_limits_wchar_t<>
1128 static ETL_CONSTEXPR
wchar_t min()
1132 static ETL_CONSTEXPR
wchar_t max()
1136 static ETL_CONSTEXPR
wchar_t lowest()
1140 static ETL_CONSTEXPR
wchar_t epsilon()
1144 static ETL_CONSTEXPR
wchar_t round_error()
1148 static ETL_CONSTEXPR
wchar_t denorm_min()
1152 static ETL_CONSTEXPR
wchar_t infinity()
1156 static ETL_CONSTEXPR
wchar_t quiet_NaN()
1160 static ETL_CONSTEXPR
wchar_t signaling_NaN()
1170 :
public private_limits::integral_limits_common<>
1171 ,
public private_limits::integral_limits_short<>
1175 static ETL_CONSTEXPR
short min()
1179 static ETL_CONSTEXPR
short max()
1183 static ETL_CONSTEXPR
short lowest()
1187 static ETL_CONSTEXPR
short epsilon()
1191 static ETL_CONSTEXPR
short round_error()
1195 static ETL_CONSTEXPR
short denorm_min()
1199 static ETL_CONSTEXPR
short infinity()
1203 static ETL_CONSTEXPR
short quiet_NaN()
1207 static ETL_CONSTEXPR
short signaling_NaN()
1217 :
public private_limits::integral_limits_common<>
1218 ,
public private_limits::integral_limits_unsigned_short<>
1222 static ETL_CONSTEXPR
unsigned short min()
1226 static ETL_CONSTEXPR
unsigned short max()
1230 static ETL_CONSTEXPR
unsigned short lowest()
1234 static ETL_CONSTEXPR
unsigned short epsilon()
1238 static ETL_CONSTEXPR
unsigned short round_error()
1242 static ETL_CONSTEXPR
unsigned short denorm_min()
1246 static ETL_CONSTEXPR
unsigned short infinity()
1250 static ETL_CONSTEXPR
unsigned short quiet_NaN()
1254 static ETL_CONSTEXPR
unsigned short signaling_NaN()
1264 :
public private_limits::integral_limits_common<>
1265 ,
public private_limits::integral_limits_int<>
1269 static ETL_CONSTEXPR
int min()
1273 static ETL_CONSTEXPR
int max()
1277 static ETL_CONSTEXPR
int lowest()
1281 static ETL_CONSTEXPR
int epsilon()
1285 static ETL_CONSTEXPR
int round_error()
1289 static ETL_CONSTEXPR
int denorm_min()
1293 static ETL_CONSTEXPR
int infinity()
1297 static ETL_CONSTEXPR
int quiet_NaN()
1301 static ETL_CONSTEXPR
int signaling_NaN()
1311 :
public private_limits::integral_limits_common<>
1312 ,
public private_limits::integral_limits_unsigned_int<>
1316 static ETL_CONSTEXPR
unsigned int min()
1320 static ETL_CONSTEXPR
unsigned int max()
1324 static ETL_CONSTEXPR
unsigned int lowest()
1328 static ETL_CONSTEXPR
unsigned int epsilon()
1332 static ETL_CONSTEXPR
unsigned int round_error()
1336 static ETL_CONSTEXPR
unsigned int denorm_min()
1340 static ETL_CONSTEXPR
unsigned int infinity()
1344 static ETL_CONSTEXPR
unsigned int quiet_NaN()
1348 static ETL_CONSTEXPR
unsigned int signaling_NaN()
1358 :
public private_limits::integral_limits_common<>
1359 ,
public private_limits::integral_limits_long<>
1363 static ETL_CONSTEXPR
long min()
1367 static ETL_CONSTEXPR
long max()
1371 static ETL_CONSTEXPR
long lowest()
1375 static ETL_CONSTEXPR
long epsilon()
1379 static ETL_CONSTEXPR
long round_error()
1383 static ETL_CONSTEXPR
long denorm_min()
1387 static ETL_CONSTEXPR
long infinity()
1391 static ETL_CONSTEXPR
long quiet_NaN()
1395 static ETL_CONSTEXPR
long signaling_NaN()
1405 :
public private_limits::integral_limits_common<>
1406 ,
public private_limits::integral_limits_unsigned_long<>
1410 static ETL_CONSTEXPR
unsigned long min()
1414 static ETL_CONSTEXPR
unsigned long max()
1418 static ETL_CONSTEXPR
unsigned long lowest()
1422 static ETL_CONSTEXPR
unsigned long epsilon()
1426 static ETL_CONSTEXPR
unsigned long round_error()
1430 static ETL_CONSTEXPR
unsigned long denorm_min()
1434 static ETL_CONSTEXPR
unsigned long infinity()
1438 static ETL_CONSTEXPR
unsigned long quiet_NaN()
1442 static ETL_CONSTEXPR
unsigned long signaling_NaN()
1452 :
public private_limits::integral_limits_common<>
1453 ,
public private_limits::integral_limits_long_long<>
1457 static ETL_CONSTEXPR
long long min()
1461 static ETL_CONSTEXPR
long long max()
1465 static ETL_CONSTEXPR
long long lowest()
1469 static ETL_CONSTEXPR
long long epsilon()
1473 static ETL_CONSTEXPR
long long round_error()
1477 static ETL_CONSTEXPR
long long denorm_min()
1481 static ETL_CONSTEXPR
long long infinity()
1485 static ETL_CONSTEXPR
long long quiet_NaN()
1489 static ETL_CONSTEXPR
long long signaling_NaN()
1499 :
public private_limits::integral_limits_common<>
1500 ,
public private_limits::integral_limits_unsigned_long_long<>
1504 static ETL_CONSTEXPR
unsigned long long min()
1508 static ETL_CONSTEXPR
unsigned long long max()
1512 static ETL_CONSTEXPR
unsigned long long lowest()
1516 static ETL_CONSTEXPR
unsigned long long epsilon()
1520 static ETL_CONSTEXPR
unsigned long long round_error()
1524 static ETL_CONSTEXPR
unsigned long long denorm_min()
1528 static ETL_CONSTEXPR
unsigned long long infinity()
1532 static ETL_CONSTEXPR
unsigned long long quiet_NaN()
1536 static ETL_CONSTEXPR
unsigned long long signaling_NaN()
1546 :
public private_limits::floating_point_limits_common<>
1547 ,
public private_limits::floating_point_limits_float<>
1551 static ETL_CONSTEXPR
float min()
1555 static ETL_CONSTEXPR
float max()
1559 static ETL_CONSTEXPR
float lowest()
1563 static ETL_CONSTEXPR
float epsilon()
1567 static ETL_CONSTEXPR
float denorm_min()
1571 static ETL_CONSTEXPR
float infinity()
1575 static float round_error()
1579 static float quiet_NaN()
1583 static float signaling_NaN()
1593 :
public private_limits::floating_point_limits_common<>
1594 ,
public private_limits::floating_point_limits_double<>
1598 static ETL_CONSTEXPR
double min()
1602 static ETL_CONSTEXPR
double max()
1606 static ETL_CONSTEXPR
double lowest()
1610 static ETL_CONSTEXPR
double epsilon()
1614 static ETL_CONSTEXPR
double denorm_min()
1618 static ETL_CONSTEXPR
double infinity()
1622 static double round_error()
1626 static double quiet_NaN()
1630 static double signaling_NaN()
1640 :
public private_limits::floating_point_limits_common<>
1641 ,
public private_limits::floating_point_limits_long_double<>
1645 static ETL_CONSTEXPR
long double min()
1649 static ETL_CONSTEXPR
long double max()
1653 static ETL_CONSTEXPR
long double lowest()
1657 static ETL_CONSTEXPR
long double epsilon()
1659 return LDBL_EPSILON;
1661 static ETL_CONSTEXPR
long double denorm_min()
1665 static ETL_CONSTEXPR
long double infinity()
1669 static long double round_error()
1673 static long double quiet_NaN()
1677 static long double signaling_NaN()
1690 enum float_round_style
1692 round_indeterminate = std::round_indeterminate,
1693 round_toward_zero = std::round_toward_zero,
1694 round_to_nearest = std::round_to_nearest,
1695 round_toward_infinity = std::round_toward_infinity,
1696 round_toward_neg_infinity = std::round_toward_neg_infinity,
1700 enum float_denorm_style
1702 denorm_indeterminate = std::denorm_indeterminate,
1703 denorm_absent = std::denorm_absent,
1704 denorm_present = std::denorm_present
1709 template <
typename T>
1712 template <
typename T>
1720#if defined(ETL_COMPILER_MICROSOFT)
1721 #pragma warning(pop)