-
Notifications
You must be signed in to change notification settings - Fork 1.5k
/
Copy pathlimits
1285 lines (1047 loc) · 37.1 KB
/
limits
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
// limits standard header (core)
// Copyright (c) Microsoft Corporation.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
#pragma once
#ifndef _LIMITS_
#define _LIMITS_
#include <yvals_core.h>
#if _STL_COMPILER_PREPROCESSOR
#include <cfloat>
#include <climits>
#include <cwchar>
#include <intrin0.h>
#include <isa_availability.h>
#include <xstddef>
// TRANSITION, GH-2129, move down to _Arm64_popcount
#if (defined(_M_ARM64) || defined(_M_ARM64EC)) && !defined(_M_CEE_PURE) && !defined(__CUDACC__) \
&& !defined(__INTEL_COMPILER) && !defined(__clang__) // TRANSITION, LLVM-51488
#define _HAS_NEON_INTRINSICS 1
#else // ^^^ intrinsics available ^^^ / vvv intrinsics unavailable vvv
#define _HAS_NEON_INTRINSICS 0
#endif // ^^^ intrinsics unavailable ^^^
#if _HAS_NEON_INTRINSICS
#include <arm64_neon.h> // TRANSITION, GH-2129
#endif
#pragma pack(push, _CRT_PACKING)
#pragma warning(push, _STL_WARNING_LEVEL)
#pragma warning(disable : _STL_DISABLED_WARNINGS)
_STL_DISABLE_CLANG_WARNINGS
#pragma push_macro("new")
#undef new
_STD_BEGIN
enum float_denorm_style { // constants for different IEEE float denormalization styles
denorm_indeterminate = -1,
denorm_absent = 0,
denorm_present = 1
};
enum float_round_style { // constants for different IEEE rounding styles
round_indeterminate = -1,
round_toward_zero = 0,
round_to_nearest = 1,
round_toward_infinity = 2,
round_toward_neg_infinity = 3
};
struct _Num_base { // base for all types, with common defaults
static constexpr float_denorm_style has_denorm = denorm_absent;
static constexpr bool has_denorm_loss = false;
static constexpr bool has_infinity = false;
static constexpr bool has_quiet_NaN = false;
static constexpr bool has_signaling_NaN = false;
static constexpr bool is_bounded = false;
static constexpr bool is_exact = false;
static constexpr bool is_iec559 = false;
static constexpr bool is_integer = false;
static constexpr bool is_modulo = false;
static constexpr bool is_signed = false;
static constexpr bool is_specialized = false;
static constexpr bool tinyness_before = false;
static constexpr bool traps = false;
static constexpr float_round_style round_style = round_toward_zero;
static constexpr int digits = 0;
static constexpr int digits10 = 0;
static constexpr int max_digits10 = 0;
static constexpr int max_exponent = 0;
static constexpr int max_exponent10 = 0;
static constexpr int min_exponent = 0;
static constexpr int min_exponent10 = 0;
static constexpr int radix = 0;
};
template <class _Ty>
class numeric_limits : public _Num_base { // numeric limits for arbitrary type _Ty (say little or nothing)
public:
_NODISCARD static constexpr _Ty(min)() noexcept {
return _Ty();
}
_NODISCARD static constexpr _Ty(max)() noexcept {
return _Ty();
}
_NODISCARD static constexpr _Ty lowest() noexcept {
return _Ty();
}
_NODISCARD static constexpr _Ty epsilon() noexcept {
return _Ty();
}
_NODISCARD static constexpr _Ty round_error() noexcept {
return _Ty();
}
_NODISCARD static constexpr _Ty denorm_min() noexcept {
return _Ty();
}
_NODISCARD static constexpr _Ty infinity() noexcept {
return _Ty();
}
_NODISCARD static constexpr _Ty quiet_NaN() noexcept {
return _Ty();
}
_NODISCARD static constexpr _Ty signaling_NaN() noexcept {
return _Ty();
}
};
template <class _Ty>
class numeric_limits<const _Ty> : public numeric_limits<_Ty> {}; // numeric limits for const types
template <class _Ty>
class numeric_limits<volatile _Ty> : public numeric_limits<_Ty> {}; // numeric limits for volatile types
template <class _Ty>
class numeric_limits<const volatile _Ty> : public numeric_limits<_Ty> {}; // numeric limits for const volatile types
struct _Num_int_base : _Num_base { // base for integer types
static constexpr bool is_bounded = true;
static constexpr bool is_exact = true;
static constexpr bool is_integer = true;
static constexpr bool is_specialized = true;
static constexpr int radix = 2;
};
struct _Num_float_base : _Num_base { // base for floating-point types
static constexpr float_denorm_style has_denorm = denorm_present;
static constexpr bool has_infinity = true;
static constexpr bool has_quiet_NaN = true;
static constexpr bool has_signaling_NaN = true;
static constexpr bool is_bounded = true;
static constexpr bool is_iec559 = true;
static constexpr bool is_signed = true;
static constexpr bool is_specialized = true;
static constexpr float_round_style round_style = round_to_nearest;
static constexpr int radix = FLT_RADIX;
};
template <>
class numeric_limits<bool> : public _Num_int_base {
public:
_NODISCARD static constexpr bool(min)() noexcept {
return false;
}
_NODISCARD static constexpr bool(max)() noexcept {
return true;
}
_NODISCARD static constexpr bool lowest() noexcept {
return (min) ();
}
_NODISCARD static constexpr bool epsilon() noexcept {
return 0;
}
_NODISCARD static constexpr bool round_error() noexcept {
return 0;
}
_NODISCARD static constexpr bool denorm_min() noexcept {
return 0;
}
_NODISCARD static constexpr bool infinity() noexcept {
return 0;
}
_NODISCARD static constexpr bool quiet_NaN() noexcept {
return 0;
}
_NODISCARD static constexpr bool signaling_NaN() noexcept {
return 0;
}
static constexpr int digits = 1;
};
template <>
class numeric_limits<char> : public _Num_int_base {
public:
_NODISCARD static constexpr char(min)() noexcept {
return CHAR_MIN;
}
_NODISCARD static constexpr char(max)() noexcept {
return CHAR_MAX;
}
_NODISCARD static constexpr char lowest() noexcept {
return (min) ();
}
_NODISCARD static constexpr char epsilon() noexcept {
return 0;
}
_NODISCARD static constexpr char round_error() noexcept {
return 0;
}
_NODISCARD static constexpr char denorm_min() noexcept {
return 0;
}
_NODISCARD static constexpr char infinity() noexcept {
return 0;
}
_NODISCARD static constexpr char quiet_NaN() noexcept {
return 0;
}
_NODISCARD static constexpr char signaling_NaN() noexcept {
return 0;
}
static constexpr bool is_signed = CHAR_MIN != 0;
static constexpr bool is_modulo = CHAR_MIN == 0;
static constexpr int digits = 8 - (CHAR_MIN != 0);
static constexpr int digits10 = 2;
};
template <>
class numeric_limits<signed char> : public _Num_int_base {
public:
_NODISCARD static constexpr signed char(min)() noexcept {
return SCHAR_MIN;
}
_NODISCARD static constexpr signed char(max)() noexcept {
return SCHAR_MAX;
}
_NODISCARD static constexpr signed char lowest() noexcept {
return (min) ();
}
_NODISCARD static constexpr signed char epsilon() noexcept {
return 0;
}
_NODISCARD static constexpr signed char round_error() noexcept {
return 0;
}
_NODISCARD static constexpr signed char denorm_min() noexcept {
return 0;
}
_NODISCARD static constexpr signed char infinity() noexcept {
return 0;
}
_NODISCARD static constexpr signed char quiet_NaN() noexcept {
return 0;
}
_NODISCARD static constexpr signed char signaling_NaN() noexcept {
return 0;
}
static constexpr bool is_signed = true;
static constexpr int digits = 7;
static constexpr int digits10 = 2;
};
template <>
class numeric_limits<unsigned char> : public _Num_int_base {
public:
_NODISCARD static constexpr unsigned char(min)() noexcept {
return 0;
}
_NODISCARD static constexpr unsigned char(max)() noexcept {
return UCHAR_MAX;
}
_NODISCARD static constexpr unsigned char lowest() noexcept {
return (min) ();
}
_NODISCARD static constexpr unsigned char epsilon() noexcept {
return 0;
}
_NODISCARD static constexpr unsigned char round_error() noexcept {
return 0;
}
_NODISCARD static constexpr unsigned char denorm_min() noexcept {
return 0;
}
_NODISCARD static constexpr unsigned char infinity() noexcept {
return 0;
}
_NODISCARD static constexpr unsigned char quiet_NaN() noexcept {
return 0;
}
_NODISCARD static constexpr unsigned char signaling_NaN() noexcept {
return 0;
}
static constexpr bool is_modulo = true;
static constexpr int digits = 8;
static constexpr int digits10 = 2;
};
#ifdef __cpp_char8_t
template <>
class numeric_limits<char8_t> : public _Num_int_base {
public:
_NODISCARD static constexpr char8_t(min)() noexcept {
return 0;
}
_NODISCARD static constexpr char8_t(max)() noexcept {
return UCHAR_MAX;
}
_NODISCARD static constexpr char8_t lowest() noexcept {
return 0;
}
_NODISCARD static constexpr char8_t epsilon() noexcept {
return 0;
}
_NODISCARD static constexpr char8_t round_error() noexcept {
return 0;
}
_NODISCARD static constexpr char8_t denorm_min() noexcept {
return 0;
}
_NODISCARD static constexpr char8_t infinity() noexcept {
return 0;
}
_NODISCARD static constexpr char8_t quiet_NaN() noexcept {
return 0;
}
_NODISCARD static constexpr char8_t signaling_NaN() noexcept {
return 0;
}
static constexpr bool is_modulo = true;
static constexpr int digits = 8;
static constexpr int digits10 = 2;
};
#endif // __cpp_char8_t
template <>
class numeric_limits<char16_t> : public _Num_int_base {
public:
_NODISCARD static constexpr char16_t(min)() noexcept {
return 0;
}
_NODISCARD static constexpr char16_t(max)() noexcept {
return USHRT_MAX;
}
_NODISCARD static constexpr char16_t lowest() noexcept {
return (min) ();
}
_NODISCARD static constexpr char16_t epsilon() noexcept {
return 0;
}
_NODISCARD static constexpr char16_t round_error() noexcept {
return 0;
}
_NODISCARD static constexpr char16_t denorm_min() noexcept {
return 0;
}
_NODISCARD static constexpr char16_t infinity() noexcept {
return 0;
}
_NODISCARD static constexpr char16_t quiet_NaN() noexcept {
return 0;
}
_NODISCARD static constexpr char16_t signaling_NaN() noexcept {
return 0;
}
static constexpr bool is_modulo = true;
static constexpr int digits = 16;
static constexpr int digits10 = 4;
};
template <>
class numeric_limits<char32_t> : public _Num_int_base {
public:
_NODISCARD static constexpr char32_t(min)() noexcept {
return 0;
}
_NODISCARD static constexpr char32_t(max)() noexcept {
return UINT_MAX;
}
_NODISCARD static constexpr char32_t lowest() noexcept {
return (min) ();
}
_NODISCARD static constexpr char32_t epsilon() noexcept {
return 0;
}
_NODISCARD static constexpr char32_t round_error() noexcept {
return 0;
}
_NODISCARD static constexpr char32_t denorm_min() noexcept {
return 0;
}
_NODISCARD static constexpr char32_t infinity() noexcept {
return 0;
}
_NODISCARD static constexpr char32_t quiet_NaN() noexcept {
return 0;
}
_NODISCARD static constexpr char32_t signaling_NaN() noexcept {
return 0;
}
static constexpr bool is_modulo = true;
static constexpr int digits = 32;
static constexpr int digits10 = 9;
};
template <>
class numeric_limits<wchar_t> : public _Num_int_base {
public:
_NODISCARD static constexpr wchar_t(min)() noexcept {
return WCHAR_MIN;
}
_NODISCARD static constexpr wchar_t(max)() noexcept {
return WCHAR_MAX;
}
_NODISCARD static constexpr wchar_t lowest() noexcept {
return (min) ();
}
_NODISCARD static constexpr wchar_t epsilon() noexcept {
return 0;
}
_NODISCARD static constexpr wchar_t round_error() noexcept {
return 0;
}
_NODISCARD static constexpr wchar_t denorm_min() noexcept {
return 0;
}
_NODISCARD static constexpr wchar_t infinity() noexcept {
return 0;
}
_NODISCARD static constexpr wchar_t quiet_NaN() noexcept {
return 0;
}
_NODISCARD static constexpr wchar_t signaling_NaN() noexcept {
return 0;
}
static constexpr bool is_modulo = true;
static constexpr int digits = 16;
static constexpr int digits10 = 4;
};
template <>
class numeric_limits<short> : public _Num_int_base {
public:
_NODISCARD static constexpr short(min)() noexcept {
return SHRT_MIN;
}
_NODISCARD static constexpr short(max)() noexcept {
return SHRT_MAX;
}
_NODISCARD static constexpr short lowest() noexcept {
return (min) ();
}
_NODISCARD static constexpr short epsilon() noexcept {
return 0;
}
_NODISCARD static constexpr short round_error() noexcept {
return 0;
}
_NODISCARD static constexpr short denorm_min() noexcept {
return 0;
}
_NODISCARD static constexpr short infinity() noexcept {
return 0;
}
_NODISCARD static constexpr short quiet_NaN() noexcept {
return 0;
}
_NODISCARD static constexpr short signaling_NaN() noexcept {
return 0;
}
static constexpr bool is_signed = true;
static constexpr int digits = 15;
static constexpr int digits10 = 4;
};
template <>
class numeric_limits<int> : public _Num_int_base {
public:
_NODISCARD static constexpr int(min)() noexcept {
return INT_MIN;
}
_NODISCARD static constexpr int(max)() noexcept {
return INT_MAX;
}
_NODISCARD static constexpr int lowest() noexcept {
return (min) ();
}
_NODISCARD static constexpr int epsilon() noexcept {
return 0;
}
_NODISCARD static constexpr int round_error() noexcept {
return 0;
}
_NODISCARD static constexpr int denorm_min() noexcept {
return 0;
}
_NODISCARD static constexpr int infinity() noexcept {
return 0;
}
_NODISCARD static constexpr int quiet_NaN() noexcept {
return 0;
}
_NODISCARD static constexpr int signaling_NaN() noexcept {
return 0;
}
static constexpr bool is_signed = true;
static constexpr int digits = 31;
static constexpr int digits10 = 9;
};
template <>
class numeric_limits<long> : public _Num_int_base {
public:
_NODISCARD static constexpr long(min)() noexcept {
return LONG_MIN;
}
_NODISCARD static constexpr long(max)() noexcept {
return LONG_MAX;
}
_NODISCARD static constexpr long lowest() noexcept {
return (min) ();
}
_NODISCARD static constexpr long epsilon() noexcept {
return 0;
}
_NODISCARD static constexpr long round_error() noexcept {
return 0;
}
_NODISCARD static constexpr long denorm_min() noexcept {
return 0;
}
_NODISCARD static constexpr long infinity() noexcept {
return 0;
}
_NODISCARD static constexpr long quiet_NaN() noexcept {
return 0;
}
_NODISCARD static constexpr long signaling_NaN() noexcept {
return 0;
}
static_assert(sizeof(int) == sizeof(long), "LLP64 assumption");
static constexpr bool is_signed = true;
static constexpr int digits = 31;
static constexpr int digits10 = 9;
};
template <>
class numeric_limits<long long> : public _Num_int_base {
public:
_NODISCARD static constexpr long long(min)() noexcept {
return LLONG_MIN;
}
_NODISCARD static constexpr long long(max)() noexcept {
return LLONG_MAX;
}
_NODISCARD static constexpr long long lowest() noexcept {
return (min) ();
}
_NODISCARD static constexpr long long epsilon() noexcept {
return 0;
}
_NODISCARD static constexpr long long round_error() noexcept {
return 0;
}
_NODISCARD static constexpr long long denorm_min() noexcept {
return 0;
}
_NODISCARD static constexpr long long infinity() noexcept {
return 0;
}
_NODISCARD static constexpr long long quiet_NaN() noexcept {
return 0;
}
_NODISCARD static constexpr long long signaling_NaN() noexcept {
return 0;
}
static constexpr bool is_signed = true;
static constexpr int digits = 63;
static constexpr int digits10 = 18;
};
#ifdef _NATIVE_WCHAR_T_DEFINED
template <>
class numeric_limits<unsigned short> : public _Num_int_base {
public:
_NODISCARD static constexpr unsigned short(min)() noexcept {
return 0;
}
_NODISCARD static constexpr unsigned short(max)() noexcept {
return USHRT_MAX;
}
_NODISCARD static constexpr unsigned short lowest() noexcept {
return (min) ();
}
_NODISCARD static constexpr unsigned short epsilon() noexcept {
return 0;
}
_NODISCARD static constexpr unsigned short round_error() noexcept {
return 0;
}
_NODISCARD static constexpr unsigned short denorm_min() noexcept {
return 0;
}
_NODISCARD static constexpr unsigned short infinity() noexcept {
return 0;
}
_NODISCARD static constexpr unsigned short quiet_NaN() noexcept {
return 0;
}
_NODISCARD static constexpr unsigned short signaling_NaN() noexcept {
return 0;
}
static constexpr bool is_modulo = true;
static constexpr int digits = 16;
static constexpr int digits10 = 4;
};
#endif // _NATIVE_WCHAR_T_DEFINED
template <>
class numeric_limits<unsigned int> : public _Num_int_base {
public:
_NODISCARD static constexpr unsigned int(min)() noexcept {
return 0;
}
_NODISCARD static constexpr unsigned int(max)() noexcept {
return UINT_MAX;
}
_NODISCARD static constexpr unsigned int lowest() noexcept {
return (min) ();
}
_NODISCARD static constexpr unsigned int epsilon() noexcept {
return 0;
}
_NODISCARD static constexpr unsigned int round_error() noexcept {
return 0;
}
_NODISCARD static constexpr unsigned int denorm_min() noexcept {
return 0;
}
_NODISCARD static constexpr unsigned int infinity() noexcept {
return 0;
}
_NODISCARD static constexpr unsigned int quiet_NaN() noexcept {
return 0;
}
_NODISCARD static constexpr unsigned int signaling_NaN() noexcept {
return 0;
}
static constexpr bool is_modulo = true;
static constexpr int digits = 32;
static constexpr int digits10 = 9;
};
template <>
class numeric_limits<unsigned long> : public _Num_int_base {
public:
_NODISCARD static constexpr unsigned long(min)() noexcept {
return 0;
}
_NODISCARD static constexpr unsigned long(max)() noexcept {
return ULONG_MAX;
}
_NODISCARD static constexpr unsigned long lowest() noexcept {
return (min) ();
}
_NODISCARD static constexpr unsigned long epsilon() noexcept {
return 0;
}
_NODISCARD static constexpr unsigned long round_error() noexcept {
return 0;
}
_NODISCARD static constexpr unsigned long denorm_min() noexcept {
return 0;
}
_NODISCARD static constexpr unsigned long infinity() noexcept {
return 0;
}
_NODISCARD static constexpr unsigned long quiet_NaN() noexcept {
return 0;
}
_NODISCARD static constexpr unsigned long signaling_NaN() noexcept {
return 0;
}
static_assert(sizeof(unsigned int) == sizeof(unsigned long), "LLP64 assumption");
static constexpr bool is_modulo = true;
static constexpr int digits = 32;
static constexpr int digits10 = 9;
};
template <>
class numeric_limits<unsigned long long> : public _Num_int_base {
public:
_NODISCARD static constexpr unsigned long long(min)() noexcept {
return 0;
}
_NODISCARD static constexpr unsigned long long(max)() noexcept {
return ULLONG_MAX;
}
_NODISCARD static constexpr unsigned long long lowest() noexcept {
return (min) ();
}
_NODISCARD static constexpr unsigned long long epsilon() noexcept {
return 0;
}
_NODISCARD static constexpr unsigned long long round_error() noexcept {
return 0;
}
_NODISCARD static constexpr unsigned long long denorm_min() noexcept {
return 0;
}
_NODISCARD static constexpr unsigned long long infinity() noexcept {
return 0;
}
_NODISCARD static constexpr unsigned long long quiet_NaN() noexcept {
return 0;
}
_NODISCARD static constexpr unsigned long long signaling_NaN() noexcept {
return 0;
}
static constexpr bool is_modulo = true;
static constexpr int digits = 64;
static constexpr int digits10 = 19;
};
template <>
class numeric_limits<float> : public _Num_float_base {
public:
_NODISCARD static constexpr float(min)() noexcept {
return FLT_MIN;
}
_NODISCARD static constexpr float(max)() noexcept {
return FLT_MAX;
}
_NODISCARD static constexpr float lowest() noexcept {
return -(max) ();
}
_NODISCARD static constexpr float epsilon() noexcept {
return FLT_EPSILON;
}
_NODISCARD static constexpr float round_error() noexcept {
return 0.5F;
}
_NODISCARD static constexpr float denorm_min() noexcept {
return FLT_TRUE_MIN;
}
_NODISCARD static constexpr float infinity() noexcept {
return __builtin_huge_valf();
}
_NODISCARD static constexpr float quiet_NaN() noexcept {
return __builtin_nanf("0");
}
_NODISCARD static constexpr float signaling_NaN() noexcept {
return __builtin_nansf("1");
}
static constexpr int digits = FLT_MANT_DIG;
static constexpr int digits10 = FLT_DIG;
static constexpr int max_digits10 = 9;
static constexpr int max_exponent = FLT_MAX_EXP;
static constexpr int max_exponent10 = FLT_MAX_10_EXP;
static constexpr int min_exponent = FLT_MIN_EXP;
static constexpr int min_exponent10 = FLT_MIN_10_EXP;
};
template <>
class numeric_limits<double> : public _Num_float_base {
public:
_NODISCARD static constexpr double(min)() noexcept {
return DBL_MIN;
}
_NODISCARD static constexpr double(max)() noexcept {
return DBL_MAX;
}
_NODISCARD static constexpr double lowest() noexcept {
return -(max) ();
}
_NODISCARD static constexpr double epsilon() noexcept {
return DBL_EPSILON;
}
_NODISCARD static constexpr double round_error() noexcept {
return 0.5;
}
_NODISCARD static constexpr double denorm_min() noexcept {
return DBL_TRUE_MIN;
}
_NODISCARD static constexpr double infinity() noexcept {
return __builtin_huge_val();
}
_NODISCARD static constexpr double quiet_NaN() noexcept {
return __builtin_nan("0");
}
_NODISCARD static constexpr double signaling_NaN() noexcept {
return __builtin_nans("1");
}
static constexpr int digits = DBL_MANT_DIG;
static constexpr int digits10 = DBL_DIG;
static constexpr int max_digits10 = 17;
static constexpr int max_exponent = DBL_MAX_EXP;
static constexpr int max_exponent10 = DBL_MAX_10_EXP;
static constexpr int min_exponent = DBL_MIN_EXP;
static constexpr int min_exponent10 = DBL_MIN_10_EXP;
};
template <>
class numeric_limits<long double> : public _Num_float_base {
public:
_NODISCARD static constexpr long double(min)() noexcept {
return LDBL_MIN;
}
_NODISCARD static constexpr long double(max)() noexcept {
return LDBL_MAX;
}
_NODISCARD static constexpr long double lowest() noexcept {
return -(max) ();
}
_NODISCARD static constexpr long double epsilon() noexcept {
return LDBL_EPSILON;
}
_NODISCARD static constexpr long double round_error() noexcept {
return 0.5L;
}
_NODISCARD static constexpr long double denorm_min() noexcept {
return LDBL_TRUE_MIN;
}
_NODISCARD static constexpr long double infinity() noexcept {
return __builtin_huge_val();
}
_NODISCARD static constexpr long double quiet_NaN() noexcept {
return __builtin_nan("0");
}
_NODISCARD static constexpr long double signaling_NaN() noexcept {
return __builtin_nans("1");
}
static constexpr int digits = LDBL_MANT_DIG;
static constexpr int digits10 = LDBL_DIG;
static constexpr int max_digits10 = 2 + LDBL_MANT_DIG * 301L / 1000;
static constexpr int max_exponent = LDBL_MAX_EXP;
static constexpr int max_exponent10 = LDBL_MAX_10_EXP;
static constexpr int min_exponent = LDBL_MIN_EXP;
static constexpr int min_exponent10 = LDBL_MIN_10_EXP;
};