This repository has been archived by the owner on May 31, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 31
/
Copy pathamp_math.h
4351 lines (4066 loc) · 108 KB
/
amp_math.h
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
/***
* ==++==
*
* Copyright (c) Microsoft Corporation. All rights reserved.
*
* ==--==
* =+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
*
* amp_math.h
*
* C++ AMP Math Library
*
* =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
****/
#pragma once
#include <cmath>
#include <amprt.h>
#define _AMP_MATH_H
extern "C"
{
//=============================================================================
// fast_math intrinsics.
//=============================================================================
float __dp_d3d_absf(float) __GPU_ONLY;
float __dp_d3d_acosf(float) __GPU_ONLY;
float __dp_d3d_asinf(float) __GPU_ONLY;
float __dp_d3d_atanf(float) __GPU_ONLY;
float __dp_d3d_atan2f(float, float) __GPU_ONLY;
float __dp_d3d_ceilf(float) __GPU_ONLY;
float __dp_d3d_cosf(float) __GPU_ONLY;
float __dp_d3d_coshf(float) __GPU_ONLY;
float __dp_d3d_expf(float) __GPU_ONLY;
float __dp_d3d_exp2f(float) __GPU_ONLY;
float __dp_d3d_floorf(float) __GPU_ONLY;
float __dp_d3d_fmodf(float, float) __GPU_ONLY;
float __dp_d3d_fracf(float) __GPU_ONLY;
float __dp_d3d_frexpf(float, _Out_ float *) __GPU_ONLY;
int __dp_d3d_isfinitef(float)__GPU_ONLY;
int __dp_d3d_isinff(float) __GPU_ONLY;
int __dp_d3d_isnanf(float) __GPU_ONLY;
float __dp_d3d_ldexpf(float, float) __GPU_ONLY;
float __dp_d3d_logf(float) __GPU_ONLY;
float __dp_d3d_log10f(float) __GPU_ONLY;
float __dp_d3d_log2f(float) __GPU_ONLY;
float __dp_d3d_maxf(float, float) __GPU_ONLY;
float __dp_d3d_minf(float, float) __GPU_ONLY;
float __dp_d3d_modff(float, _Out_ float *) __GPU_ONLY;
float __dp_d3d_powf(float, float) __GPU_ONLY;
float __dp_d3d_roundf(float) __GPU_ONLY;
float __dp_d3d_rsqrtf(float) __GPU_ONLY;
int __dp_d3d_signf(float) __GPU_ONLY;
float __dp_d3d_sincosf(float, _Out_ float *) __GPU_ONLY;
float __dp_d3d_sinf(float) __GPU_ONLY;
float __dp_d3d_sinhf(float) __GPU_ONLY;
float __dp_d3d_sqrtf(float) __GPU_ONLY;
float __dp_d3d_tanf(float) __GPU_ONLY;
float __dp_d3d_tanhf(float) __GPU_ONLY;
float __dp_d3d_truncf(float) __GPU_ONLY;
//=============================================================================
// Single-precision precise_math intrinsics.
//=============================================================================
float __dp_math_acosf(float) __GPU_ONLY;
float __dp_math_acoshf(float) __GPU_ONLY;
float __dp_math_asinf(float) __GPU_ONLY;
float __dp_math_asinhf(float) __GPU_ONLY;
float __dp_math_atanf(float) __GPU_ONLY;
float __dp_math_atan2f(float, float) __GPU_ONLY;
float __dp_math_atanhf(float) __GPU_ONLY;
float __dp_math_cbrtf(float) __GPU_ONLY;
float __dp_math_ceilf(float) __GPU_ONLY;
float __dp_math_copysignf(float, float) __GPU_ONLY;
float __dp_math_cosf(float) __GPU_ONLY;
float __dp_math_coshf(float) __GPU_ONLY;
float __dp_math_cospif(float) __GPU_ONLY;
float __dp_math_erff(float) __GPU_ONLY;
float __dp_math_erfcf(float) __GPU_ONLY;
float __dp_math_erfinvf(float) __GPU_ONLY;
float __dp_math_erfcinvf(float) __GPU_ONLY;
float __dp_math_expf(float) __GPU_ONLY;
float __dp_math_exp2f(float) __GPU_ONLY;
float __dp_math_exp10f(float) __GPU_ONLY;
float __dp_math_expm1f(float) __GPU_ONLY;
float __dp_math_fabsf(float) __GPU_ONLY;
float __dp_math_fdimf(float, float) __GPU_ONLY;
float __dp_math_floorf(float) __GPU_ONLY;
float __dp_math_fmaf(float, float, float) __GPU_ONLY;
float __dp_math_fmaxf(float, float) __GPU_ONLY;
float __dp_math_fminf(float, float) __GPU_ONLY;
float __dp_math_fmodf(float, float) __GPU_ONLY;
int __dp_math_fpclassifyf(float) __GPU_ONLY;
float __dp_math_frexpf(float, _Out_ int *) __GPU_ONLY;
float __dp_math_hypotf(float, float) __GPU_ONLY;
int __dp_math_ilogbf(float) __GPU_ONLY;
int __dp_math_isfinitef(float) __GPU_ONLY;
int __dp_math_isinff(float) __GPU_ONLY;
int __dp_math_isnanf(float) __GPU_ONLY;
int __dp_math_isnormalf(float) __GPU_ONLY;
float __dp_math_ldexpf(float, int) __GPU_ONLY;
float __dp_math_lgammaf(float, _Out_ int *) __GPU_ONLY;
float __dp_math_logf(float) __GPU_ONLY;
float __dp_math_log10f(float) __GPU_ONLY;
float __dp_math_log2f(float) __GPU_ONLY;
float __dp_math_log1pf(float) __GPU_ONLY;
float __dp_math_logbf(float) __GPU_ONLY;
float __dp_math_modff(float, _Out_ float *) __GPU_ONLY;
float __dp_math_nanf(int) __GPU_ONLY;
float __dp_math_nearbyintf(float) __GPU_ONLY;
float __dp_math_nextafterf(float, float) __GPU_ONLY;
float __dp_math_phif(float) __GPU_ONLY;
float __dp_math_powf(float, float) __GPU_ONLY;
float __dp_math_probitf(float) __GPU_ONLY;
float __dp_math_rcbrtf(float) __GPU_ONLY;
float __dp_math_remainderf(float, float) __GPU_ONLY;
float __dp_math_remquof(float, float, _Out_ int *) __GPU_ONLY;
float __dp_math_roundf(float) __GPU_ONLY;
float __dp_math_rsqrtf(float) __GPU_ONLY;
float __dp_math_scalbf(float, float) __GPU_ONLY;
float __dp_math_scalbnf(float, int) __GPU_ONLY;
int __dp_math_signbitf(float) __GPU_ONLY;
float __dp_math_sinf(float) __GPU_ONLY;
float __dp_math_sincosf(float, _Out_ float *) __GPU_ONLY;
float __dp_math_sinpif(float) __GPU_ONLY;
float __dp_math_sinhf(float) __GPU_ONLY;
float __dp_math_sqrtf(float) __GPU_ONLY;
float __dp_math_tanf(float) __GPU_ONLY;
float __dp_math_tanhf(float) __GPU_ONLY;
float __dp_math_tanpif(float) __GPU_ONLY;
float __dp_math_tgammaf(float) __GPU_ONLY;
float __dp_math_truncf(float) __GPU_ONLY;
//=============================================================================
// Double-precision precise_math intrinsics.
//=============================================================================
double __dp_math_acos(double) __GPU_ONLY;
double __dp_math_acosh(double) __GPU_ONLY;
double __dp_math_asin(double) __GPU_ONLY;
double __dp_math_asinh(double) __GPU_ONLY;
double __dp_math_atan(double) __GPU_ONLY;
double __dp_math_atan2(double, double) __GPU_ONLY;
double __dp_math_atanh(double) __GPU_ONLY;
double __dp_math_cbrt(double) __GPU_ONLY;
double __dp_math_ceil(double) __GPU_ONLY;
double __dp_math_copysign(double, double) __GPU_ONLY;
double __dp_math_cos(double) __GPU_ONLY;
double __dp_math_cosh(double) __GPU_ONLY;
double __dp_math_cospi(double) __GPU_ONLY;
double __dp_math_erf(double) __GPU_ONLY;
double __dp_math_erfc(double) __GPU_ONLY;
double __dp_math_erfinv(double) __GPU_ONLY;
double __dp_math_erfcinv(double) __GPU_ONLY;
double __dp_math_exp(double) __GPU_ONLY;
double __dp_math_exp2(double) __GPU_ONLY;
double __dp_math_exp10(double) __GPU_ONLY;
double __dp_math_expm1(double) __GPU_ONLY;
double __dp_math_fabs(double) __GPU_ONLY;
double __dp_math_fdim(double, double) __GPU_ONLY;
double __dp_math_floor(double) __GPU_ONLY;
double __dp_math_fma(double, double, double) __GPU_ONLY;
double __dp_math_fmax(double, double) __GPU_ONLY;
double __dp_math_fmin(double, double) __GPU_ONLY;
double __dp_math_fmod(double, double) __GPU_ONLY;
int __dp_math_fpclassify(double) __GPU_ONLY;
double __dp_math_frexp(double, _Out_ int *) __GPU_ONLY;
double __dp_math_hypot(double, double) __GPU_ONLY;
int __dp_math_ilogb(double) __GPU_ONLY;
int __dp_math_isfinite(double) __GPU_ONLY;
int __dp_math_isinf(double) __GPU_ONLY;
int __dp_math_isnan(double) __GPU_ONLY;
int __dp_math_isnormal(double) __GPU_ONLY;
double __dp_math_ldexp(double, int) __GPU_ONLY;
double __dp_math_lgamma(double, _Out_ int *) __GPU_ONLY;
double __dp_math_log(double) __GPU_ONLY;
double __dp_math_log10(double) __GPU_ONLY;
double __dp_math_log2(double) __GPU_ONLY;
double __dp_math_log1p(double) __GPU_ONLY;
double __dp_math_logb(double) __GPU_ONLY;
double __dp_math_modf(double, _Out_ double *) __GPU_ONLY;
double __dp_math_nan(int) __GPU_ONLY;
double __dp_math_nearbyint(double) __GPU_ONLY;
double __dp_math_nextafter(double, double) __GPU_ONLY;
double __dp_math_phi(double) __GPU_ONLY;
double __dp_math_pow(double, double) __GPU_ONLY;
double __dp_math_probit(double) __GPU_ONLY;
double __dp_math_rcbrt(double) __GPU_ONLY;
double __dp_math_remainder(double, double) __GPU_ONLY;
double __dp_math_remquo(double, double, _Out_ int *) __GPU_ONLY;
double __dp_math_round(double) __GPU_ONLY;
double __dp_math_rsqrt(double) __GPU_ONLY;
double __dp_math_scalb(double, double) __GPU_ONLY;
double __dp_math_scalbn(double, int) __GPU_ONLY;
int __dp_math_signbit(double) __GPU_ONLY;
double __dp_math_sin(double) __GPU_ONLY;
double __dp_math_sincos(double, _Out_ double *) __GPU_ONLY;
double __dp_math_sinpi(double) __GPU_ONLY;
double __dp_math_sinh(double) __GPU_ONLY;
double __dp_math_sqrt(double) __GPU_ONLY;
double __dp_math_tan(double) __GPU_ONLY;
double __dp_math_tanh(double) __GPU_ONLY;
double __dp_math_tanpi(double) __GPU_ONLY;
double __dp_math_tgamma(double) __GPU_ONLY;
double __dp_math_trunc(double) __GPU_ONLY;
}
namespace Concurrency
{
/// <summary>
/// Functions in the fast_math namespace have lower accuracy, and support
/// only single-precision float.
/// </summary>
namespace fast_math
{
/// <summary>
/// Returns the absolute value of the argument
/// </summary>
/// <param name="_X">
/// Floating-point value
/// </param>
/// <returns>
/// Returns the absolute value of the argument
/// </returns>
inline float fabsf(float _X) __GPU_ONLY
{
return __dp_d3d_absf(_X);
}
/// <summary>
/// Returns the absolute value of the argument
/// </summary>
/// <param name="_X">
/// Floating-point value
/// </param>
/// <returns>
/// Returns the absolute value of the argument
/// </returns>
inline float fabs(float _X) __GPU_ONLY
{
return __dp_d3d_absf(_X);
}
/// <summary>
/// Calculates the arccosine of the argument
/// </summary>
/// <param name="_X">
/// Floating-point value
/// </param>
/// <returns>
/// Returns the arccosine value of the argument
/// </returns>
inline float acosf(float _X) __GPU_ONLY
{
return __dp_d3d_acosf(_X);
}
/// <summary>
/// Calculates the arccosine of the argument
/// </summary>
/// <param name="_X">
/// Floating-point value
/// </param>
/// <returns>
/// Returns the arccosine value of the argument
/// </returns>
inline float acos(float _X) __GPU_ONLY
{
return __dp_d3d_acosf(_X);
}
/// <summary>
/// Calculates the arcsine of the argument
/// </summary>
/// <param name="_X">
/// Floating-point value
/// </param>
/// <returns>
/// Returns the arcsine value of the argument
/// </returns>
inline float asinf(float _X) __GPU_ONLY
{
return __dp_d3d_asinf(_X);
}
/// <summary>
/// Calculates the arcsine of the argument
/// </summary>
/// <param name="_X">
/// Floating-point value
/// </param>
/// <returns>
/// Returns the arcsine value of the argument
/// </returns>
inline float asin(float _X) __GPU_ONLY
{
return __dp_d3d_asinf(_X);
}
/// <summary>
/// Calculates the arctangent of the argument
/// </summary>
/// <param name="_X">
/// Floating-point value
/// </param>
/// <returns>
/// Returns the arctangent value of the argument
/// </returns>
inline float atanf(float _X) __GPU_ONLY
{
return __dp_d3d_atanf(_X);
}
/// <summary>
/// Calculates the arctangent of the argument
/// </summary>
/// <param name="_X">
/// Floating-point value
/// </param>
/// <returns>
/// Returns the arctangent value of the argument
/// </returns>
inline float atan(float _X) __GPU_ONLY
{
return __dp_d3d_atanf(_X);
}
/// <summary>
/// Calculates the arctangent of _Y/_X
/// </summary>
/// <param name="_X">
/// Floating-point value
/// </param>
/// <param name="_Y">
/// Floating-point value
/// </param>
/// <returns>
/// Returns the arctangent value of _Y/_X
/// </returns>
inline float atan2f(float _Y, float _X) __GPU_ONLY
{
return __dp_d3d_atan2f(_Y, _X);
}
/// <summary>
/// Calculates the arctangent of _Y/_X
/// </summary>
/// <param name="_X">
/// Floating-point value
/// </param>
/// <param name="_Y">
/// Floating-point value
/// </param>
/// <returns>
/// Returns the arctangent value of _Y/_X
/// </returns>
inline float atan2(float _Y, float _X) __GPU_ONLY
{
return __dp_d3d_atan2f(_Y, _X);
}
/// <summary>
/// Calculates the ceiling of the argument
/// </summary>
/// <param name="_X">
/// Floating-point value
/// </param>
/// <returns>
/// Returns the ceiling of the argument
/// </returns>
inline float ceilf(float _X) __GPU_ONLY
{
return __dp_d3d_ceilf(_X);
}
/// <summary>
/// Calculates the ceiling of the argument
/// </summary>
/// <param name="_X">
/// Floating-point value
/// </param>
/// <returns>
/// Returns the ceiling of the argument
/// </returns>
inline float ceil(float _X) __GPU_ONLY
{
return __dp_d3d_ceilf(_X);
}
/// <summary>
/// Calculates the cosine of the argument
/// </summary>
/// <param name="_X">
/// Floating-point value
/// </param>
/// <returns>
/// Returns the cosine value of the argument
/// </returns>
inline float cosf(float _X) __GPU_ONLY
{
return __dp_d3d_cosf(_X);
}
/// <summary>
/// Calculates the cosine of the argument
/// </summary>
/// <param name="_X">
/// Floating-point value
/// </param>
/// <returns>
/// Returns the cosine value of the argument
/// </returns>
inline float cos(float _X) __GPU_ONLY
{
return __dp_d3d_cosf(_X);
}
/// <summary>
/// Calculates the hyperbolic cosine value of the argument
/// </summary>
/// <param name="_X">
/// Floating-point value
/// </param>
/// <returns>
/// Returns the hyperbolic cosine value of the argument
/// </returns>
inline float coshf(float _X) __GPU_ONLY
{
return __dp_d3d_coshf(_X);
}
/// <summary>
/// Calculates the hyperbolic cosine value of the argument
/// </summary>
/// <param name="_X">
/// Floating-point value
/// </param>
/// <returns>
/// Returns the hyperbolic cosine value of the argument
/// </returns>
inline float cosh(float _X) __GPU_ONLY
{
return __dp_d3d_coshf(_X);
}
/// <summary>
/// Calculates the base-e exponential of the argument
/// </summary>
/// <param name="_X">
/// Floating-point value
/// </param>
/// <returns>
/// Returns the base-e exponential of the argument
/// </returns>
inline float expf(float _X) __GPU_ONLY
{
return __dp_d3d_expf(_X);
}
/// <summary>
/// Calculates the base-e exponential of the argument
/// </summary>
/// <param name="_X">
/// Floating-point value
/// </param>
/// <returns>
/// Returns the base-e exponential of the argument
/// </returns>
inline float exp(float _X) __GPU_ONLY
{
return __dp_d3d_expf(_X);
}
/// <summary>
/// Calculates the base-2 exponential of the argument
/// </summary>
/// <param name="_X">
/// Floating-point value
/// </param>
/// <returns>
/// Returns the base-2 exponential of the argument
/// </returns>
inline float exp2f(float _X) __GPU_ONLY
{
return __dp_d3d_exp2f(_X);
}
/// <summary>
/// Calculates the base-2 exponential of the argument
/// </summary>
/// <param name="_X">
/// Floating-point value
/// </param>
/// <returns>
/// Returns the base-2 exponential of the argument
/// </returns>
inline float exp2(float _X) __GPU_ONLY
{
return __dp_d3d_exp2f(_X);
}
/// <summary>
/// Calculates the floor of the argument
/// </summary>
/// <param name="_X">
/// Floating-point value
/// </param>
/// <returns>
/// Returns the floor of the argument
/// </returns>
inline float floorf(float _X) __GPU_ONLY
{
return __dp_d3d_floorf(_X);
}
/// <summary>
/// Calculates the floor of the argument
/// </summary>
/// <param name="_X">
/// Floating-point value
/// </param>
/// <returns>
/// Returns the floor of the argument
/// </returns>
inline float floor(float _X) __GPU_ONLY
{
return __dp_d3d_floorf(_X);
}
/// <summary>
/// Determine the maximum numeric value of the arguments
/// </summary>
/// <param name="_X">
/// Floating-point value
/// </param>
/// <param name="_Y">
/// Floating-point value
/// </param>
/// <returns>
/// Return the maximum numeric value of the arguments
/// </returns>
inline float fmaxf(float _X, float _Y) __GPU_ONLY
{
return __dp_d3d_maxf(_X, _Y);
}
/// <summary>
/// Determine the maximum numeric value of the arguments
/// </summary>
/// <param name="_X">
/// Floating-point value
/// </param>
/// <param name="_Y">
/// Floating-point value
/// </param>
/// <returns>
/// Return the maximum numeric value of the arguments
/// </returns>
inline float fmax(float _X, float _Y) __GPU_ONLY
{
return __dp_d3d_maxf(_X, _Y);
}
/// <summary>
/// Determine the minimum numeric value of the arguments
/// </summary>
/// <param name="_X">
/// Floating-point value
/// </param>
/// <param name="_Y">
/// Floating-point value
/// </param>
/// <returns>
/// Return the minimum numeric value of the arguments
/// </returns>
inline float fminf(float _X, float _Y) __GPU_ONLY
{
return __dp_d3d_minf(_X, _Y);
}
/// <summary>
/// Determine the minimum numeric value of the arguments
/// </summary>
/// <param name="_X">
/// Floating-point value
/// </param>
/// <param name="_Y">
/// Floating-point value
/// </param>
/// <returns>
/// Return the minimum numeric value of the arguments
/// </returns>
inline float fmin(float _X, float _Y) __GPU_ONLY
{
return __dp_d3d_minf(_X, _Y);
}
/// <summary>
/// Calculates the floating-point remainder of _X/_Y
/// </summary>
/// <param name="_X">
/// Floating-point value
/// </param>
/// <param name="_Y">
/// Floating-point value
/// </param>
/// <returns>
/// Returns the floating-point remainder of _X/_Y
/// </returns>
inline float fmodf(float _X, float _Y) __GPU_ONLY
{
return __dp_d3d_fmodf(_X, _Y);
}
/// <summary>
/// Calculates the floating-point remainder of _X/_Y
/// </summary>
/// <param name="_X">
/// Floating-point value
/// </param>
/// <param name="_Y">
/// Floating-point value
/// </param>
/// <returns>
/// Returns the floating-point remainder of _X/_Y
/// </returns>
inline float fmod(float _X, float _Y) __GPU_ONLY
{
return __dp_d3d_fmodf(_X, _Y);
}
/// <summary>
/// Gets the mantissa and exponent of _X
/// </summary>
/// <param name="_X">
/// Floating-point value
/// </param>
/// <param name="_Exp">
/// Returns the integer exponent of _X in floating-point value
/// </param>
/// <returns>
/// Returns the mantissa _X
/// </returns>
inline float frexpf(float _X, _Out_ int * _Exp) __GPU_ONLY
{
float _FExp = 0.0f;
float _M = __dp_d3d_frexpf(_X, &_FExp);
*_Exp = static_cast<int>(_FExp);
// Currently, the mantissa returned by d3d's frexp is always positive
// Fetch the sign bit from _X to match cmath frexp
*reinterpret_cast<unsigned int*>(&_M) = *reinterpret_cast<unsigned int*>(&_M) | (*reinterpret_cast<unsigned int*>(&_X) & 0x80000000);
return _M;
}
/// <summary>
/// Gets the mantissa and exponent of _X
/// </summary>
/// <param name="_X">
/// Floating-point value
/// </param>
/// <param name="_Exp">
/// Returns the integer exponent of _X in floating-point value
/// </param>
/// <returns>
/// Returns the mantissa _X
/// </returns>
inline float frexp(float _X, _Out_ int * _Exp) __GPU_ONLY
{
return frexpf(_X, _Exp);
}
/// <summary>
/// Determines whether the argument has a finite value
/// </summary>
/// <param name="_X">
/// Floating-point value
/// </param>
/// <returns>
/// Returns a nonzero value if and only if the argument has a finite value
/// </returns>
inline int isfinite(float _X) __GPU_ONLY
{
return __dp_d3d_isfinitef(_X);
}
/// <summary>
/// Determines whether the argument is an infinity
/// </summary>
/// <param name="_X">
/// Floating-point value
/// </param>
/// <returns>
/// Returns a nonzero value if and only if the argument has an infinite value
/// </returns>
inline int isinf(float _X) __GPU_ONLY
{
return __dp_d3d_isinff(_X);
}
/// <summary>
/// Determines whether the argument is a NaN
/// </summary>
/// <param name="_X">
/// Floating-point value
/// </param>
/// <returns>
/// Returns a nonzero value if and only if the argument has a NaN value
/// </returns>
inline int isnan(float _X) __GPU_ONLY
{
return __dp_d3d_isnanf(_X);
}
/// <summary>
/// Computes a real number from the mantissa and exponent
/// </summary>
/// <param name="_X">
/// Floating-point value, mantissa
/// </param>
/// <param name="_Exp">
/// Integer value, exponent
/// </param>
/// <returns>
/// Returns _X * 2^_Exp
/// </returns>
inline float ldexpf(float _X, int _Exp) __GPU_ONLY
{
float _FExp = static_cast<float>(_Exp);
return __dp_d3d_ldexpf(_X, _FExp);
}
/// <summary>
/// Computes a real number from the mantissa and exponent
/// </summary>
/// <param name="_X">
/// Floating-point value, mantissa
/// </param>
/// <param name="_Exp">
/// Integer value, exponent
/// </param>
/// <returns>
/// Returns _X * 2^_Exp
/// </returns>
inline float ldexp(float _X, int _Exp) __GPU_ONLY
{
return ldexpf(_X, _Exp);
}
/// <summary>
/// Calculates the base-e logarithm of the argument
/// </summary>
/// <param name="_X">
/// Floating-point value
/// </param>
/// <returns>
/// Returns the base-e logarithm of the argument
/// </returns>
inline float logf(float _X) __GPU_ONLY
{
return __dp_d3d_logf(_X);
}
/// <summary>
/// Calculates the base-e logarithm of the argument
/// </summary>
/// <param name="_X">
/// Floating-point value
/// </param>
/// <returns>
/// Returns the base-e logarithm of the argument
/// </returns>
inline float log(float _X) __GPU_ONLY
{
return __dp_d3d_logf(_X);
}
/// <summary>
/// Calculates the base-10 logarithm of the argument
/// </summary>
/// <param name="_X">
/// Floating-point value
/// </param>
/// <returns>
/// Returns the base-10 logarithm of the argument
/// </returns>
inline float log10f(float _X) __GPU_ONLY
{
return __dp_d3d_log10f(_X);
}
/// <summary>
/// Calculates the base-10 logarithm of the argument
/// </summary>
/// <param name="_X">
/// Floating-point value
/// </param>
/// <returns>
/// Returns the base-10 logarithm of the argument
/// </returns>
inline float log10(float _X) __GPU_ONLY
{
return __dp_d3d_log10f(_X);
}
/// <summary>
/// Calculates the base-2 logarithm of the argument
/// </summary>
/// <param name="_X">
/// Floating-point value
/// </param>
/// <returns>
/// Returns the base-2 logarithm of the argument
/// </returns>
inline float log2f(float _X) __GPU_ONLY
{
return __dp_d3d_log2f(_X);
}
/// <summary>
/// Calculates the base-2 logarithm of the argument
/// </summary>
/// <param name="_X">
/// Floating-point value
/// </param>
/// <returns>
/// Returns the base-2 logarithm of the argument
/// </returns>
inline float log2(float _X) __GPU_ONLY
{
return __dp_d3d_log2f(_X);
}
/// <summary>
/// Splits _X into fractional and integer parts.
/// </summary>
/// <param name="_X">
/// Floating-point value
/// </param>
/// <param name="_Ip">
/// Returns the integer portion of _X in floating-point value
/// </param>
/// <returns>
/// Returns the signed fractional portion of _X
/// </returns>
inline float modff(float _X, float * _Ip) __GPU_ONLY
{
return __dp_d3d_modff(_X, _Ip);
}
/// <summary>
/// Splits _X into fractional and integer parts.
/// </summary>
/// <param name="_X">
/// Floating-point value
/// </param>
/// <param name="_Ip">
/// Returns the integer portion of _X in floating-point value
/// </param>
/// <returns>
/// Returns the signed fractional portion of _X
/// </returns>
inline float modf(float _X, float * _Ip) __GPU_ONLY
{
return __dp_d3d_modff(_X, _Ip);
}
/// <summary>
/// Calculates _X raised to the power of _Y
/// </summary>
/// <param name="_X">
/// Floating-point value, base
/// </param>
/// <param name="_Y">
/// Floating-point value, exponent
/// </param>
/// <returns>
/// Returns the value of _X raised to the power of _Y
/// </returns>
inline float powf(float _X, float _Y) __GPU_ONLY
{
return __dp_d3d_powf(_X, _Y);
}
/// <summary>
/// Calculates _X raised to the power of _Y
/// </summary>
/// <param name="_X">
/// Floating-point value, base
/// </param>
/// <param name="_Y">
/// Floating-point value, exponent
/// </param>
/// <returns>
/// Returns the value of _X raised to the power of _Y
/// </returns>
inline float pow(float _X, float _Y) __GPU_ONLY
{
return __dp_d3d_powf(_X, _Y);
}
/// <summary>
/// Rounds _X to the nearest integer
/// </summary>
/// <param name="_X">
/// Floating-point value
/// </param>
/// <returns>
/// Returns the nearest integer of _X
/// </returns>
inline float roundf(float _X) __GPU_ONLY
{
return __dp_d3d_roundf(_X);
}
/// <summary>
/// Rounds _X to the nearest integer
/// </summary>
/// <param name="_X">
/// Floating-point value
/// </param>
/// <returns>
/// Returns the nearest integer of _X
/// </returns>
inline float round(float _X) __GPU_ONLY
{
return __dp_d3d_roundf(_X);
}
/// <summary>
/// Returns the reciprocal of the square root of the argument
/// </summary>
/// <param name="_X">
/// Floating-point value
/// </param>
/// <returns>
/// Returns the reciprocal of the square root of the argument
/// </returns>
inline float rsqrtf(float _X) __GPU_ONLY
{
return __dp_d3d_rsqrtf(_X);
}
/// <summary>
/// Returns the reciprocal of the square root of the argument
/// </summary>
/// <param name="_X">
/// Floating-point value
/// </param>
/// <returns>
/// Returns the reciprocal of the square root of the argument
/// </returns>
inline float rsqrt(float _X) __GPU_ONLY
{
return __dp_d3d_rsqrtf(_X);
}
/// <summary>
/// Returns the sign of the argument
/// </summary>
/// <param name="_X">
/// Floating-point value
/// </param>
/// <returns>
/// Returns the sign of the argument
/// </returns>
inline int signbitf(float _X) __GPU_ONLY
{
return __dp_d3d_signf(_X);
}
/// <summary>
/// Returns the sign of the argument
/// </summary>
/// <param name="_X">
/// Floating-point value
/// </param>
/// <returns>
/// Returns the sign of the argument
/// </returns>
inline int signbit(float _X) __GPU_ONLY
{
return __dp_d3d_signf(_X);
}
/// <summary>
/// Calculates the sine value of the argument
/// </summary>
/// <param name="_X">
/// Floating-point value
/// </param>
/// <returns>
/// Returns the sine value of the argument
/// </returns>
inline float sinf(float _X) __GPU_ONLY
{
return __dp_d3d_sinf(_X);
}