-
Notifications
You must be signed in to change notification settings - Fork 1.5k
/
Copy pathcmath
1411 lines (1171 loc) · 47.8 KB
/
cmath
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
// cmath standard header
// Copyright (c) Microsoft Corporation.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
#pragma once
#ifndef _CMATH_
#define _CMATH_
#include <yvals.h>
#if _STL_COMPILER_PREPROCESSOR
#include <cstdlib>
#include <xtr1common>
#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
_NODISCARD _Check_return_ inline double pow(_In_ double _Xx, _In_ int _Yx) noexcept /* strengthened */ {
if (_Yx == 2) {
return _Xx * _Xx;
}
return _CSTD pow(_Xx, static_cast<double>(_Yx));
}
_NODISCARD _Check_return_ inline float acos(_In_ float _Xx) noexcept /* strengthened */ {
return _CSTD acosf(_Xx);
}
_NODISCARD _Check_return_ inline float acosh(_In_ float _Xx) noexcept /* strengthened */ {
return _CSTD acoshf(_Xx);
}
_NODISCARD _Check_return_ inline float asin(_In_ float _Xx) noexcept /* strengthened */ {
return _CSTD asinf(_Xx);
}
_NODISCARD _Check_return_ inline float asinh(_In_ float _Xx) noexcept /* strengthened */ {
return _CSTD asinhf(_Xx);
}
_NODISCARD _Check_return_ inline float atan(_In_ float _Xx) noexcept /* strengthened */ {
return _CSTD atanf(_Xx);
}
_NODISCARD _Check_return_ inline float atanh(_In_ float _Xx) noexcept /* strengthened */ {
return _CSTD atanhf(_Xx);
}
_NODISCARD _Check_return_ inline float atan2(_In_ float _Yx, _In_ float _Xx) noexcept /* strengthened */ {
return _CSTD atan2f(_Yx, _Xx);
}
_NODISCARD _Check_return_ inline float cbrt(_In_ float _Xx) noexcept /* strengthened */ {
return _CSTD cbrtf(_Xx);
}
_NODISCARD _Check_return_ inline float ceil(_In_ float _Xx) noexcept /* strengthened */ {
return _CSTD ceilf(_Xx);
}
_NODISCARD _Check_return_ inline float copysign(_In_ float _Number, _In_ float _Sign) noexcept /* strengthened */ {
return _CSTD copysignf(_Number, _Sign);
}
_NODISCARD _Check_return_ inline float cos(_In_ float _Xx) noexcept /* strengthened */ {
return _CSTD cosf(_Xx);
}
_NODISCARD _Check_return_ inline float cosh(_In_ float _Xx) noexcept /* strengthened */ {
return _CSTD coshf(_Xx);
}
_NODISCARD _Check_return_ inline float erf(_In_ float _Xx) noexcept /* strengthened */ {
return _CSTD erff(_Xx);
}
_NODISCARD _Check_return_ inline float erfc(_In_ float _Xx) noexcept /* strengthened */ {
return _CSTD erfcf(_Xx);
}
_NODISCARD _Check_return_ inline float exp(_In_ float _Xx) noexcept /* strengthened */ {
return _CSTD expf(_Xx);
}
_NODISCARD _Check_return_ inline float exp2(_In_ float _Xx) noexcept /* strengthened */ {
return _CSTD exp2f(_Xx);
}
_NODISCARD _Check_return_ inline float expm1(_In_ float _Xx) noexcept /* strengthened */ {
return _CSTD expm1f(_Xx);
}
_NODISCARD _Check_return_ inline float fabs(_In_ float _Xx) noexcept /* strengthened */ {
return _CSTD fabsf(_Xx);
}
_NODISCARD _Check_return_ inline float fdim(_In_ float _Xx, _In_ float _Yx) noexcept /* strengthened */ {
return _CSTD fdimf(_Xx, _Yx);
}
_NODISCARD _Check_return_ inline float floor(_In_ float _Xx) noexcept /* strengthened */ {
return _CSTD floorf(_Xx);
}
_NODISCARD _Check_return_ inline float fma(_In_ float _Xx, _In_ float _Yx, _In_ float _Zx) noexcept /* strengthened */ {
return _CSTD fmaf(_Xx, _Yx, _Zx);
}
_NODISCARD _Check_return_ inline float fmax(_In_ float _Xx, _In_ float _Yx) noexcept /* strengthened */ {
return _CSTD fmaxf(_Xx, _Yx);
}
_NODISCARD _Check_return_ inline float fmin(_In_ float _Xx, _In_ float _Yx) noexcept /* strengthened */ {
return _CSTD fminf(_Xx, _Yx);
}
_NODISCARD _Check_return_ inline float fmod(_In_ float _Xx, _In_ float _Yx) noexcept /* strengthened */ {
return _CSTD fmodf(_Xx, _Yx);
}
inline float frexp(_In_ float _Xx, _Out_ int* _Yx) noexcept /* strengthened */ {
return _CSTD frexpf(_Xx, _Yx);
}
_NODISCARD _Check_return_ inline float hypot(_In_ float _Xx, _In_ float _Yx) noexcept /* strengthened */ {
return _CSTD hypotf(_Xx, _Yx);
}
_NODISCARD _Check_return_ inline int ilogb(_In_ float _Xx) noexcept /* strengthened */ {
return _CSTD ilogbf(_Xx);
}
_NODISCARD _Check_return_ inline float ldexp(_In_ float _Xx, _In_ int _Yx) noexcept /* strengthened */ {
return _CSTD ldexpf(_Xx, _Yx);
}
_NODISCARD _Check_return_ inline float lgamma(_In_ float _Xx) noexcept /* strengthened */ {
return _CSTD lgammaf(_Xx);
}
_NODISCARD _Check_return_ inline long long llrint(_In_ float _Xx) noexcept /* strengthened */ {
return _CSTD llrintf(_Xx);
}
_NODISCARD _Check_return_ inline long long llround(_In_ float _Xx) noexcept /* strengthened */ {
return _CSTD llroundf(_Xx);
}
_NODISCARD _Check_return_ inline float log(_In_ float _Xx) noexcept /* strengthened */ {
return _CSTD logf(_Xx);
}
_NODISCARD _Check_return_ inline float log10(_In_ float _Xx) noexcept /* strengthened */ {
return _CSTD log10f(_Xx);
}
_NODISCARD _Check_return_ inline float log1p(_In_ float _Xx) noexcept /* strengthened */ {
return _CSTD log1pf(_Xx);
}
_NODISCARD _Check_return_ inline float log2(_In_ float _Xx) noexcept /* strengthened */ {
return _CSTD log2f(_Xx);
}
_NODISCARD _Check_return_ inline float logb(_In_ float _Xx) noexcept /* strengthened */ {
return _CSTD logbf(_Xx);
}
_NODISCARD _Check_return_ inline long lrint(_In_ float _Xx) noexcept /* strengthened */ {
return _CSTD lrintf(_Xx);
}
_NODISCARD _Check_return_ inline long lround(_In_ float _Xx) noexcept /* strengthened */ {
return _CSTD lroundf(_Xx);
}
inline float modf(_In_ float _Xx, _Out_ float* _Yx) noexcept /* strengthened */ {
return _CSTD modff(_Xx, _Yx);
}
_NODISCARD _Check_return_ inline float nearbyint(_In_ float _Xx) noexcept /* strengthened */ {
return _CSTD nearbyintf(_Xx);
}
_NODISCARD _Check_return_ inline float nextafter(_In_ float _Xx, _In_ float _Yx) noexcept /* strengthened */ {
return _CSTD nextafterf(_Xx, _Yx);
}
_NODISCARD _Check_return_ inline float nexttoward(_In_ float _Xx, _In_ long double _Yx) noexcept /* strengthened */ {
return _CSTD nexttowardf(_Xx, _Yx);
}
_NODISCARD _Check_return_ inline float pow(_In_ float _Xx, _In_ float _Yx) noexcept /* strengthened */ {
return _CSTD powf(_Xx, _Yx);
}
_NODISCARD _Check_return_ inline float pow(_In_ float _Xx, _In_ int _Yx) noexcept /* strengthened */ {
if (_Yx == 2) {
return _Xx * _Xx;
}
return _CSTD powf(_Xx, static_cast<float>(_Yx));
}
_NODISCARD _Check_return_ inline float remainder(_In_ float _Xx, _In_ float _Yx) noexcept /* strengthened */ {
return _CSTD remainderf(_Xx, _Yx);
}
inline float remquo(_In_ float _Xx, _In_ float _Yx, _Out_ int* _Zx) noexcept /* strengthened */ {
return _CSTD remquof(_Xx, _Yx, _Zx);
}
_NODISCARD _Check_return_ inline float rint(_In_ float _Xx) noexcept /* strengthened */ {
return _CSTD rintf(_Xx);
}
_NODISCARD _Check_return_ inline float round(_In_ float _Xx) noexcept /* strengthened */ {
return _CSTD roundf(_Xx);
}
_NODISCARD _Check_return_ inline float scalbln(_In_ float _Xx, _In_ long _Yx) noexcept /* strengthened */ {
return _CSTD scalblnf(_Xx, _Yx);
}
_NODISCARD _Check_return_ inline float scalbn(_In_ float _Xx, _In_ int _Yx) noexcept /* strengthened */ {
return _CSTD scalbnf(_Xx, _Yx);
}
_NODISCARD _Check_return_ inline float sin(_In_ float _Xx) noexcept /* strengthened */ {
return _CSTD sinf(_Xx);
}
_NODISCARD _Check_return_ inline float sinh(_In_ float _Xx) noexcept /* strengthened */ {
return _CSTD sinhf(_Xx);
}
_NODISCARD _Check_return_ inline float sqrt(_In_ float _Xx) noexcept /* strengthened */ {
return _CSTD sqrtf(_Xx);
}
_NODISCARD _Check_return_ inline float tan(_In_ float _Xx) noexcept /* strengthened */ {
return _CSTD tanf(_Xx);
}
_NODISCARD _Check_return_ inline float tanh(_In_ float _Xx) noexcept /* strengthened */ {
return _CSTD tanhf(_Xx);
}
_NODISCARD _Check_return_ inline float tgamma(_In_ float _Xx) noexcept /* strengthened */ {
return _CSTD tgammaf(_Xx);
}
_NODISCARD _Check_return_ inline float trunc(_In_ float _Xx) noexcept /* strengthened */ {
return _CSTD truncf(_Xx);
}
_NODISCARD _Check_return_ inline long double acos(_In_ long double _Xx) noexcept /* strengthened */ {
return _CSTD acosl(_Xx);
}
_NODISCARD _Check_return_ inline long double acosh(_In_ long double _Xx) noexcept /* strengthened */ {
return _CSTD acoshl(_Xx);
}
_NODISCARD _Check_return_ inline long double asin(_In_ long double _Xx) noexcept /* strengthened */ {
return _CSTD asinl(_Xx);
}
_NODISCARD _Check_return_ inline long double asinh(_In_ long double _Xx) noexcept /* strengthened */ {
return _CSTD asinhl(_Xx);
}
_NODISCARD _Check_return_ inline long double atan(_In_ long double _Xx) noexcept /* strengthened */ {
return _CSTD atanl(_Xx);
}
_NODISCARD _Check_return_ inline long double atanh(_In_ long double _Xx) noexcept /* strengthened */ {
return _CSTD atanhl(_Xx);
}
_NODISCARD _Check_return_ inline long double atan2(
_In_ long double _Yx, _In_ long double _Xx) noexcept /* strengthened */ {
return _CSTD atan2l(_Yx, _Xx);
}
_NODISCARD _Check_return_ inline long double cbrt(_In_ long double _Xx) noexcept /* strengthened */ {
return _CSTD cbrtl(_Xx);
}
_NODISCARD _Check_return_ inline long double ceil(_In_ long double _Xx) noexcept /* strengthened */ {
return _CSTD ceill(_Xx);
}
_NODISCARD _Check_return_ inline long double copysign(
_In_ long double _Number, _In_ long double _Sign) noexcept /* strengthened */ {
return _CSTD copysignl(_Number, _Sign);
}
_NODISCARD _Check_return_ inline long double cos(_In_ long double _Xx) noexcept /* strengthened */ {
return _CSTD cosl(_Xx);
}
_NODISCARD _Check_return_ inline long double cosh(_In_ long double _Xx) noexcept /* strengthened */ {
return _CSTD coshl(_Xx);
}
_NODISCARD _Check_return_ inline long double erf(_In_ long double _Xx) noexcept /* strengthened */ {
return _CSTD erfl(_Xx);
}
_NODISCARD _Check_return_ inline long double erfc(_In_ long double _Xx) noexcept /* strengthened */ {
return _CSTD erfcl(_Xx);
}
_NODISCARD _Check_return_ inline long double exp(_In_ long double _Xx) noexcept /* strengthened */ {
return _CSTD expl(_Xx);
}
_NODISCARD _Check_return_ inline long double exp2(_In_ long double _Xx) noexcept /* strengthened */ {
return _CSTD exp2l(_Xx);
}
_NODISCARD _Check_return_ inline long double expm1(_In_ long double _Xx) noexcept /* strengthened */ {
return _CSTD expm1l(_Xx);
}
_NODISCARD _Check_return_ inline long double fabs(_In_ long double _Xx) noexcept /* strengthened */ {
return _CSTD fabsl(_Xx);
}
_NODISCARD _Check_return_ inline long double fdim(
_In_ long double _Xx, _In_ long double _Yx) noexcept /* strengthened */ {
return _CSTD fdiml(_Xx, _Yx);
}
_NODISCARD _Check_return_ inline long double floor(_In_ long double _Xx) noexcept /* strengthened */ {
return _CSTD floorl(_Xx);
}
_NODISCARD _Check_return_ inline long double fma(
_In_ long double _Xx, _In_ long double _Yx, _In_ long double _Zx) noexcept /* strengthened */ {
return _CSTD fmal(_Xx, _Yx, _Zx);
}
_NODISCARD _Check_return_ inline long double fmax(
_In_ long double _Xx, _In_ long double _Yx) noexcept /* strengthened */ {
return _CSTD fmaxl(_Xx, _Yx);
}
_NODISCARD _Check_return_ inline long double fmin(
_In_ long double _Xx, _In_ long double _Yx) noexcept /* strengthened */ {
return _CSTD fminl(_Xx, _Yx);
}
_NODISCARD _Check_return_ inline long double fmod(
_In_ long double _Xx, _In_ long double _Yx) noexcept /* strengthened */ {
return _CSTD fmodl(_Xx, _Yx);
}
inline long double frexp(_In_ long double _Xx, _Out_ int* _Yx) noexcept /* strengthened */ {
return _CSTD frexpl(_Xx, _Yx);
}
_NODISCARD _Check_return_ inline long double hypot(
_In_ long double _Xx, _In_ long double _Yx) noexcept /* strengthened */ {
return _CSTD hypotl(_Xx, _Yx);
}
_NODISCARD _Check_return_ inline int ilogb(_In_ long double _Xx) noexcept /* strengthened */ {
return _CSTD ilogbl(_Xx);
}
_NODISCARD _Check_return_ inline long double ldexp(_In_ long double _Xx, _In_ int _Yx) noexcept /* strengthened */ {
return _CSTD ldexpl(_Xx, _Yx);
}
_NODISCARD _Check_return_ inline long double lgamma(_In_ long double _Xx) noexcept /* strengthened */ {
return _CSTD lgammal(_Xx);
}
_NODISCARD _Check_return_ inline long long llrint(_In_ long double _Xx) noexcept /* strengthened */ {
return _CSTD llrintl(_Xx);
}
_NODISCARD _Check_return_ inline long long llround(_In_ long double _Xx) noexcept /* strengthened */ {
return _CSTD llroundl(_Xx);
}
_NODISCARD _Check_return_ inline long double log(_In_ long double _Xx) noexcept /* strengthened */ {
return _CSTD logl(_Xx);
}
_NODISCARD _Check_return_ inline long double log10(_In_ long double _Xx) noexcept /* strengthened */ {
return _CSTD log10l(_Xx);
}
_NODISCARD _Check_return_ inline long double log1p(_In_ long double _Xx) noexcept /* strengthened */ {
return _CSTD log1pl(_Xx);
}
_NODISCARD _Check_return_ inline long double log2(_In_ long double _Xx) noexcept /* strengthened */ {
return _CSTD log2l(_Xx);
}
_NODISCARD _Check_return_ inline long double logb(_In_ long double _Xx) noexcept /* strengthened */ {
return _CSTD logbl(_Xx);
}
_NODISCARD _Check_return_ inline long lrint(_In_ long double _Xx) noexcept /* strengthened */ {
return _CSTD lrintl(_Xx);
}
_NODISCARD _Check_return_ inline long lround(_In_ long double _Xx) noexcept /* strengthened */ {
return _CSTD lroundl(_Xx);
}
inline long double modf(_In_ long double _Xx, _Out_ long double* _Yx) noexcept /* strengthened */ {
return _CSTD modfl(_Xx, _Yx);
}
_NODISCARD _Check_return_ inline long double nearbyint(_In_ long double _Xx) noexcept /* strengthened */ {
return _CSTD nearbyintl(_Xx);
}
_NODISCARD _Check_return_ inline long double nextafter(
_In_ long double _Xx, _In_ long double _Yx) noexcept /* strengthened */ {
return _CSTD nextafterl(_Xx, _Yx);
}
_NODISCARD _Check_return_ inline long double nexttoward(
_In_ long double _Xx, _In_ long double _Yx) noexcept /* strengthened */ {
return _CSTD nexttowardl(_Xx, _Yx);
}
_NODISCARD _Check_return_ inline long double pow(
_In_ long double _Xx, _In_ long double _Yx) noexcept /* strengthened */ {
return _CSTD powl(_Xx, _Yx);
}
_NODISCARD _Check_return_ inline long double pow(_In_ long double _Xx, _In_ int _Yx) noexcept /* strengthened */ {
if (_Yx == 2) {
return _Xx * _Xx;
}
return _CSTD powl(_Xx, static_cast<long double>(_Yx));
}
_NODISCARD _Check_return_ inline long double remainder(
_In_ long double _Xx, _In_ long double _Yx) noexcept /* strengthened */ {
return _CSTD remainderl(_Xx, _Yx);
}
inline long double remquo(_In_ long double _Xx, _In_ long double _Yx, _Out_ int* _Zx) noexcept /* strengthened */ {
return _CSTD remquol(_Xx, _Yx, _Zx);
}
_NODISCARD _Check_return_ inline long double rint(_In_ long double _Xx) noexcept /* strengthened */ {
return _CSTD rintl(_Xx);
}
_NODISCARD _Check_return_ inline long double round(_In_ long double _Xx) noexcept /* strengthened */ {
return _CSTD roundl(_Xx);
}
_NODISCARD _Check_return_ inline long double scalbln(_In_ long double _Xx, _In_ long _Yx) noexcept /* strengthened */ {
return _CSTD scalblnl(_Xx, _Yx);
}
_NODISCARD _Check_return_ inline long double scalbn(_In_ long double _Xx, _In_ int _Yx) noexcept /* strengthened */ {
return _CSTD scalbnl(_Xx, _Yx);
}
_NODISCARD _Check_return_ inline long double sin(_In_ long double _Xx) noexcept /* strengthened */ {
return _CSTD sinl(_Xx);
}
_NODISCARD _Check_return_ inline long double sinh(_In_ long double _Xx) noexcept /* strengthened */ {
return _CSTD sinhl(_Xx);
}
_NODISCARD _Check_return_ inline long double sqrt(_In_ long double _Xx) noexcept /* strengthened */ {
return _CSTD sqrtl(_Xx);
}
_NODISCARD _Check_return_ inline long double tan(_In_ long double _Xx) noexcept /* strengthened */ {
return _CSTD tanl(_Xx);
}
_NODISCARD _Check_return_ inline long double tanh(_In_ long double _Xx) noexcept /* strengthened */ {
return _CSTD tanhl(_Xx);
}
_NODISCARD _Check_return_ inline long double tgamma(_In_ long double _Xx) noexcept /* strengthened */ {
return _CSTD tgammal(_Xx);
}
_NODISCARD _Check_return_ inline long double trunc(_In_ long double _Xx) noexcept /* strengthened */ {
return _CSTD truncl(_Xx);
}
_STD_BEGIN
template <class _Ty1, class _Ty2>
using _Common_float_type_t = conditional_t<is_same_v<_Ty1, long double> || is_same_v<_Ty2, long double>, long double,
conditional_t<is_same_v<_Ty1, float> && is_same_v<_Ty2, float>, float,
double>>; // find type for two-argument math function
_STD_END
// FUNCTION TEMPLATE frexp
template <class _Ty, _STD enable_if_t<_STD is_integral_v<_Ty>, int> = 0>
double frexp(_Ty _Value, _Out_ int* const _Exp) noexcept /* strengthened */ {
return _CSTD frexp(static_cast<double>(_Value), _Exp);
}
// FUNCTION TEMPLATE pow
template <class _Ty1, class _Ty2, _STD enable_if_t<_STD is_arithmetic_v<_Ty1> && _STD is_arithmetic_v<_Ty2>, int> = 0>
_NODISCARD _STD _Common_float_type_t<_Ty1, _Ty2> pow(const _Ty1 _Left, const _Ty2 _Right) noexcept /* strengthened */ {
using _Common = _STD _Common_float_type_t<_Ty1, _Ty2>;
return _CSTD pow(static_cast<_Common>(_Left), static_cast<_Common>(_Right));
}
// FUNCTION TEMPLATE fma
#if !_HAS_IF_CONSTEXPR
inline float _Fma(float _Left, float _Middle, float _Right) noexcept {
return _CSTD fmaf(_Left, _Middle, _Right);
}
inline double _Fma(double _Left, double _Middle, double _Right) noexcept {
return _CSTD fma(_Left, _Middle, _Right);
}
inline long double _Fma(long double _Left, long double _Middle, long double _Right) noexcept {
return _CSTD fmal(_Left, _Middle, _Right);
}
#endif // !_HAS_IF_CONSTEXPR
template <class _Ty1, class _Ty2, class _Ty3,
_STD enable_if_t<_STD is_arithmetic_v<_Ty1> && _STD is_arithmetic_v<_Ty2> && _STD is_arithmetic_v<_Ty3>, int> = 0>
_NODISCARD _STD _Common_float_type_t<_Ty1, _STD _Common_float_type_t<_Ty2, _Ty3>> fma(
_Ty1 _Left, _Ty2 _Middle, _Ty3 _Right) noexcept /* strengthened */ {
using _Common = _STD _Common_float_type_t<_Ty1, _STD _Common_float_type_t<_Ty2, _Ty3>>;
#if _HAS_IF_CONSTEXPR
if constexpr (_STD is_same_v<_Common, float>) {
return _CSTD fmaf(static_cast<_Common>(_Left), static_cast<_Common>(_Middle), static_cast<_Common>(_Right));
} else if constexpr (_STD is_same_v<_Common, double>) {
return _CSTD fma(static_cast<_Common>(_Left), static_cast<_Common>(_Middle), static_cast<_Common>(_Right));
} else {
return _CSTD fmal(static_cast<_Common>(_Left), static_cast<_Common>(_Middle), static_cast<_Common>(_Right));
}
#else // ^^^ use "if constexpr" dispatch / use overload resolution vvv
return _Fma(static_cast<_Common>(_Left), static_cast<_Common>(_Middle), static_cast<_Common>(_Right));
#endif // _HAS_IF_CONSTEXPR
}
// FUNCTION TEMPLATE remquo
#if !_HAS_IF_CONSTEXPR
inline float _Remquo(float _Left, float _Right, int* _Pquo) noexcept {
return _CSTD remquof(_Left, _Right, _Pquo);
}
inline double _Remquo(double _Left, double _Right, int* _Pquo) noexcept {
return _CSTD remquo(_Left, _Right, _Pquo);
}
inline long double _Remquo(long double _Left, long double _Right, int* _Pquo) noexcept {
return _CSTD remquol(_Left, _Right, _Pquo);
}
#endif // !_HAS_IF_CONSTEXPR
template <class _Ty1, class _Ty2, _STD enable_if_t<_STD is_arithmetic_v<_Ty1> && _STD is_arithmetic_v<_Ty2>, int> = 0>
_STD _Common_float_type_t<_Ty1, _Ty2> remquo(_Ty1 _Left, _Ty2 _Right, int* _Pquo) noexcept /* strengthened */ {
using _Common = _STD _Common_float_type_t<_Ty1, _Ty2>;
#if _HAS_IF_CONSTEXPR
if constexpr (_STD is_same_v<_Common, float>) {
return _CSTD remquof(static_cast<_Common>(_Left), static_cast<_Common>(_Right), _Pquo);
} else if constexpr (_STD is_same_v<_Common, double>) {
return _CSTD remquo(static_cast<_Common>(_Left), static_cast<_Common>(_Right), _Pquo);
} else {
return _CSTD remquol(static_cast<_Common>(_Left), static_cast<_Common>(_Right), _Pquo);
}
#else // ^^^ use "if constexpr" dispatch / use overload resolution vvv
return _Remquo(static_cast<_Common>(_Left), static_cast<_Common>(_Right), _Pquo);
#endif // _HAS_IF_CONSTEXPR
}
#define _GENERIC_MATH1R(FUN, RET) \
template <class _Ty, _STD enable_if_t<_STD is_integral_v<_Ty>, int> = 0> \
_NODISCARD RET FUN(_Ty _Left) noexcept /* strengthened */ { \
return _CSTD FUN(static_cast<double>(_Left)); \
}
#define _GENERIC_MATH1(FUN) _GENERIC_MATH1R(FUN, double)
#define _GENERIC_MATH1X(FUN, ARG2) \
template <class _Ty, _STD enable_if_t<_STD is_integral_v<_Ty>, int> = 0> \
_NODISCARD double FUN(_Ty _Left, ARG2 _Arg2) noexcept /* strengthened */ { \
return _CSTD FUN(static_cast<double>(_Left), _Arg2); \
}
#define _GENERIC_MATH2(FUN) \
template <class _Ty1, class _Ty2, \
_STD enable_if_t<_STD is_arithmetic_v<_Ty1> && _STD is_arithmetic_v<_Ty2>, int> = 0> \
_NODISCARD _STD _Common_float_type_t<_Ty1, _Ty2> FUN(_Ty1 _Left, _Ty2 _Right) noexcept /* strengthened */ { \
using _Common = _STD _Common_float_type_t<_Ty1, _Ty2>; \
return _CSTD FUN(static_cast<_Common>(_Left), static_cast<_Common>(_Right)); \
}
// The following order matches N4820 26.8.1 [cmath.syn].
_GENERIC_MATH1(acos)
_GENERIC_MATH1(asin)
_GENERIC_MATH1(atan)
_GENERIC_MATH2(atan2)
_GENERIC_MATH1(cos)
_GENERIC_MATH1(sin)
_GENERIC_MATH1(tan)
_GENERIC_MATH1(acosh)
_GENERIC_MATH1(asinh)
_GENERIC_MATH1(atanh)
_GENERIC_MATH1(cosh)
_GENERIC_MATH1(sinh)
_GENERIC_MATH1(tanh)
_GENERIC_MATH1(exp)
_GENERIC_MATH1(exp2)
_GENERIC_MATH1(expm1)
// frexp() is hand-crafted
_GENERIC_MATH1R(ilogb, int)
_GENERIC_MATH1X(ldexp, int)
_GENERIC_MATH1(log)
_GENERIC_MATH1(log10)
_GENERIC_MATH1(log1p)
_GENERIC_MATH1(log2)
_GENERIC_MATH1(logb)
// No modf(), types must match
_GENERIC_MATH1X(scalbn, int)
_GENERIC_MATH1X(scalbln, long)
_GENERIC_MATH1(cbrt)
// abs() has integer overloads
_GENERIC_MATH1(fabs)
_GENERIC_MATH2(hypot)
// 3-arg hypot() is hand-crafted
// pow() is hand-crafted
_GENERIC_MATH1(sqrt)
_GENERIC_MATH1(erf)
_GENERIC_MATH1(erfc)
_GENERIC_MATH1(lgamma)
_GENERIC_MATH1(tgamma)
_GENERIC_MATH1(ceil)
_GENERIC_MATH1(floor)
_GENERIC_MATH1(nearbyint)
_GENERIC_MATH1(rint)
_GENERIC_MATH1R(lrint, long)
_GENERIC_MATH1R(llrint, long long)
_GENERIC_MATH1(round)
_GENERIC_MATH1R(lround, long)
_GENERIC_MATH1R(llround, long long)
_GENERIC_MATH1(trunc)
_GENERIC_MATH2(fmod)
_GENERIC_MATH2(remainder)
// remquo() is hand-crafted
_GENERIC_MATH2(copysign)
// nan(const char*) is exempt
_GENERIC_MATH2(nextafter)
_GENERIC_MATH1X(nexttoward, long double)
_GENERIC_MATH2(fdim)
_GENERIC_MATH2(fmax)
_GENERIC_MATH2(fmin)
// fma() is hand-crafted
// lerp() should be exempt, LWG-3223
// The "classification/comparison functions" (fpclassify(), etc.) are exempt, LWG-1327
// TRANSITION, VSO-945789, Special Math shouldn't be exempt
#undef _GENERIC_MATH1R
#undef _GENERIC_MATH1
#undef _GENERIC_MATH1X
#undef _GENERIC_MATH2
_STD_BEGIN
using _CSTD abs;
using _CSTD acos;
using _CSTD asin;
using _CSTD atan;
using _CSTD atan2;
using _CSTD ceil;
using _CSTD cos;
using _CSTD cosh;
using _CSTD exp;
using _CSTD fabs;
using _CSTD floor;
using _CSTD fmod;
using _CSTD frexp;
using _CSTD ldexp;
using _CSTD log;
using _CSTD log10;
using _CSTD modf;
using _CSTD pow;
using _CSTD sin;
using _CSTD sinh;
using _CSTD sqrt;
using _CSTD tan;
using _CSTD tanh;
using _CSTD acosf;
using _CSTD asinf;
using _CSTD atanf;
using _CSTD atan2f;
using _CSTD ceilf;
using _CSTD cosf;
using _CSTD coshf;
using _CSTD expf;
using _CSTD fabsf;
using _CSTD floorf;
using _CSTD fmodf;
using _CSTD frexpf;
using _CSTD ldexpf;
using _CSTD logf;
using _CSTD log10f;
using _CSTD modff;
using _CSTD powf;
using _CSTD sinf;
using _CSTD sinhf;
using _CSTD sqrtf;
using _CSTD tanf;
using _CSTD tanhf;
using _CSTD acosl;
using _CSTD asinl;
using _CSTD atanl;
using _CSTD atan2l;
using _CSTD ceill;
using _CSTD cosl;
using _CSTD coshl;
using _CSTD expl;
using _CSTD fabsl;
using _CSTD floorl;
using _CSTD fmodl;
using _CSTD frexpl;
using _CSTD ldexpl;
using _CSTD logl;
using _CSTD log10l;
using _CSTD modfl;
using _CSTD powl;
using _CSTD sinl;
using _CSTD sinhl;
using _CSTD sqrtl;
using _CSTD tanl;
using _CSTD tanhl;
using _CSTD float_t;
using _CSTD double_t;
using _CSTD acosh;
using _CSTD asinh;
using _CSTD atanh;
using _CSTD cbrt;
using _CSTD erf;
using _CSTD erfc;
using _CSTD expm1;
using _CSTD exp2;
using _CSTD hypot;
using _CSTD ilogb;
using _CSTD lgamma;
using _CSTD log1p;
using _CSTD log2;
using _CSTD logb;
using _CSTD llrint;
using _CSTD lrint;
using _CSTD nearbyint;
using _CSTD rint;
using _CSTD llround;
using _CSTD lround;
using _CSTD fdim;
using _CSTD fma;
using _CSTD fmax;
using _CSTD fmin;
using _CSTD round;
using _CSTD trunc;
using _CSTD remainder;
using _CSTD remquo;
using _CSTD copysign;
using _CSTD nan;
using _CSTD nextafter;
using _CSTD scalbn;
using _CSTD scalbln;
using _CSTD nexttoward;
using _CSTD tgamma;
using _CSTD acoshf;
using _CSTD asinhf;
using _CSTD atanhf;
using _CSTD cbrtf;
using _CSTD erff;
using _CSTD erfcf;
using _CSTD expm1f;
using _CSTD exp2f;
using _CSTD hypotf;
using _CSTD ilogbf;
using _CSTD lgammaf;
using _CSTD log1pf;
using _CSTD log2f;
using _CSTD logbf;
using _CSTD llrintf;
using _CSTD lrintf;
using _CSTD nearbyintf;
using _CSTD rintf;
using _CSTD llroundf;
using _CSTD lroundf;
using _CSTD fdimf;
using _CSTD fmaf;
using _CSTD fmaxf;
using _CSTD fminf;
using _CSTD roundf;
using _CSTD truncf;
using _CSTD remainderf;
using _CSTD remquof;
using _CSTD copysignf;
using _CSTD nanf;
using _CSTD nextafterf;
using _CSTD scalbnf;
using _CSTD scalblnf;
using _CSTD nexttowardf;
using _CSTD tgammaf;
using _CSTD acoshl;
using _CSTD asinhl;
using _CSTD atanhl;
using _CSTD cbrtl;
using _CSTD erfl;
using _CSTD erfcl;
using _CSTD expm1l;
using _CSTD exp2l;
using _CSTD hypotl;
using _CSTD ilogbl;
using _CSTD lgammal;
using _CSTD log1pl;
using _CSTD log2l;
using _CSTD logbl;
using _CSTD llrintl;
using _CSTD lrintl;
using _CSTD nearbyintl;
using _CSTD rintl;
using _CSTD llroundl;
using _CSTD lroundl;
using _CSTD fdiml;
using _CSTD fmal;
using _CSTD fmaxl;
using _CSTD fminl;
using _CSTD roundl;
using _CSTD truncl;
using _CSTD remainderl;
using _CSTD remquol;
using _CSTD copysignl;
using _CSTD nanl;
using _CSTD nextafterl;
using _CSTD scalbnl;
using _CSTD scalblnl;
using _CSTD nexttowardl;
using _CSTD tgammal;
using _CSTD fpclassify;
using _CSTD signbit;
using _CSTD isfinite;
using _CSTD isinf;
using _CSTD isnan;
using _CSTD isnormal;
using _CSTD isgreater;
using _CSTD isgreaterequal;
using _CSTD isless;
using _CSTD islessequal;
using _CSTD islessgreater;
using _CSTD isunordered;
_STD_END
#if _HAS_CXX17
_EXTERN_C
_CRT_SATELLITE_2 _NODISCARD double __stdcall __std_smf_assoc_laguerre(unsigned int, unsigned int, double) noexcept;
_CRT_SATELLITE_2 _NODISCARD float __stdcall __std_smf_assoc_laguerref(unsigned int, unsigned int, float) noexcept;
_CRT_SATELLITE_2 _NODISCARD double __stdcall __std_smf_assoc_legendre(unsigned int, unsigned int, double) noexcept;
_CRT_SATELLITE_2 _NODISCARD float __stdcall __std_smf_assoc_legendref(unsigned int, unsigned int, float) noexcept;
_CRT_SATELLITE_2 _NODISCARD double __stdcall __std_smf_beta(double, double) noexcept;
_CRT_SATELLITE_2 _NODISCARD float __stdcall __std_smf_betaf(float, float) noexcept;
_CRT_SATELLITE_2 _NODISCARD double __stdcall __std_smf_comp_ellint_1(double) noexcept;
_CRT_SATELLITE_2 _NODISCARD float __stdcall __std_smf_comp_ellint_1f(float) noexcept;
_CRT_SATELLITE_2 _NODISCARD double __stdcall __std_smf_comp_ellint_2(double) noexcept;
_CRT_SATELLITE_2 _NODISCARD float __stdcall __std_smf_comp_ellint_2f(float) noexcept;
_CRT_SATELLITE_2 _NODISCARD double __stdcall __std_smf_comp_ellint_3(double, double) noexcept;
_CRT_SATELLITE_2 _NODISCARD float __stdcall __std_smf_comp_ellint_3f(float, float) noexcept;
_CRT_SATELLITE_2 _NODISCARD double __stdcall __std_smf_cyl_bessel_i(double, double) noexcept;
_CRT_SATELLITE_2 _NODISCARD float __stdcall __std_smf_cyl_bessel_if(float, float) noexcept;
_CRT_SATELLITE_2 _NODISCARD double __stdcall __std_smf_cyl_bessel_j(double, double) noexcept;
_CRT_SATELLITE_2 _NODISCARD float __stdcall __std_smf_cyl_bessel_jf(float, float) noexcept;
_CRT_SATELLITE_2 _NODISCARD double __stdcall __std_smf_cyl_bessel_k(double, double) noexcept;
_CRT_SATELLITE_2 _NODISCARD float __stdcall __std_smf_cyl_bessel_kf(float, float) noexcept;
_CRT_SATELLITE_2 _NODISCARD double __stdcall __std_smf_cyl_neumann(double, double) noexcept;
_CRT_SATELLITE_2 _NODISCARD float __stdcall __std_smf_cyl_neumannf(float, float) noexcept;
_CRT_SATELLITE_2 _NODISCARD double __stdcall __std_smf_ellint_1(double, double) noexcept;
_CRT_SATELLITE_2 _NODISCARD float __stdcall __std_smf_ellint_1f(float, float) noexcept;
_CRT_SATELLITE_2 _NODISCARD double __stdcall __std_smf_ellint_2(double, double) noexcept;
_CRT_SATELLITE_2 _NODISCARD float __stdcall __std_smf_ellint_2f(float, float) noexcept;
_CRT_SATELLITE_2 _NODISCARD double __stdcall __std_smf_ellint_3(double, double, double) noexcept;
_CRT_SATELLITE_2 _NODISCARD float __stdcall __std_smf_ellint_3f(float, float, float) noexcept;
_CRT_SATELLITE_2 _NODISCARD double __stdcall __std_smf_expint(double) noexcept;
_CRT_SATELLITE_2 _NODISCARD float __stdcall __std_smf_expintf(float) noexcept;
_CRT_SATELLITE_2 _NODISCARD double __stdcall __std_smf_hermite(unsigned int, double) noexcept;
_CRT_SATELLITE_2 _NODISCARD float __stdcall __std_smf_hermitef(unsigned int, float) noexcept;
_CRT_SATELLITE_2 _NODISCARD double __stdcall __std_smf_laguerre(unsigned int, double) noexcept;
_CRT_SATELLITE_2 _NODISCARD float __stdcall __std_smf_laguerref(unsigned int, float) noexcept;
_CRT_SATELLITE_2 _NODISCARD double __stdcall __std_smf_legendre(unsigned int, double) noexcept;
_CRT_SATELLITE_2 _NODISCARD float __stdcall __std_smf_legendref(unsigned int, float) noexcept;
_CRT_SATELLITE_2 _NODISCARD double __stdcall __std_smf_riemann_zeta(double) noexcept;
_CRT_SATELLITE_2 _NODISCARD float __stdcall __std_smf_riemann_zetaf(float) noexcept;
_CRT_SATELLITE_2 _NODISCARD double __stdcall __std_smf_sph_bessel(unsigned int, double) noexcept;
_CRT_SATELLITE_2 _NODISCARD float __stdcall __std_smf_sph_besself(unsigned int, float) noexcept;
_CRT_SATELLITE_2 _NODISCARD double __stdcall __std_smf_sph_legendre(unsigned int, unsigned int, double) noexcept;
_CRT_SATELLITE_2 _NODISCARD float __stdcall __std_smf_sph_legendref(unsigned int, unsigned int, float) noexcept;
_CRT_SATELLITE_2 _NODISCARD double __stdcall __std_smf_sph_neumann(unsigned int, double) noexcept;
_CRT_SATELLITE_2 _NODISCARD float __stdcall __std_smf_sph_neumannf(unsigned int, float) noexcept;
_CRT_SATELLITE_2 _NODISCARD double __stdcall __std_smf_hypot3(double, double, double) noexcept;
_CRT_SATELLITE_2 _NODISCARD float __stdcall __std_smf_hypot3f(float, float, float) noexcept;
_END_EXTERN_C
_STD_BEGIN
// FUNCTION assoc_laguerre
_NODISCARD inline double assoc_laguerre(const unsigned int _Degree, const unsigned int _Order, const double _Value) {
return __std_smf_assoc_laguerre(_Degree, _Order, _Value);
}
// FUNCTION assoc_laguerref
_NODISCARD inline float assoc_laguerref(const unsigned int _Degree, const unsigned int _Order, const float _Value) {
return __std_smf_assoc_laguerref(_Degree, _Order, _Value);
}
// FUNCTION assoc_laguerrel
_NODISCARD inline long double assoc_laguerrel(
const unsigned int _Degree, const unsigned int _Order, const long double _Value) {
return __std_smf_assoc_laguerre(_Degree, _Order, static_cast<double>(_Value));
}
// FUNCTION assoc_legendre
_NODISCARD inline double assoc_legendre(const unsigned int _Degree, const unsigned int _Order, const double _Value) {
return __std_smf_assoc_legendre(_Degree, _Order, _Value);
}
// FUNCTION assoc_legendref
_NODISCARD inline float assoc_legendref(const unsigned int _Degree, const unsigned int _Order, const float _Value) {
return __std_smf_assoc_legendref(_Degree, _Order, _Value);
}
// FUNCTION assoc_legendrel
_NODISCARD inline long double assoc_legendrel(
const unsigned int _Degree, const unsigned int _Order, const long double _Value) {
return __std_smf_assoc_legendre(_Degree, _Order, static_cast<double>(_Value));
}
// FUNCTION beta
_NODISCARD inline double beta(const double _Arg1, const double _Arg2) {
return __std_smf_beta(_Arg1, _Arg2);
}
// FUNCTION betaf
_NODISCARD inline float betaf(const float _Arg1, const float _Arg2) {
return __std_smf_betaf(_Arg1, _Arg2);
}
// FUNCTION betal
_NODISCARD inline long double betal(const long double _Arg1, const long double _Arg2) {
return __std_smf_beta(static_cast<double>(_Arg1), static_cast<double>(_Arg2));
}
// FUNCTION comp_ellint_1
_NODISCARD inline double comp_ellint_1(const double _Arg) {
return __std_smf_comp_ellint_1(_Arg);
}
// FUNCTION comp_ellint_1f
_NODISCARD inline float comp_ellint_1f(const float _Arg) {
return __std_smf_comp_ellint_1f(_Arg);
}
// FUNCTION comp_ellint_1l
_NODISCARD inline long double comp_ellint_1l(const long double _Arg) {
return __std_smf_comp_ellint_1(static_cast<double>(_Arg));
}
// FUNCTION comp_ellint_2
_NODISCARD inline double comp_ellint_2(const double _Arg) {
return __std_smf_comp_ellint_2(_Arg);
}
// FUNCTION comp_ellint_2f
_NODISCARD inline float comp_ellint_2f(const float _Arg) {
return __std_smf_comp_ellint_2f(_Arg);
}
// FUNCTION comp_ellint_2l