fennec
Loading...
Searching...
No Matches
limits.h
Go to the documentation of this file.
1// =====================================================================================================================
2// fennec, a free and open source game engine
3// Copyright © 2025 Medusa Slockbower
4//
5// This program is free software: you can redistribute it and/or modify
6// it under the terms of the GNU General Public License as published by
7// the Free Software Foundation, either version 3 of the License, or
8// (at your option) any later version.
9//
10// This program is distributed in the hope that it will be useful,
11// but WITHOUT ANY WARRANTY; without even the implied warranty of
12// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13// GNU General Public License for more details.
14//
15// You should have received a copy of the GNU General Public License
16// along with this program. If not, see <https://www.gnu.org/licenses/>.
17// =====================================================================================================================
18
30
31
32#ifndef FENNEC_LANG_LIMITS_H
33#define FENNEC_LANG_LIMITS_H
34
199
200#include <fennec/lang/types.h>
202
203#include <fennec/lang/integer.h>
204#include <fennec/lang/float.h>
205
206namespace fennec
207{
208
212{
213 round_indeterminate = -1
214, round_toward_zero = 0
215, round_to_nearest = 1
216, round_toward_infinity = 2
217, round_toward_neg_infinity = 3
218};
219
223template<typename TypeT> struct numeric_limits
224{
225 static constexpr bool is_specialized = false;
226 static constexpr bool is_signed = false;
227 static constexpr bool is_integer = false;
228 static constexpr bool is_exact = false;
229 static constexpr bool has_infinity = false;
230 static constexpr bool has_quiet_nan = false;
231 static constexpr bool has_signaling_nan = false;
232 static constexpr bool has_denorm = false;
233 static constexpr bool has_denorm_loss = false;
234 static constexpr bool is_iec559 = false;
235 static constexpr bool is_bounded = false;
236 static constexpr bool is_modulo = false;
237 static constexpr bool tinyness_before = false;
238 static constexpr bool traps = false;
239
240 static constexpr int radix = 0;
241 static constexpr int digits = 0;
242 static constexpr int digits10 = 0;
243 static constexpr int max_digits10 = 0;
244 static constexpr int min_exponent = 0;
245 static constexpr int min_exponent10 = 0;
246 static constexpr int max_exponent = 0;
247 static constexpr int max_exponent10 = 0;
248
249 static constexpr float_round_style rounding_style = round_indeterminate;
250
251 // This is very poorly named and defined in the C++ Standard so these functions differ
252 static constexpr TypeT min() { return TypeT(); }
253 static constexpr TypeT max() { return TypeT(); }
254 static constexpr TypeT lowest() { return TypeT(); }
255 static constexpr TypeT epsilon() { return TypeT(); }
256 static constexpr TypeT round_error() { return TypeT(); }
257 static constexpr TypeT infinity() { return TypeT(); }
258 static constexpr TypeT quiet_NaN() { return TypeT(); }
259 static constexpr TypeT signaling_NaN() { return TypeT(); }
260 static constexpr TypeT denorm_min() { return TypeT(); }
261};
262
263// Overload definitions for basic types
264
265// Overload for the builtin floating point type
266template<> struct numeric_limits<float>
267{
268 static constexpr bool is_specialized = true;
269 static constexpr bool is_signed = true;
270 static constexpr bool is_integer = false;
271 static constexpr bool is_exact = false;
272 static constexpr bool has_infinity = FLT_HAS_INFINITY;
273 static constexpr bool has_quiet_nan = FLT_HAS_QUIET_NAN;
274 static constexpr bool has_signaling_nan = FLT_HAS_SIGNALING_NAN;
275 static constexpr bool has_denorm = FLT_HAS_DENORM;
276 static constexpr bool has_denorm_loss = FLT_HAS_DENORM_LOSS;
277 static constexpr bool is_iec559 = FLT_IS_IEC559;
278 static constexpr bool is_bounded = true;
279 static constexpr bool is_modulo = false;
280 static constexpr bool tinyness_before = FLT_TINYNESS_BEFORE;
281 static constexpr bool traps = FLT_TRAPS;
282
283 static constexpr int digits = FLT_MANT_DIG;
284 static constexpr int digits10 = FLT_DIG;
285 static constexpr int max_digits10 = FLT_DECIMAL_DIG;
286 static constexpr int radix = FLT_RADIX;
287 static constexpr int min_exponent = FLT_MIN_EXP;
288 static constexpr int min_exponent10 = FLT_MIN_10_EXP;
289 static constexpr int max_exponent = FLT_MAX_EXP;
290 static constexpr int max_exponent10 = FLT_MAX_10_EXP;
291
292 static constexpr float min() { return -FLT_MAX; }
293 static constexpr float max() { return FLT_MAX; }
294 static constexpr float lowest() { return FLT_MIN; }
295 static constexpr float epsilon() { return FLT_EPSILON; }
296 static constexpr float round_error() { return FLT_ROUND_ERR; }
297 static constexpr float infinity() { return FLT_INF; }
298 static constexpr float quiet_NaN() { return FLT_QUIET_NAN; }
299 static constexpr float signaling_NaN() { return FLT_SIGNALING_NAN; }
300 static constexpr float denorm_min() { return FLT_DENORM_MIN; }
301};
302
303// Overload for the bultin double precision floating point type
304template<> struct numeric_limits<double>
305{
306 static constexpr bool is_specialized = true;
307 static constexpr bool is_signed = true;
308 static constexpr bool is_integer = false;
309 static constexpr bool is_exact = false;
310 static constexpr bool has_infinity = DBL_HAS_INFINITY;
311 static constexpr bool has_quiet_nan = DBL_HAS_QUIET_NAN;
312 static constexpr bool has_signaling_nan = DBL_HAS_SIGNALING_NAN;
313 static constexpr bool has_denorm = DBL_HAS_DENORM;
314 static constexpr bool has_denorm_loss = DBL_HAS_DENORM_LOSS;
315 static constexpr bool is_iec559 = DBL_IS_IEC559;
316 static constexpr bool is_bounded = true;
317 static constexpr bool is_modulo = false;
318 static constexpr bool tinyness_before = DBL_TINYNESS_BEFORE;
319 static constexpr bool traps = DBL_TRAPS;
320
321 static constexpr int digits = DBL_MANT_DIG;
322 static constexpr int digits10 = DBL_DIG;
323 static constexpr int max_digits10 = DBL_DECIMAL_DIG;
324 static constexpr int radix = DBL_RADIX;
325 static constexpr int min_exponent = DBL_MIN_EXP;
326 static constexpr int min_exponent10 = DBL_MIN_10_EXP;
327 static constexpr int max_exponent = DBL_MAX_EXP;
328 static constexpr int max_exponent10 = DBL_MAX_10_EXP;
329
330 static constexpr double min() { return -DBL_MAX; }
331 static constexpr double max() { return DBL_MAX; }
332 static constexpr double lowest() { return DBL_MIN; }
333 static constexpr double epsilon() { return DBL_EPSILON; }
334 static constexpr double round_error() { return DBL_ROUND_ERR; }
335 static constexpr double infinity() { return DBL_INF; }
336 static constexpr double quiet_NaN() { return DBL_QUIET_NAN; }
337 static constexpr double signaling_NaN() { return DBL_SIGNALING_NAN; }
338 static constexpr double denorm_min() { return DBL_DENORM_MIN; }
339};
340
341// Overload for the builtin char type
342template<> struct numeric_limits<char>
343{
344 static constexpr bool is_specialized = true;
345 static constexpr bool is_signed = CHAR_IS_SIGNED;
346 static constexpr bool is_integer = true;
347 static constexpr bool is_exact = true;
348 static constexpr bool has_infinity = false;
349 static constexpr bool has_quiet_nan = false;
350 static constexpr bool has_signaling_nan = false;
351 static constexpr bool has_denorm = false;
352 static constexpr bool has_denorm_loss = false;
353 static constexpr bool is_iec559 = false;
354 static constexpr bool is_bounded = true;
355 static constexpr bool is_modulo = true;
356 static constexpr bool tinyness_before = false;
357 static constexpr bool traps = true;
358
359 static constexpr int digits = CHAR_RADIX_DIG;
360 static constexpr int digits10 = CHAR_DIG;
361 static constexpr int max_digits10 = CHAR_DECIMAL_DIG;
362 static constexpr int radix = CHAR_RADIX;
363 static constexpr int min_exponent = 0;
364 static constexpr int min_exponent10 = 0;
365 static constexpr int max_exponent = 0;
366 static constexpr int max_exponent10 = 0;
367
368 static constexpr char min() { return static_cast<char>(CHAR_MIN); }
369 static constexpr char max() { return CHAR_MAX; }
370 static constexpr char lowest() { return 1; }
371 static constexpr char epsilon() { return 1; }
372 static constexpr char round_error() { return 0; }
373 static constexpr char infinity() { return 0; }
374 static constexpr char quiet_NaN() { return 0; }
375 static constexpr char signaling_NaN() { return 0; }
376 static constexpr char denorm_min() { return 0; }
377};
378
379// Overload for the builtin signed char type
380template<> struct numeric_limits<signed char>
381{
382 static constexpr bool is_specialized = true;
383 static constexpr bool is_signed = true;
384 static constexpr bool is_integer = true;
385 static constexpr bool is_exact = true;
386 static constexpr bool has_infinity = false;
387 static constexpr bool has_quiet_nan = false;
388 static constexpr bool has_signaling_nan = false;
389 static constexpr bool has_denorm = false;
390 static constexpr bool has_denorm_loss = false;
391 static constexpr bool is_iec559 = false;
392 static constexpr bool is_bounded = true;
393 static constexpr bool is_modulo = true;
394 static constexpr bool tinyness_before = false;
395 static constexpr bool traps = true;
396
397 static constexpr int digits = SCHAR_RADIX_DIG;
398 static constexpr int digits10 = SCHAR_DIG;
399 static constexpr int max_digits10 = SCHAR_DECIMAL_DIG;
400 static constexpr int radix = SCHAR_RADIX;
401 static constexpr int min_exponent = 0;
402 static constexpr int min_exponent10 = 0;
403 static constexpr int max_exponent = 0;
404 static constexpr int max_exponent10 = 0;
405
406 static constexpr signed char min() { return static_cast<signed char>(SCHAR_MIN); }
407 static constexpr signed char max() { return SCHAR_MAX; }
408 static constexpr signed char lowest() { return 1; }
409 static constexpr signed char epsilon() { return 1; }
410 static constexpr signed char round_error() { return 0; }
411 static constexpr signed char infinity() { return 0; }
412 static constexpr signed char quiet_NaN() { return 0; }
413 static constexpr signed char signaling_NaN() { return 0; }
414 static constexpr signed char denorm_min() { return 0; }
415};
416
417// Overload for the builtin signed char type
418template<> struct numeric_limits<unsigned char>
419{
420 static constexpr bool is_specialized = true;
421 static constexpr bool is_signed = false;
422 static constexpr bool is_integer = true;
423 static constexpr bool is_exact = true;
424 static constexpr bool has_infinity = false;
425 static constexpr bool has_quiet_nan = false;
426 static constexpr bool has_signaling_nan = false;
427 static constexpr bool has_denorm = false;
428 static constexpr bool has_denorm_loss = false;
429 static constexpr bool is_iec559 = false;
430 static constexpr bool is_bounded = true;
431 static constexpr bool is_modulo = true;
432 static constexpr bool tinyness_before = false;
433 static constexpr bool traps = true;
434
435 static constexpr int digits = UCHAR_RADIX_DIG;
436 static constexpr int digits10 = UCHAR_DIG;
437 static constexpr int max_digits10 = UCHAR_DECIMAL_DIG;
438 static constexpr int radix = UCHAR_RADIX;
439 static constexpr int min_exponent = 0;
440 static constexpr int min_exponent10 = 0;
441 static constexpr int max_exponent = 0;
442 static constexpr int max_exponent10 = 0;
443
444 static constexpr unsigned char min() { return UCHAR_MIN; }
445 static constexpr unsigned char max() { return UCHAR_MAX; }
446 static constexpr unsigned char lowest() { return 1; }
447 static constexpr unsigned char epsilon() { return 1; }
448 static constexpr unsigned char round_error() { return 0; }
449 static constexpr unsigned char infinity() { return 0; }
450 static constexpr unsigned char quiet_NaN() { return 0; }
451 static constexpr unsigned char signaling_NaN() { return 0; }
452 static constexpr unsigned char denorm_min() { return 0; }
453};
454
455// Overload for the builtin signed char type
456template<> struct numeric_limits<short>
457{
458 static constexpr bool is_specialized = true;
459 static constexpr bool is_signed = true;
460 static constexpr bool is_integer = true;
461 static constexpr bool is_exact = true;
462 static constexpr bool has_infinity = false;
463 static constexpr bool has_quiet_nan = false;
464 static constexpr bool has_signaling_nan = false;
465 static constexpr bool has_denorm = false;
466 static constexpr bool has_denorm_loss = false;
467 static constexpr bool is_iec559 = false;
468 static constexpr bool is_bounded = true;
469 static constexpr bool is_modulo = true;
470 static constexpr bool tinyness_before = false;
471 static constexpr bool traps = true;
472
473 static constexpr int digits = SHORT_RADIX_DIG;
474 static constexpr int digits10 = SHORT_DIG;
475 static constexpr int max_digits10 = SHORT_DECIMAL_DIG;
476 static constexpr int radix = SHORT_RADIX;
477 static constexpr int min_exponent = 0;
478 static constexpr int min_exponent10 = 0;
479 static constexpr int max_exponent = 0;
480 static constexpr int max_exponent10 = 0;
481
482 static constexpr short min() { return static_cast<short>(SHORT_MIN); }
483 static constexpr short max() { return SHORT_MAX; }
484 static constexpr short lowest() { return 1; }
485 static constexpr short epsilon() { return 1; }
486 static constexpr short round_error() { return 0; }
487 static constexpr short infinity() { return 0; }
488 static constexpr short quiet_NaN() { return 0; }
489 static constexpr short signaling_NaN() { return 0; }
490 static constexpr short denorm_min() { return 0; }
491};
492
493// Overload for the builtin signed char type
494template<> struct numeric_limits<unsigned short>
495{
496 static constexpr bool is_specialized = true;
497 static constexpr bool is_signed = false;
498 static constexpr bool is_integer = true;
499 static constexpr bool is_exact = true;
500 static constexpr bool has_infinity = false;
501 static constexpr bool has_quiet_nan = false;
502 static constexpr bool has_signaling_nan = false;
503 static constexpr bool has_denorm = false;
504 static constexpr bool has_denorm_loss = false;
505 static constexpr bool is_iec559 = false;
506 static constexpr bool is_bounded = true;
507 static constexpr bool is_modulo = true;
508 static constexpr bool tinyness_before = false;
509 static constexpr bool traps = true;
510
511 static constexpr int digits = USHORT_RADIX_DIG;
512 static constexpr int digits10 = USHORT_DIG;
513 static constexpr int max_digits10 = USHORT_DECIMAL_DIG;
514 static constexpr int radix = USHORT_RADIX;
515 static constexpr int min_exponent = 0;
516 static constexpr int min_exponent10 = 0;
517 static constexpr int max_exponent = 0;
518 static constexpr int max_exponent10 = 0;
519
520 static constexpr unsigned short min() { return USHORT_MIN; }
521 static constexpr unsigned short max() { return USHORT_MAX; }
522 static constexpr unsigned short lowest() { return 1; }
523 static constexpr unsigned short epsilon() { return 1; }
524 static constexpr unsigned short round_error() { return 0; }
525 static constexpr unsigned short infinity() { return 0; }
526 static constexpr unsigned short quiet_NaN() { return 0; }
527 static constexpr unsigned short signaling_NaN() { return 0; }
528 static constexpr unsigned short denorm_min() { return 0; }
529};
530
531// Overload for the builtin signed char type
532template<> struct numeric_limits<int>
533{
534 static constexpr bool is_specialized = true;
535 static constexpr bool is_signed = true;
536 static constexpr bool is_integer = true;
537 static constexpr bool is_exact = true;
538 static constexpr bool has_infinity = false;
539 static constexpr bool has_quiet_nan = false;
540 static constexpr bool has_signaling_nan = false;
541 static constexpr bool has_denorm = false;
542 static constexpr bool has_denorm_loss = false;
543 static constexpr bool is_iec559 = false;
544 static constexpr bool is_bounded = true;
545 static constexpr bool is_modulo = true;
546 static constexpr bool tinyness_before = false;
547 static constexpr bool traps = true;
548
549 static constexpr int digits = INT_RADIX_DIG;
550 static constexpr int digits10 = INT_DIG;
551 static constexpr int max_digits10 = INT_DECIMAL_DIG;
552 static constexpr int radix = INT_RADIX;
553 static constexpr int min_exponent = 0;
554 static constexpr int min_exponent10 = 0;
555 static constexpr int max_exponent = 0;
556 static constexpr int max_exponent10 = 0;
557
558 static constexpr int min() { return INT_MIN; }
559 static constexpr int max() { return INT_MAX; }
560 static constexpr int lowest() { return 1; }
561 static constexpr int epsilon() { return 1; }
562 static constexpr int round_error() { return 0; }
563 static constexpr int infinity() { return 0; }
564 static constexpr int quiet_NaN() { return 0; }
565 static constexpr int signaling_NaN() { return 0; }
566 static constexpr int denorm_min() { return 0; }
567};
568
569// Overload for the builtin signed char type
570template<> struct numeric_limits<unsigned int>
571{
572 static constexpr bool is_specialized = true;
573 static constexpr bool is_signed = false;
574 static constexpr bool is_integer = true;
575 static constexpr bool is_exact = true;
576 static constexpr bool has_infinity = false;
577 static constexpr bool has_quiet_nan = false;
578 static constexpr bool has_signaling_nan = false;
579 static constexpr bool has_denorm = false;
580 static constexpr bool has_denorm_loss = false;
581 static constexpr bool is_iec559 = false;
582 static constexpr bool is_bounded = true;
583 static constexpr bool is_modulo = true;
584 static constexpr bool tinyness_before = false;
585 static constexpr bool traps = true;
586
587 static constexpr int digits = UINT_RADIX_DIG;
588 static constexpr int digits10 = UINT_DIG;
589 static constexpr int max_digits10 = UINT_DECIMAL_DIG;
590 static constexpr int radix = UINT_RADIX;
591 static constexpr int min_exponent = 0;
592 static constexpr int min_exponent10 = 0;
593 static constexpr int max_exponent = 0;
594 static constexpr int max_exponent10 = 0;
595
596 static constexpr unsigned int min() { return UINT_MIN; }
597 static constexpr unsigned int max() { return UINT_MAX; }
598 static constexpr unsigned int lowest() { return 1; }
599 static constexpr unsigned int epsilon() { return 1; }
600 static constexpr unsigned int round_error() { return 0; }
601 static constexpr unsigned int infinity() { return 0; }
602 static constexpr unsigned int quiet_NaN() { return 0; }
603 static constexpr unsigned int signaling_NaN() { return 0; }
604 static constexpr unsigned int denorm_min() { return 0; }
605};
606
607// Overload for the builtin signed char type
608template<> struct numeric_limits<long int>
609{
610 static constexpr bool is_specialized = true;
611 static constexpr bool is_signed = true;
612 static constexpr bool is_integer = true;
613 static constexpr bool is_exact = true;
614 static constexpr bool has_infinity = false;
615 static constexpr bool has_quiet_nan = false;
616 static constexpr bool has_signaling_nan = false;
617 static constexpr bool has_denorm = false;
618 static constexpr bool has_denorm_loss = false;
619 static constexpr bool is_iec559 = false;
620 static constexpr bool is_bounded = true;
621 static constexpr bool is_modulo = true;
622 static constexpr bool tinyness_before = false;
623 static constexpr bool traps = true;
624
625 static constexpr int digits = LONG_RADIX_DIG;
626 static constexpr int digits10 = LONG_DIG;
627 static constexpr int max_digits10 = LONG_DECIMAL_DIG;
628 static constexpr int radix = LONG_RADIX;
629 static constexpr int min_exponent = 0;
630 static constexpr int min_exponent10 = 0;
631 static constexpr int max_exponent = 0;
632 static constexpr int max_exponent10 = 0;
633
634 static constexpr long int min() { return LONG_MIN; }
635 static constexpr long int max() { return LONG_MAX; }
636 static constexpr long int lowest() { return 1; }
637 static constexpr long int epsilon() { return 1; }
638 static constexpr long int round_error() { return 0; }
639 static constexpr long int infinity() { return 0; }
640 static constexpr long int quiet_NaN() { return 0; }
641 static constexpr long int signaling_NaN() { return 0; }
642 static constexpr long int denorm_min() { return 0; }
643};
644
645// Overload for the builtin signed char type
646template<> struct numeric_limits<unsigned long int>
647{
648 static constexpr bool is_specialized = true;
649 static constexpr bool is_signed = false;
650 static constexpr bool is_integer = true;
651 static constexpr bool is_exact = true;
652 static constexpr bool has_infinity = false;
653 static constexpr bool has_quiet_nan = false;
654 static constexpr bool has_signaling_nan = false;
655 static constexpr bool has_denorm = false;
656 static constexpr bool has_denorm_loss = false;
657 static constexpr bool is_iec559 = false;
658 static constexpr bool is_bounded = true;
659 static constexpr bool is_modulo = true;
660 static constexpr bool tinyness_before = false;
661 static constexpr bool traps = true;
662
663 static constexpr int digits = ULONG_RADIX_DIG;
664 static constexpr int digits10 = ULONG_DIG;
665 static constexpr int max_digits10 = ULONG_DECIMAL_DIG;
666 static constexpr int radix = ULONG_RADIX;
667 static constexpr int min_exponent = 0;
668 static constexpr int min_exponent10 = 0;
669 static constexpr int max_exponent = 0;
670 static constexpr int max_exponent10 = 0;
671
672 static constexpr unsigned long min() { return ULONG_MIN; }
673 static constexpr unsigned long max() { return ULONG_MAX; }
674 static constexpr unsigned long lowest() { return 1; }
675 static constexpr unsigned long epsilon() { return 1; }
676 static constexpr unsigned long round_error() { return 0; }
677 static constexpr unsigned long infinity() { return 0; }
678 static constexpr unsigned long quiet_NaN() { return 0; }
679 static constexpr unsigned long signaling_NaN() { return 0; }
680 static constexpr unsigned long denorm_min() { return 0; }
681};
682
683// Overload for the builtin signed char type
684template<> struct numeric_limits<long long>
685{
686 static constexpr bool is_specialized = true;
687 static constexpr bool is_signed = true;
688 static constexpr bool is_integer = true;
689 static constexpr bool is_exact = true;
690 static constexpr bool has_infinity = false;
691 static constexpr bool has_quiet_nan = false;
692 static constexpr bool has_signaling_nan = false;
693 static constexpr bool has_denorm = false;
694 static constexpr bool has_denorm_loss = false;
695 static constexpr bool is_iec559 = false;
696 static constexpr bool is_bounded = true;
697 static constexpr bool is_modulo = true;
698 static constexpr bool tinyness_before = false;
699 static constexpr bool traps = true;
700
701 static constexpr int digits = LLONG_RADIX_DIG;
702 static constexpr int digits10 = LLONG_DIG;
703 static constexpr int max_digits10 = LLONG_DECIMAL_DIG;
704 static constexpr int radix = LLONG_RADIX;
705 static constexpr int min_exponent = 0;
706 static constexpr int min_exponent10 = 0;
707 static constexpr int max_exponent = 0;
708 static constexpr int max_exponent10 = 0;
709
710 static constexpr long long min() { return LLONG_MIN; }
711 static constexpr long long max() { return LLONG_MAX; }
712 static constexpr long long lowest() { return 1; }
713 static constexpr long long epsilon() { return 1; }
714 static constexpr long long round_error() { return 0; }
715 static constexpr long long infinity() { return 0; }
716 static constexpr long long quiet_NaN() { return 0; }
717 static constexpr long long signaling_NaN() { return 0; }
718 static constexpr long long denorm_min() { return 0; }
719};
720
721// Overload for the builtin signed char type
722template<> struct numeric_limits<unsigned long long>
723{
724 static constexpr bool is_specialized = true;
725 static constexpr bool is_signed = false;
726 static constexpr bool is_integer = true;
727 static constexpr bool is_exact = true;
728 static constexpr bool has_infinity = false;
729 static constexpr bool has_quiet_nan = false;
730 static constexpr bool has_signaling_nan = false;
731 static constexpr bool has_denorm = false;
732 static constexpr bool has_denorm_loss = false;
733 static constexpr bool is_iec559 = false;
734 static constexpr bool is_bounded = true;
735 static constexpr bool is_modulo = true;
736 static constexpr bool tinyness_before = false;
737 static constexpr bool traps = true;
738
739 static constexpr int digits = ULLONG_RADIX_DIG;
740 static constexpr int digits10 = ULLONG_DIG;
741 static constexpr int max_digits10 = ULLONG_DECIMAL_DIG;
742 static constexpr int radix = ULLONG_RADIX;
743 static constexpr int min_exponent = 0;
744 static constexpr int min_exponent10 = 0;
745 static constexpr int max_exponent = 0;
746 static constexpr int max_exponent10 = 0;
747
748 static constexpr unsigned long long min() { return ULLONG_MIN; }
749 static constexpr unsigned long long max() { return ULLONG_MAX; }
750 static constexpr unsigned long long lowest() { return 1; }
751 static constexpr unsigned long long epsilon() { return 1; }
752 static constexpr unsigned long long round_error() { return 0; }
753 static constexpr unsigned long long infinity() { return 0; }
754 static constexpr unsigned long long quiet_NaN() { return 0; }
755 static constexpr unsigned long long signaling_NaN() { return 0; }
756 static constexpr unsigned long long denorm_min() { return 0; }
757};
758
759}
760
761#endif // FENNEC_LANG_LIMITS_H
metaprogramming floating point type info
metaprogramming integer type info
float_round_style
enum for determining rounding styles
Definition limits.h:212
Check if T is of a signed integral.
Definition type_traits.h:989
Helper for getting traits of a numeric type.
Definition limits.h:224
static constexpr bool is_modulo
Check if TypeT can handle modulo arithmetic.
Definition limits.h:236
static constexpr bool is_signed
Check if TypeT is signed.
Definition limits.h:226
static constexpr int max_exponent10
Get the maximum number of decimal digits that represent the exponent of TypeT.
Definition limits.h:247
static constexpr bool has_quiet_nan
Check if TypeT can hold a non-signaling nan.
Definition limits.h:230
static constexpr TypeT quiet_NaN()
Returns a value of TypeT holding a quiet NaN.
Definition limits.h:258
static constexpr bool traps
Check if TypeT can cause operations to trap.
Definition limits.h:238
static constexpr int max_digits10
Get the maximum number of decimal digits TypeT represents.
Definition limits.h:243
static constexpr TypeT epsilon()
Returns the difference between 1.0 and the next representable value.
Definition limits.h:255
static constexpr bool has_infinity
Check if TypeT can hold a value representing infinity.
Definition limits.h:229
static constexpr bool is_bounded
Check if TypeT represents a finite set of values.
Definition limits.h:235
static constexpr int max_exponent
Get the maximum number of radix digits that represent the exponent of TypeT.
Definition limits.h:246
static constexpr bool is_iec559
Check if a TypeT representing a float is IEC 559 or IEEE 754.
Definition limits.h:234
static constexpr int min_exponent10
Get the minimum number of decimal digits that represent the exponent of TypeT.
Definition limits.h:245
static constexpr float_round_style rounding_style
The rounding style of TypeT.
Definition limits.h:249
static constexpr TypeT infinity()
Returns a value of TypeT holding a positive infinity.
Definition limits.h:257
static constexpr bool has_denorm
Check if TypeT denormalizes.
Definition limits.h:232
static constexpr TypeT denorm_min()
Returns a value of TypeT holding the smallest positive subnormal.
Definition limits.h:260
static constexpr bool is_specialized
Check if the template is specialized for TypeT.
Definition limits.h:225
static constexpr TypeT signaling_NaN()
Returns a value of TypeT holding a signaling NaN.
Definition limits.h:259
static constexpr TypeT lowest()
Returns the smallest positive value of TypeT.
Definition limits.h:254
static constexpr TypeT max()
Returns the maximum finite value of TypeT.
Definition limits.h:253
static constexpr bool is_exact
Check if TypeT is exact in its precision.
Definition limits.h:228
static constexpr bool tinyness_before
Check if TypeT checks for tinyness before rounding.
Definition limits.h:237
static constexpr TypeT round_error()
Returns the max rounding error of TypeT.
Definition limits.h:256
static constexpr int digits
Get the number of radix digits TypeT represents.
Definition limits.h:241
static constexpr int digits10
Get the number of decimal digits TypeT represents.
Definition limits.h:242
static constexpr bool has_denorm_loss
Check if TypeT has precision loss when denormalized.
Definition limits.h:233
static constexpr bool is_integer
Check if TypeT is of an integral type.
Definition limits.h:227
static constexpr int radix
Get the base representation of the type.
Definition limits.h:240
static constexpr int min_exponent
Get the minimum number of radix digits that represent the exponent of TypeT.
Definition limits.h:244
static constexpr TypeT min()
Returns the minimum finite value of TypeT.
Definition limits.h:252
static constexpr bool has_signaling_nan
Check if TypeT can hold a signaling nan.
Definition limits.h:231
Type Traits
Types