-
Notifications
You must be signed in to change notification settings - Fork 6
/
simde-math.h
2065 lines (1854 loc) · 61.7 KB
/
simde-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
/* SPDX-License-Identifier: MIT
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
* files (the "Software"), to deal in the Software without
* restriction, including without limitation the rights to use, copy,
* modify, merge, publish, distribute, sublicense, and/or sell copies
* of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*
* Copyright:
* 2017-2020 Evan Nemerson <[email protected]>
* 2023 Yi-Yen Chung <[email protected]> (Copyright owned by Andes Technology)
*/
/* Attempt to find math functions. Functions may be in <cmath>,
* <math.h>, compiler built-ins/intrinsics, or platform/architecture
* specific headers. In some cases, especially those not built in to
* libm, we may need to define our own implementations. */
#if !defined(SIMDE_MATH_H)
#define SIMDE_MATH_H 1
#include "hedley.h"
#include "simde-features.h"
#include <stdint.h>
#if defined(SIMDE_ARM_NEON_A64V8_NATIVE)
#include <arm_neon.h>
#endif
HEDLEY_DIAGNOSTIC_PUSH
SIMDE_DISABLE_UNWANTED_DIAGNOSTICS
/* SLEEF support
* https://sleef.org/
*
* If you include <sleef.h> prior to including SIMDe, SIMDe will use
* SLEEF. You can also define SIMDE_MATH_SLEEF_ENABLE prior to
* including SIMDe to force the issue.
*
* Note that SLEEF does requires linking to libsleef.
*
* By default, SIMDe will use the 1 ULP functions, but if you use
* SIMDE_ACCURACY_PREFERENCE of 0 we will use up to 4 ULP. This is
* only the case for the simde_math_* functions; for code in other
* SIMDe headers which calls SLEEF directly we may use functions with
* greater error if the API we're implementing is less precise (for
* example, SVML guarantees 4 ULP, so we will generally use the 3.5
* ULP functions from SLEEF). */
#if !defined(SIMDE_MATH_SLEEF_DISABLE)
#if defined(__SLEEF_H__)
#define SIMDE_MATH_SLEEF_ENABLE
#endif
#endif
#if defined(SIMDE_MATH_SLEEF_ENABLE) && !defined(__SLEEF_H__)
HEDLEY_DIAGNOSTIC_PUSH
SIMDE_DIAGNOSTIC_DISABLE_IGNORED_QUALIFIERS_
#include <sleef.h>
HEDLEY_DIAGNOSTIC_POP
#endif
#if defined(SIMDE_MATH_SLEEF_ENABLE) && defined(__SLEEF_H__)
#if defined(SLEEF_VERSION_MAJOR)
#define SIMDE_MATH_SLEEF_VERSION_CHECK(major, minor, patch) (HEDLEY_VERSION_ENCODE(SLEEF_VERSION_MAJOR, SLEEF_VERSION_MINOR, SLEEF_VERSION_PATCHLEVEL) >= HEDLEY_VERSION_ENCODE(major, minor, patch))
#else
#define SIMDE_MATH_SLEEF_VERSION_CHECK(major, minor, patch) (HEDLEY_VERSION_ENCODE(3,0,0) >= HEDLEY_VERSION_ENCODE(major, minor, patch))
#endif
#else
#define SIMDE_MATH_SLEEF_VERSION_CHECK(major, minor, patch) (0)
#endif
#if defined(__has_builtin)
#define SIMDE_MATH_BUILTIN_LIBM(func) __has_builtin(__builtin_##func)
#elif \
HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \
HEDLEY_ARM_VERSION_CHECK(4,1,0) || \
HEDLEY_GCC_VERSION_CHECK(4,4,0)
#define SIMDE_MATH_BUILTIN_LIBM(func) (1)
#else
#define SIMDE_MATH_BUILTIN_LIBM(func) (0)
#endif
#if defined(HUGE_VAL)
/* Looks like <math.h> or <cmath> has already been included. */
/* The math.h from libc++ (yes, the C header from the C++ standard
* library) will define an isnan function, but not an isnan macro
* like the C standard requires. So we detect the header guards
* macro libc++ uses. */
#if defined(isnan) || (defined(_LIBCPP_MATH_H) && !defined(_LIBCPP_CMATH))
#define SIMDE_MATH_HAVE_MATH_H
#elif defined(__cplusplus)
#define SIMDE_MATH_HAVE_CMATH
#endif
#elif defined(__has_include)
#if defined(__cplusplus) && (__cplusplus >= 201103L) && __has_include(<cmath>)
#define SIMDE_MATH_HAVE_CMATH
#include <cmath>
#elif __has_include(<math.h>)
#define SIMDE_MATH_HAVE_MATH_H
#include <math.h>
#elif !defined(SIMDE_MATH_NO_LIBM)
#define SIMDE_MATH_NO_LIBM
#endif
#elif !defined(SIMDE_MATH_NO_LIBM)
#if defined(__cplusplus) && (__cplusplus >= 201103L)
#define SIMDE_MATH_HAVE_CMATH
HEDLEY_DIAGNOSTIC_PUSH
#if defined(HEDLEY_MSVC_VERSION)
/* VS 14 emits this diagnostic about noexcept being used on a
* <cmath> function, which we can't do anything about. */
#pragma warning(disable:4996)
#endif
#include <cmath>
HEDLEY_DIAGNOSTIC_POP
#else
#define SIMDE_MATH_HAVE_MATH_H
#include <math.h>
#endif
#endif
#if !defined(SIMDE_MATH_INFINITY)
#if \
HEDLEY_HAS_BUILTIN(__builtin_inf) || \
HEDLEY_GCC_VERSION_CHECK(3,3,0) || \
HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \
HEDLEY_ARM_VERSION_CHECK(4,1,0) || \
HEDLEY_CRAY_VERSION_CHECK(8,1,0)
#define SIMDE_MATH_INFINITY (__builtin_inf())
#elif defined(INFINITY)
#define SIMDE_MATH_INFINITY INFINITY
#endif
#endif
#if !defined(SIMDE_INFINITYF)
#if \
HEDLEY_HAS_BUILTIN(__builtin_inff) || \
HEDLEY_GCC_VERSION_CHECK(3,3,0) || \
HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \
HEDLEY_CRAY_VERSION_CHECK(8,1,0) || \
HEDLEY_IBM_VERSION_CHECK(13,1,0)
#define SIMDE_MATH_INFINITYF (__builtin_inff())
#elif defined(INFINITYF)
#define SIMDE_MATH_INFINITYF INFINITYF
#elif defined(SIMDE_MATH_INFINITY)
#define SIMDE_MATH_INFINITYF HEDLEY_STATIC_CAST(float, SIMDE_MATH_INFINITY)
#endif
#endif
#if !defined(SIMDE_MATH_NAN)
#if \
HEDLEY_HAS_BUILTIN(__builtin_nan) || \
HEDLEY_GCC_VERSION_CHECK(3,3,0) || \
HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \
HEDLEY_ARM_VERSION_CHECK(4,1,0) || \
HEDLEY_CRAY_VERSION_CHECK(8,1,0) || \
HEDLEY_IBM_VERSION_CHECK(13,1,0)
#define SIMDE_MATH_NAN (__builtin_nan(""))
#elif defined(NAN)
#define SIMDE_MATH_NAN NAN
#endif
#endif
#if !defined(SIMDE_MATH_NANF)
#if \
HEDLEY_HAS_BUILTIN(__builtin_nanf) || \
HEDLEY_GCC_VERSION_CHECK(3,3,0) || \
HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \
HEDLEY_ARM_VERSION_CHECK(4,1,0) || \
HEDLEY_CRAY_VERSION_CHECK(8,1,0)
#define SIMDE_MATH_NANF (__builtin_nanf(""))
#elif defined(NANF)
#define SIMDE_MATH_NANF NANF
#elif defined(SIMDE_MATH_NAN)
#define SIMDE_MATH_NANF HEDLEY_STATIC_CAST(float, SIMDE_MATH_NAN)
#endif
#endif
#if !defined(SIMDE_MATH_PI)
#if defined(M_PI)
#define SIMDE_MATH_PI M_PI
#else
#define SIMDE_MATH_PI 3.14159265358979323846
#endif
#endif
#if !defined(SIMDE_MATH_PIF)
#if defined(M_PI)
#define SIMDE_MATH_PIF HEDLEY_STATIC_CAST(float, M_PI)
#else
#define SIMDE_MATH_PIF 3.14159265358979323846f
#endif
#endif
#if !defined(SIMDE_MATH_PI_OVER_180)
#define SIMDE_MATH_PI_OVER_180 0.0174532925199432957692369076848861271344287188854172545609719144
#endif
#if !defined(SIMDE_MATH_PI_OVER_180F)
#define SIMDE_MATH_PI_OVER_180F 0.0174532925199432957692369076848861271344287188854172545609719144f
#endif
#if !defined(SIMDE_MATH_180_OVER_PI)
#define SIMDE_MATH_180_OVER_PI 57.295779513082320876798154814105170332405472466564321549160243861
#endif
#if !defined(SIMDE_MATH_180_OVER_PIF)
#define SIMDE_MATH_180_OVER_PIF 57.295779513082320876798154814105170332405472466564321549160243861f
#endif
#if !defined(SIMDE_MATH_FLT_MIN)
#if defined(__FLT_MIN__)
#define SIMDE_MATH_FLT_MIN __FLT_MIN__
#else
#if !defined(FLT_MIN)
#if defined(__cplusplus)
#include <cfloat>
#else
#include <float.h>
#endif
#endif
#define SIMDE_MATH_FLT_MIN FLT_MIN
#endif
#endif
#if !defined(SIMDE_MATH_FLT_MAX)
#if defined(__FLT_MAX__)
#define SIMDE_MATH_FLT_MAX __FLT_MAX__
#else
#if !defined(FLT_MAX)
#if defined(__cplusplus)
#include <cfloat>
#else
#include <float.h>
#endif
#endif
#define SIMDE_MATH_FLT_MAX FLT_MAX
#endif
#endif
#if !defined(SIMDE_MATH_DBL_MIN)
#if defined(__DBL_MIN__)
#define SIMDE_MATH_DBL_MIN __DBL_MIN__
#else
#if !defined(DBL_MIN)
#if defined(__cplusplus)
#include <cfloat>
#else
#include <float.h>
#endif
#endif
#define SIMDE_MATH_DBL_MIN DBL_MIN
#endif
#endif
#if !defined(SIMDE_MATH_DBL_MAX)
#if defined(__DBL_MAX__)
#define SIMDE_MATH_DBL_MAX __DBL_MAX__
#else
#if !defined(DBL_MAX)
#if defined(__cplusplus)
#include <cfloat>
#else
#include <float.h>
#endif
#endif
#define SIMDE_MATH_DBL_MAX DBL_MAX
#endif
#endif
/*** Classification macros from C99 ***/
#if !defined(simde_math_isinf)
#if SIMDE_MATH_BUILTIN_LIBM(isinf)
#define simde_math_isinf(v) __builtin_isinf(v)
#elif defined(isinf) || defined(SIMDE_MATH_HAVE_MATH_H)
#define simde_math_isinf(v) isinf(v)
#elif defined(SIMDE_MATH_HAVE_CMATH)
#define simde_math_isinf(v) std::isinf(v)
#endif
#endif
#if !defined(simde_math_isinff)
#if HEDLEY_HAS_BUILTIN(__builtin_isinff) || \
HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \
HEDLEY_ARM_VERSION_CHECK(4,1,0)
#define simde_math_isinff(v) __builtin_isinff(v)
#elif defined(SIMDE_MATH_HAVE_CMATH)
#define simde_math_isinff(v) std::isinf(v)
#elif defined(simde_math_isinf)
#define simde_math_isinff(v) simde_math_isinf(HEDLEY_STATIC_CAST(double, v))
#endif
#endif
#if !defined(simde_math_isnan)
#if SIMDE_MATH_BUILTIN_LIBM(isnan)
#define simde_math_isnan(v) __builtin_isnan(v)
#elif defined(isnan) || defined(SIMDE_MATH_HAVE_MATH_H)
#define simde_math_isnan(v) isnan(v)
#elif defined(SIMDE_MATH_HAVE_CMATH)
#define simde_math_isnan(v) std::isnan(v)
#endif
#endif
#if !defined(simde_math_isnanf)
#if HEDLEY_HAS_BUILTIN(__builtin_isnanf) || \
HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \
HEDLEY_ARM_VERSION_CHECK(4,1,0)
/* XL C/C++ has __builtin_isnan but not __builtin_isnanf */
#define simde_math_isnanf(v) __builtin_isnanf(v)
#elif defined(SIMDE_MATH_HAVE_CMATH)
#define simde_math_isnanf(v) std::isnan(v)
#elif defined(simde_math_isnan)
#define simde_math_isnanf(v) simde_math_isnan(HEDLEY_STATIC_CAST(double, v))
#endif
#endif
#if !defined(simde_math_isnormal)
#if SIMDE_MATH_BUILTIN_LIBM(isnormal)
#define simde_math_isnormal(v) __builtin_isnormal(v)
#elif defined(SIMDE_MATH_HAVE_MATH_H)
#define simde_math_isnormal(v) isnormal(v)
#elif defined(SIMDE_MATH_HAVE_CMATH)
#define simde_math_isnormal(v) std::isnormal(v)
#endif
#endif
#if !defined(simde_math_isnormalf)
#if HEDLEY_HAS_BUILTIN(__builtin_isnormalf)
#define simde_math_isnormalf(v) __builtin_isnormalf(v)
#elif SIMDE_MATH_BUILTIN_LIBM(isnormal)
#define simde_math_isnormalf(v) __builtin_isnormal(v)
#elif defined(isnormalf)
#define simde_math_isnormalf(v) isnormalf(v)
#elif defined(isnormal) || defined(SIMDE_MATH_HAVE_MATH_H)
#define simde_math_isnormalf(v) isnormal(v)
#elif defined(SIMDE_MATH_HAVE_CMATH)
#define simde_math_isnormalf(v) std::isnormal(v)
#elif defined(simde_math_isnormal)
#define simde_math_isnormalf(v) simde_math_isnormal(v)
#endif
#endif
#if !defined(simde_math_issubnormalf)
#if SIMDE_MATH_BUILTIN_LIBM(fpclassify)
#define simde_math_issubnormalf(v) __builtin_fpclassify(0, 0, 0, 1, 0, v)
#elif defined(fpclassify)
#define simde_math_issubnormalf(v) (fpclassify(v) == FP_SUBNORMAL)
#elif defined(SIMDE_IEEE754_STORAGE)
#define simde_math_issubnormalf(v) (((simde_float32_as_uint32(v) & UINT32_C(0x7F800000)) == UINT32_C(0)) && ((simde_float32_as_uint32(v) & UINT32_C(0x007FFFFF)) != UINT32_C(0)))
#endif
#endif
#if !defined(simde_math_issubnormal)
#if SIMDE_MATH_BUILTIN_LIBM(fpclassify)
#define simde_math_issubnormal(v) __builtin_fpclassify(0, 0, 0, 1, 0, v)
#elif defined(fpclassify)
#define simde_math_issubnormal(v) (fpclassify(v) == FP_SUBNORMAL)
#elif defined(SIMDE_IEEE754_STORAGE)
#define simde_math_issubnormal(v) (((simde_float64_as_uint64(v) & UINT64_C(0x7FF0000000000000)) == UINT64_C(0)) && ((simde_float64_as_uint64(v) & UINT64_C(0x00FFFFFFFFFFFFF)) != UINT64_C(0)))
#endif
#endif
#if defined(FP_NAN)
#define SIMDE_MATH_FP_NAN FP_NAN
#else
#define SIMDE_MATH_FP_NAN 0
#endif
#if defined(FP_INFINITE)
#define SIMDE_MATH_FP_INFINITE FP_INFINITE
#else
#define SIMDE_MATH_FP_INFINITE 1
#endif
#if defined(FP_ZERO)
#define SIMDE_MATH_FP_ZERO FP_ZERO
#else
#define SIMDE_MATH_FP_ZERO 2
#endif
#if defined(FP_SUBNORMAL)
#define SIMDE_MATH_FP_SUBNORMAL FP_SUBNORMAL
#else
#define SIMDE_MATH_FP_SUBNORMAL 3
#endif
#if defined(FP_NORMAL)
#define SIMDE_MATH_FP_NORMAL FP_NORMAL
#else
#define SIMDE_MATH_FP_NORMAL 4
#endif
static HEDLEY_INLINE
int
simde_math_fpclassifyf(float v) {
#if SIMDE_MATH_BUILTIN_LIBM(fpclassify)
return __builtin_fpclassify(SIMDE_MATH_FP_NAN, SIMDE_MATH_FP_INFINITE, SIMDE_MATH_FP_NORMAL, SIMDE_MATH_FP_SUBNORMAL, SIMDE_MATH_FP_ZERO, v);
#elif defined(fpclassify)
return fpclassify(v);
#else
return
simde_math_isnormalf(v) ? SIMDE_MATH_FP_NORMAL :
(v == 0.0f) ? SIMDE_MATH_FP_ZERO :
simde_math_isnanf(v) ? SIMDE_MATH_FP_NAN :
simde_math_isinff(v) ? SIMDE_MATH_FP_INFINITE :
SIMDE_MATH_FP_SUBNORMAL;
#endif
}
static HEDLEY_INLINE
int
simde_math_fpclassify(double v) {
#if SIMDE_MATH_BUILTIN_LIBM(fpclassify)
return __builtin_fpclassify(SIMDE_MATH_FP_NAN, SIMDE_MATH_FP_INFINITE, SIMDE_MATH_FP_NORMAL, SIMDE_MATH_FP_SUBNORMAL, SIMDE_MATH_FP_ZERO, v);
#elif defined(fpclassify)
return fpclassify(v);
#else
return
simde_math_isnormal(v) ? SIMDE_MATH_FP_NORMAL :
(v == 0.0) ? SIMDE_MATH_FP_ZERO :
simde_math_isnan(v) ? SIMDE_MATH_FP_NAN :
simde_math_isinf(v) ? SIMDE_MATH_FP_INFINITE :
SIMDE_MATH_FP_SUBNORMAL;
#endif
}
#define SIMDE_MATH_FP_QNAN 0x01
#define SIMDE_MATH_FP_PZERO 0x02
#define SIMDE_MATH_FP_NZERO 0x04
#define SIMDE_MATH_FP_PINF 0x08
#define SIMDE_MATH_FP_NINF 0x10
#define SIMDE_MATH_FP_DENORMAL 0x20
#define SIMDE_MATH_FP_NEGATIVE 0x40
#define SIMDE_MATH_FP_SNAN 0x80
static HEDLEY_INLINE
uint8_t
simde_math_fpclassf(float v, const int imm8) {
union {
float f;
uint32_t u;
} fu;
fu.f = v;
uint32_t bits = fu.u;
uint8_t NegNum = (bits >> 31) & 1;
uint32_t const ExpMask = 0x3F800000; // [30:23]
uint32_t const MantMask = 0x007FFFFF; // [22:0]
uint8_t ExpAllOnes = ((bits & ExpMask) == ExpMask);
uint8_t ExpAllZeros = ((bits & ExpMask) == 0);
uint8_t MantAllZeros = ((bits & MantMask) == 0);
uint8_t ZeroNumber = ExpAllZeros & MantAllZeros;
uint8_t SignalingBit = (bits >> 22) & 1;
uint8_t result = 0;
uint8_t qNaN_res = ExpAllOnes & (!MantAllZeros) & SignalingBit;
uint8_t Pzero_res = (!NegNum) & ExpAllZeros & MantAllZeros;
uint8_t Nzero_res = NegNum & ExpAllZeros & MantAllZeros;
uint8_t Pinf_res = (!NegNum) & ExpAllOnes & MantAllZeros;
uint8_t Ninf_res = NegNum & ExpAllOnes & MantAllZeros;
uint8_t Denorm_res = ExpAllZeros & (!MantAllZeros);
uint8_t FinNeg_res = NegNum & (!ExpAllOnes) & (!ZeroNumber);
uint8_t sNaN_res = ExpAllOnes & (!MantAllZeros) & (!SignalingBit);
result = (((imm8 >> 0) & qNaN_res) | \
((imm8 >> 1) & Pzero_res) | \
((imm8 >> 2) & Nzero_res) | \
((imm8 >> 3) & Pinf_res) | \
((imm8 >> 4) & Ninf_res) | \
((imm8 >> 5) & Denorm_res) | \
((imm8 >> 6) & FinNeg_res) | \
((imm8 >> 7) & sNaN_res));
return result;
}
static HEDLEY_INLINE
uint8_t
simde_math_fpclass(double v, const int imm8) {
union {
double d;
uint64_t u;
} du;
du.d = v;
uint64_t bits = du.u;
uint8_t NegNum = (bits >> 63) & 1;
uint64_t const ExpMask = 0x3FF0000000000000; // [62:52]
uint64_t const MantMask = 0x000FFFFFFFFFFFFF; // [51:0]
uint8_t ExpAllOnes = ((bits & ExpMask) == ExpMask);
uint8_t ExpAllZeros = ((bits & ExpMask) == 0);
uint8_t MantAllZeros = ((bits & MantMask) == 0);
uint8_t ZeroNumber = ExpAllZeros & MantAllZeros;
uint8_t SignalingBit = (bits >> 51) & 1;
uint8_t result = 0;
uint8_t qNaN_res = ExpAllOnes & (!MantAllZeros) & SignalingBit;
uint8_t Pzero_res = (!NegNum) & ExpAllZeros & MantAllZeros;
uint8_t Nzero_res = NegNum & ExpAllZeros & MantAllZeros;
uint8_t Pinf_res = (!NegNum) & ExpAllOnes & MantAllZeros;
uint8_t Ninf_res = NegNum & ExpAllOnes & MantAllZeros;
uint8_t Denorm_res = ExpAllZeros & (!MantAllZeros);
uint8_t FinNeg_res = NegNum & (!ExpAllOnes) & (!ZeroNumber);
uint8_t sNaN_res = ExpAllOnes & (!MantAllZeros) & (!SignalingBit);
result = (((imm8 >> 0) & qNaN_res) | \
((imm8 >> 1) & Pzero_res) | \
((imm8 >> 2) & Nzero_res) | \
((imm8 >> 3) & Pinf_res) | \
((imm8 >> 4) & Ninf_res) | \
((imm8 >> 5) & Denorm_res) | \
((imm8 >> 6) & FinNeg_res) | \
((imm8 >> 7) & sNaN_res));
return result;
}
/*** Manipulation functions ***/
#if !defined(simde_math_nextafter)
#if \
(HEDLEY_HAS_BUILTIN(__builtin_nextafter) && !defined(HEDLEY_IBM_VERSION)) || \
HEDLEY_ARM_VERSION_CHECK(4,1,0) || \
HEDLEY_GCC_VERSION_CHECK(3,4,0) || \
HEDLEY_INTEL_VERSION_CHECK(13,0,0)
#define simde_math_nextafter(x, y) __builtin_nextafter(x, y)
#elif defined(SIMDE_MATH_HAVE_CMATH)
#define simde_math_nextafter(x, y) std::nextafter(x, y)
#elif defined(SIMDE_MATH_HAVE_MATH_H)
#define simde_math_nextafter(x, y) nextafter(x, y)
#endif
#endif
#if !defined(simde_math_nextafterf)
#if \
(HEDLEY_HAS_BUILTIN(__builtin_nextafterf) && !defined(HEDLEY_IBM_VERSION)) || \
HEDLEY_ARM_VERSION_CHECK(4,1,0) || \
HEDLEY_GCC_VERSION_CHECK(3,4,0) || \
HEDLEY_INTEL_VERSION_CHECK(13,0,0)
#define simde_math_nextafterf(x, y) __builtin_nextafterf(x, y)
#elif defined(SIMDE_MATH_HAVE_CMATH)
#define simde_math_nextafterf(x, y) std::nextafter(x, y)
#elif defined(SIMDE_MATH_HAVE_MATH_H)
#define simde_math_nextafterf(x, y) nextafterf(x, y)
#endif
#endif
/*** Functions from C99 ***/
#if !defined(simde_math_abs)
#if SIMDE_MATH_BUILTIN_LIBM(abs)
#define simde_math_abs(v) __builtin_abs(v)
#elif defined(SIMDE_MATH_HAVE_CMATH)
#define simde_math_abs(v) std::abs(v)
#elif defined(SIMDE_MATH_HAVE_MATH_H)
#define simde_math_abs(v) abs(v)
#endif
#endif
#if !defined(simde_math_labs)
#if SIMDE_MATH_BUILTIN_LIBM(labs)
#define simde_math_labs(v) __builtin_labs(v)
#elif defined(SIMDE_MATH_HAVE_CMATH)
#define simde_math_labs(v) std::labs(v)
#elif defined(SIMDE_MATH_HAVE_MATH_H)
#define simde_math_labs(v) labs(v)
#endif
#endif
#if !defined(simde_math_llabs)
#if SIMDE_MATH_BUILTIN_LIBM(llabs)
#define simde_math_llabs(v) __builtin_llabs(v)
#elif defined(SIMDE_MATH_HAVE_CMATH)
#define simde_math_llabs(v) std::llabs(v)
#elif defined(SIMDE_MATH_HAVE_MATH_H)
#define simde_math_llabs(v) llabs(v)
#endif
#endif
#if !defined(simde_math_fabsf)
#if SIMDE_MATH_BUILTIN_LIBM(fabsf)
#define simde_math_fabsf(v) __builtin_fabsf(v)
#elif defined(SIMDE_MATH_HAVE_CMATH)
#define simde_math_fabsf(v) std::abs(v)
#elif defined(SIMDE_MATH_HAVE_MATH_H)
#define simde_math_fabsf(v) fabsf(v)
#endif
#endif
#if !defined(simde_math_acos)
#if SIMDE_MATH_BUILTIN_LIBM(acos)
#define simde_math_acos(v) __builtin_acos(v)
#elif defined(SIMDE_MATH_HAVE_CMATH)
#define simde_math_acos(v) std::acos(v)
#elif defined(SIMDE_MATH_HAVE_MATH_H)
#define simde_math_acos(v) acos(v)
#endif
#endif
#if !defined(simde_math_acosf)
#if SIMDE_MATH_BUILTIN_LIBM(acosf)
#define simde_math_acosf(v) __builtin_acosf(v)
#elif defined(SIMDE_MATH_HAVE_CMATH)
#define simde_math_acosf(v) std::acos(v)
#elif defined(SIMDE_MATH_HAVE_MATH_H)
#define simde_math_acosf(v) acosf(v)
#endif
#endif
#if !defined(simde_math_acosh)
#if SIMDE_MATH_BUILTIN_LIBM(acosh)
#define simde_math_acosh(v) __builtin_acosh(v)
#elif defined(SIMDE_MATH_HAVE_CMATH)
#define simde_math_acosh(v) std::acosh(v)
#elif defined(SIMDE_MATH_HAVE_MATH_H)
#define simde_math_acosh(v) acosh(v)
#endif
#endif
#if !defined(simde_math_acoshf)
#if SIMDE_MATH_BUILTIN_LIBM(acoshf)
#define simde_math_acoshf(v) __builtin_acoshf(v)
#elif defined(SIMDE_MATH_HAVE_CMATH)
#define simde_math_acoshf(v) std::acosh(v)
#elif defined(SIMDE_MATH_HAVE_MATH_H)
#define simde_math_acoshf(v) acoshf(v)
#endif
#endif
#if !defined(simde_math_asin)
#if SIMDE_MATH_BUILTIN_LIBM(asin)
#define simde_math_asin(v) __builtin_asin(v)
#elif defined(SIMDE_MATH_HAVE_CMATH)
#define simde_math_asin(v) std::asin(v)
#elif defined(SIMDE_MATH_HAVE_MATH_H)
#define simde_math_asin(v) asin(v)
#endif
#endif
#if !defined(simde_math_asinf)
#if SIMDE_MATH_BUILTIN_LIBM(asinf)
#define simde_math_asinf(v) __builtin_asinf(v)
#elif defined(SIMDE_MATH_HAVE_CMATH)
#define simde_math_asinf(v) std::asin(v)
#elif defined(SIMDE_MATH_HAVE_MATH_H)
#define simde_math_asinf(v) asinf(v)
#endif
#endif
#if !defined(simde_math_asinh)
#if SIMDE_MATH_BUILTIN_LIBM(asinh)
#define simde_math_asinh(v) __builtin_asinh(v)
#elif defined(SIMDE_MATH_HAVE_CMATH)
#define simde_math_asinh(v) std::asinh(v)
#elif defined(SIMDE_MATH_HAVE_MATH_H)
#define simde_math_asinh(v) asinh(v)
#endif
#endif
#if !defined(simde_math_asinhf)
#if SIMDE_MATH_BUILTIN_LIBM(asinhf)
#define simde_math_asinhf(v) __builtin_asinhf(v)
#elif defined(SIMDE_MATH_HAVE_CMATH)
#define simde_math_asinhf(v) std::asinh(v)
#elif defined(SIMDE_MATH_HAVE_MATH_H)
#define simde_math_asinhf(v) asinhf(v)
#endif
#endif
#if !defined(simde_math_atan)
#if SIMDE_MATH_BUILTIN_LIBM(atan)
#define simde_math_atan(v) __builtin_atan(v)
#elif defined(SIMDE_MATH_HAVE_CMATH)
#define simde_math_atan(v) std::atan(v)
#elif defined(SIMDE_MATH_HAVE_MATH_H)
#define simde_math_atan(v) atan(v)
#endif
#endif
#if !defined(simde_math_atan2)
#if SIMDE_MATH_BUILTIN_LIBM(atan2)
#define simde_math_atan2(y, x) __builtin_atan2(y, x)
#elif defined(SIMDE_MATH_HAVE_CMATH)
#define simde_math_atan2(y, x) std::atan2(y, x)
#elif defined(SIMDE_MATH_HAVE_MATH_H)
#define simde_math_atan2(y, x) atan2(y, x)
#endif
#endif
#if !defined(simde_math_atan2f)
#if SIMDE_MATH_BUILTIN_LIBM(atan2f)
#define simde_math_atan2f(y, x) __builtin_atan2f(y, x)
#elif defined(SIMDE_MATH_HAVE_CMATH)
#define simde_math_atan2f(y, x) std::atan2(y, x)
#elif defined(SIMDE_MATH_HAVE_MATH_H)
#define simde_math_atan2f(y, x) atan2f(y, x)
#endif
#endif
#if !defined(simde_math_atanf)
#if SIMDE_MATH_BUILTIN_LIBM(atanf)
#define simde_math_atanf(v) __builtin_atanf(v)
#elif defined(SIMDE_MATH_HAVE_CMATH)
#define simde_math_atanf(v) std::atan(v)
#elif defined(SIMDE_MATH_HAVE_MATH_H)
#define simde_math_atanf(v) atanf(v)
#endif
#endif
#if !defined(simde_math_atanh)
#if SIMDE_MATH_BUILTIN_LIBM(atanh)
#define simde_math_atanh(v) __builtin_atanh(v)
#elif defined(SIMDE_MATH_HAVE_CMATH)
#define simde_math_atanh(v) std::atanh(v)
#elif defined(SIMDE_MATH_HAVE_MATH_H)
#define simde_math_atanh(v) atanh(v)
#endif
#endif
#if !defined(simde_math_atanhf)
#if SIMDE_MATH_BUILTIN_LIBM(atanhf)
#define simde_math_atanhf(v) __builtin_atanhf(v)
#elif defined(SIMDE_MATH_HAVE_CMATH)
#define simde_math_atanhf(v) std::atanh(v)
#elif defined(SIMDE_MATH_HAVE_MATH_H)
#define simde_math_atanhf(v) atanhf(v)
#endif
#endif
#if !defined(simde_math_cbrt)
#if SIMDE_MATH_BUILTIN_LIBM(cbrt)
#define simde_math_cbrt(v) __builtin_cbrt(v)
#elif defined(SIMDE_MATH_HAVE_CMATH)
#define simde_math_cbrt(v) std::cbrt(v)
#elif defined(SIMDE_MATH_HAVE_MATH_H)
#define simde_math_cbrt(v) cbrt(v)
#endif
#endif
#if !defined(simde_math_cbrtf)
#if SIMDE_MATH_BUILTIN_LIBM(cbrtf)
#define simde_math_cbrtf(v) __builtin_cbrtf(v)
#elif defined(SIMDE_MATH_HAVE_CMATH)
#define simde_math_cbrtf(v) std::cbrt(v)
#elif defined(SIMDE_MATH_HAVE_MATH_H)
#define simde_math_cbrtf(v) cbrtf(v)
#endif
#endif
#if !defined(simde_math_ceil)
#if SIMDE_MATH_BUILTIN_LIBM(ceil)
#define simde_math_ceil(v) __builtin_ceil(v)
#elif defined(SIMDE_MATH_HAVE_CMATH)
#define simde_math_ceil(v) std::ceil(v)
#elif defined(SIMDE_MATH_HAVE_MATH_H)
#define simde_math_ceil(v) ceil(v)
#endif
#endif
#if !defined(simde_math_ceilf)
#if SIMDE_MATH_BUILTIN_LIBM(ceilf)
#define simde_math_ceilf(v) __builtin_ceilf(v)
#elif defined(SIMDE_MATH_HAVE_CMATH)
#define simde_math_ceilf(v) std::ceil(v)
#elif defined(SIMDE_MATH_HAVE_MATH_H)
#define simde_math_ceilf(v) ceilf(v)
#endif
#endif
#if !defined(simde_math_copysign)
#if SIMDE_MATH_BUILTIN_LIBM(copysign)
#define simde_math_copysign(x, y) __builtin_copysign(x, y)
#elif defined(SIMDE_MATH_HAVE_CMATH)
#define simde_math_copysign(x, y) std::copysign(x, y)
#elif defined(SIMDE_MATH_HAVE_MATH_H)
#define simde_math_copysign(x, y) copysign(x, y)
#endif
#endif
#if !defined(simde_math_copysignf)
#if SIMDE_MATH_BUILTIN_LIBM(copysignf)
#define simde_math_copysignf(x, y) __builtin_copysignf(x, y)
#elif defined(SIMDE_MATH_HAVE_CMATH)
#define simde_math_copysignf(x, y) std::copysignf(x, y)
#elif defined(SIMDE_MATH_HAVE_MATH_H)
#define simde_math_copysignf(x, y) copysignf(x, y)
#endif
#endif
#if !defined(simde_math_signbit)
#if SIMDE_MATH_BUILTIN_LIBM(signbit)
#if (!defined(__clang__) || SIMDE_DETECT_CLANG_VERSION_CHECK(7,0,0))
#define simde_math_signbit(x) __builtin_signbit(x)
#else
#define simde_math_signbit(x) __builtin_signbit(HEDLEY_STATIC_CAST(double, (x)))
#endif
#elif defined(SIMDE_MATH_HAVE_CMATH)
#define simde_math_signbit(x) std::signbit(x)
#elif defined(SIMDE_MATH_HAVE_MATH_H)
#define simde_math_signbit(x) signbit(x)
#endif
#endif
#if !defined(simde_math_cos)
#if SIMDE_MATH_BUILTIN_LIBM(cos)
#define simde_math_cos(v) __builtin_cos(v)
#elif defined(SIMDE_MATH_HAVE_CMATH)
#define simde_math_cos(v) std::cos(v)
#elif defined(SIMDE_MATH_HAVE_MATH_H)
#define simde_math_cos(v) cos(v)
#endif
#endif
#if !defined(simde_math_cosf)
#if defined(SIMDE_MATH_SLEEF_ENABLE)
#if SIMDE_ACCURACY_PREFERENCE < 1
#define simde_math_cosf(v) Sleef_cosf_u35(v)
#else
#define simde_math_cosf(v) Sleef_cosf_u10(v)
#endif
#elif SIMDE_MATH_BUILTIN_LIBM(cosf)
#define simde_math_cosf(v) __builtin_cosf(v)
#elif defined(SIMDE_MATH_HAVE_CMATH)
#define simde_math_cosf(v) std::cos(v)
#elif defined(SIMDE_MATH_HAVE_MATH_H)
#define simde_math_cosf(v) cosf(v)
#endif
#endif
#if !defined(simde_math_cosh)
#if SIMDE_MATH_BUILTIN_LIBM(cosh)
#define simde_math_cosh(v) __builtin_cosh(v)
#elif defined(SIMDE_MATH_HAVE_CMATH)
#define simde_math_cosh(v) std::cosh(v)
#elif defined(SIMDE_MATH_HAVE_MATH_H)
#define simde_math_cosh(v) cosh(v)
#endif
#endif
#if !defined(simde_math_coshf)
#if SIMDE_MATH_BUILTIN_LIBM(coshf)
#define simde_math_coshf(v) __builtin_coshf(v)
#elif defined(SIMDE_MATH_HAVE_CMATH)
#define simde_math_coshf(v) std::cosh(v)
#elif defined(SIMDE_MATH_HAVE_MATH_H)
#define simde_math_coshf(v) coshf(v)
#endif
#endif
#if !defined(simde_math_erf)
#if SIMDE_MATH_BUILTIN_LIBM(erf)
#define simde_math_erf(v) __builtin_erf(v)
#elif defined(SIMDE_MATH_HAVE_CMATH)
#define simde_math_erf(v) std::erf(v)
#elif defined(SIMDE_MATH_HAVE_MATH_H)
#define simde_math_erf(v) erf(v)
#endif
#endif
#if !defined(simde_math_erff)
#if SIMDE_MATH_BUILTIN_LIBM(erff)
#define simde_math_erff(v) __builtin_erff(v)
#elif defined(SIMDE_MATH_HAVE_CMATH)
#define simde_math_erff(v) std::erf(v)
#elif defined(SIMDE_MATH_HAVE_MATH_H)
#define simde_math_erff(v) erff(v)
#endif
#endif
#if !defined(simde_math_erfc)
#if SIMDE_MATH_BUILTIN_LIBM(erfc)
#define simde_math_erfc(v) __builtin_erfc(v)
#elif defined(SIMDE_MATH_HAVE_CMATH)
#define simde_math_erfc(v) std::erfc(v)
#elif defined(SIMDE_MATH_HAVE_MATH_H)
#define simde_math_erfc(v) erfc(v)
#endif
#endif
#if !defined(simde_math_erfcf)
#if SIMDE_MATH_BUILTIN_LIBM(erfcf)
#define simde_math_erfcf(v) __builtin_erfcf(v)
#elif defined(SIMDE_MATH_HAVE_CMATH)
#define simde_math_erfcf(v) std::erfc(v)
#elif defined(SIMDE_MATH_HAVE_MATH_H)
#define simde_math_erfcf(v) erfcf(v)
#endif
#endif
#if !defined(simde_math_exp)
#if SIMDE_MATH_BUILTIN_LIBM(exp)
#define simde_math_exp(v) __builtin_exp(v)
#elif defined(SIMDE_MATH_HAVE_CMATH)
#define simde_math_exp(v) std::exp(v)
#elif defined(SIMDE_MATH_HAVE_MATH_H)
#define simde_math_exp(v) exp(v)
#endif
#endif
#if !defined(simde_math_expf)
#if SIMDE_MATH_BUILTIN_LIBM(expf)
#define simde_math_expf(v) __builtin_expf(v)
#elif defined(SIMDE_MATH_HAVE_CMATH)
#define simde_math_expf(v) std::exp(v)
#elif defined(SIMDE_MATH_HAVE_MATH_H)
#define simde_math_expf(v) expf(v)
#endif
#endif
#if !defined(simde_math_expm1)
#if SIMDE_MATH_BUILTIN_LIBM(expm1)
#define simde_math_expm1(v) __builtin_expm1(v)
#elif defined(SIMDE_MATH_HAVE_CMATH)
#define simde_math_expm1(v) std::expm1(v)
#elif defined(SIMDE_MATH_HAVE_MATH_H)
#define simde_math_expm1(v) expm1(v)
#endif
#endif
#if !defined(simde_math_expm1f)
#if SIMDE_MATH_BUILTIN_LIBM(expm1f)
#define simde_math_expm1f(v) __builtin_expm1f(v)
#elif defined(SIMDE_MATH_HAVE_CMATH)
#define simde_math_expm1f(v) std::expm1(v)
#elif defined(SIMDE_MATH_HAVE_MATH_H)
#define simde_math_expm1f(v) expm1f(v)
#endif
#endif
#if !defined(simde_math_exp2)
#if SIMDE_MATH_BUILTIN_LIBM(exp2)
#define simde_math_exp2(v) __builtin_exp2(v)
#elif defined(SIMDE_MATH_HAVE_CMATH)
#define simde_math_exp2(v) std::exp2(v)
#elif defined(SIMDE_MATH_HAVE_MATH_H)
#define simde_math_exp2(v) exp2(v)
#endif
#endif
#if !defined(simde_math_exp2f)
#if SIMDE_MATH_BUILTIN_LIBM(exp2f)
#define simde_math_exp2f(v) __builtin_exp2f(v)
#elif defined(SIMDE_MATH_HAVE_CMATH)
#define simde_math_exp2f(v) std::exp2(v)
#elif defined(SIMDE_MATH_HAVE_MATH_H)
#define simde_math_exp2f(v) exp2f(v)
#endif
#endif
#if !defined(simde_math_pow)
#if SIMDE_MATH_BUILTIN_LIBM(pow)
#define simde_math_pow(y, x) __builtin_pow(y, x)
#elif defined(SIMDE_MATH_HAVE_CMATH)
#define simde_math_pow(y, x) std::pow(y, x)
#elif defined(SIMDE_MATH_HAVE_MATH_H)
#define simde_math_pow(y, x) pow(y, x)
#endif
#endif
#if !defined(simde_math_powf)
#if SIMDE_MATH_BUILTIN_LIBM(powf)
#define simde_math_powf(y, x) __builtin_powf(y, x)
#elif defined(SIMDE_MATH_HAVE_CMATH)
#define simde_math_powf(y, x) std::pow(y, x)
#elif defined(SIMDE_MATH_HAVE_MATH_H)
#define simde_math_powf(y, x) powf(y, x)
#endif
#endif
#if HEDLEY_HAS_BUILTIN(__builtin_exp10) || HEDLEY_GCC_VERSION_CHECK(3,4,0)
# define simde_math_exp10(v) __builtin_exp10(v)
#else
# define simde_math_exp10(v) simde_math_pow(10.0, (v))
#endif
#if HEDLEY_HAS_BUILTIN(__builtin_exp10f) || HEDLEY_GCC_VERSION_CHECK(3,4,0)
# define simde_math_exp10f(v) __builtin_exp10f(v)
#else
# define simde_math_exp10f(v) simde_math_powf(10.0f, (v))
#endif
#if !defined(simde_math_fabs)
#if SIMDE_MATH_BUILTIN_LIBM(fabs)
#define simde_math_fabs(v) __builtin_fabs(v)
#elif defined(SIMDE_MATH_HAVE_CMATH)
#define simde_math_fabs(v) std::fabs(v)
#elif defined(SIMDE_MATH_HAVE_MATH_H)
#define simde_math_fabs(v) fabs(v)
#endif
#endif
#if !defined(simde_math_fabsf)
#if SIMDE_MATH_BUILTIN_LIBM(fabsf)
#define simde_math_fabsf(v) __builtin_fabsf(v)
#elif defined(SIMDE_MATH_HAVE_CMATH)