1 /* SPDX-License-Identifier: MIT
2 *
3 * Permission is hereby granted, free of charge, to any person
4 * obtaining a copy of this software and associated documentation
5 * files (the "Software"), to deal in the Software without
6 * restriction, including without limitation the rights to use, copy,
7 * modify, merge, publish, distribute, sublicense, and/or sell copies
8 * of the Software, and to permit persons to whom the Software is
9 * furnished to do so, subject to the following conditions:
10 *
11 * The above copyright notice and this permission notice shall be
12 * included in all copies or substantial portions of the Software.
13 *
14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
18 * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
19 * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 * SOFTWARE.
22 *
23 * Copyright:
24 * 2017-2020 Evan Nemerson <evan@nemerson.com>
25 */
26
27 /* Attempt to find math functions. Functions may be in <cmath>,
28 * <math.h>, compiler built-ins/intrinsics, or platform/architecture
29 * specific headers. In some cases, especially those not built in to
30 * libm, we may need to define our own implementations. */
31
32 #if !defined(SIMDE_MATH_H)
33
34 #include "hedley.h"
35 #include "simde-features.h"
36
37 #if defined(__has_builtin)
38 #define SIMDE_MATH_BUILTIN_LIBM(func) __has_builtin(__builtin_##func)
39 #elif \
40 HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \
41 HEDLEY_ARM_VERSION_CHECK(4,1,0) || \
42 HEDLEY_GCC_VERSION_CHECK(4,4,0)
43 #define SIMDE_MATH_BUILTIN_LIBM(func) (0)
44 #else
45 #define SIMDE_MATH_BUILTIN_LIBM(func) (0)
46 #endif
47
48 #if defined(HUGE_VAL)
49 /* Looks like <math.h> or <cmath> has already been included. */
50
51 /* The math.h from libc++ (yes, the C header from the C++ standard
52 * library) will define an isnan function, but not an isnan macro
53 * like the C standard requires. So, we detect the header guards
54 * macro libc++ uses. */
55 #if defined(isnan) || (defined(_LIBCPP_MATH_H) && !defined(_LIBCPP_CMATH))
56 #define SIMDE_MATH_HAVE_MATH_H
57 #elif defined(__cplusplus)
58 #define SIMDE_MATH_HAVE_CMATH
59 #endif
60 #elif defined(__has_include)
61 #if defined(__cplusplus) && (__cplusplus >= 201103L) && __has_include(<cmath>)
62 #define SIMDE_MATH_HAVE_CMATH
63 #include <cmath>
64 #elif __has_include(<math.h>)
65 #define SIMDE_MATH_HAVE_MATH_H
66 #include <math.h>
67 #elif !defined(SIMDE_MATH_NO_LIBM)
68 #define SIMDE_MATH_NO_LIBM
69 #endif
70 #elif !defined(SIMDE_MATH_NO_LIBM)
71 #if defined(__cplusplus) && (__cplusplus >= 201103L)
72 #define SIMDE_MATH_HAVE_CMATH
73 HEDLEY_DIAGNOSTIC_PUSH
74 #if defined(HEDLEY_MSVC_VERSION)
75 /* VS 14 emits this diagnostic about noexcept being used on a
76 * <cmath>, which we can't do anything about. */
77 #pragma warning(disable:4996)
78 #endif
79 #include <cmath>
80 HEDLEY_DIAGNOSTIC_POP
81 #else
82 #define SIMDE_MATH_HAVE_MATH_H
83 #include <math.h>
84 #endif
85 #endif
86
87 #if !defined(SIMDE_MATH_INFINITY)
88 #if \
89 HEDLEY_HAS_BUILTIN(__builtin_inf) || \
90 HEDLEY_GCC_VERSION_CHECK(3,3,0) || \
91 HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \
92 HEDLEY_ARM_VERSION_CHECK(4,1,0) || \
93 HEDLEY_CRAY_VERSION_CHECK(8,1,0)
94 #define SIMDE_MATH_INFINITY (__builtin_inf())
95 #elif defined(INFINITY)
96 #define SIMDE_MATH_INFINITY INFINITY
97 #endif
98 #endif
99
100 #if !defined(SIMDE_INFINITYF)
101 #if \
102 HEDLEY_HAS_BUILTIN(__builtin_inff) || \
103 HEDLEY_GCC_VERSION_CHECK(3,3,0) || \
104 HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \
105 HEDLEY_CRAY_VERSION_CHECK(8,1,0) || \
106 HEDLEY_IBM_VERSION_CHECK(13,1,0)
107 #define SIMDE_MATH_INFINITYF (__builtin_inff())
108 #elif defined(INFINITYF)
109 #define SIMDE_MATH_INFINITYF INFINITYF
110 #elif defined(SIMDE_MATH_INFINITY)
111 #define SIMDE_MATH_INFINITYF HEDLEY_STATIC_CAST(float, SIMDE_MATH_INFINITY)
112 #endif
113 #endif
114
115 #if !defined(SIMDE_MATH_NAN)
116 #if \
117 HEDLEY_HAS_BUILTIN(__builtin_nan) || \
118 HEDLEY_GCC_VERSION_CHECK(3,3,0) || \
119 HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \
120 HEDLEY_ARM_VERSION_CHECK(4,1,0) || \
121 HEDLEY_CRAY_VERSION_CHECK(8,1,0) || \
122 HEDLEY_IBM_VERSION_CHECK(13,1,0)
123 #define SIMDE_MATH_NAN (__builtin_nan(""))
124 #elif defined(NAN)
125 #define SIMDE_MATH_NAN NAN
126 #endif
127 #endif
128
129 #if !defined(SIMDE_NANF)
130 #if \
131 HEDLEY_HAS_BUILTIN(__builtin_nanf) || \
132 HEDLEY_GCC_VERSION_CHECK(3,3,0) || \
133 HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \
134 HEDLEY_ARM_VERSION_CHECK(4,1,0) || \
135 HEDLEY_CRAY_VERSION_CHECK(8,1,0)
136 #define SIMDE_MATH_NANF (__builtin_nanf(""))
137 #elif defined(NANF)
138 #define SIMDE_MATH_NANF NANF
139 #elif defined(SIMDE_MATH_NAN)
140 #define SIMDE_MATH_NANF HEDLEY_STATIC_CAST(float, SIMDE_MATH_NAN)
141 #endif
142 #endif
143
144 #if !defined(SIMDE_MATH_PI)
145 #if defined(M_PI)
146 #define SIMDE_MATH_PI M_PI
147 #else
148 #define SIMDE_MATH_PI 3.14159265358979323846
149 #endif
150 #endif
151
152 /*** Classification macros from C99 ***/
153
154 #if !defined(simde_math_isinf)
155 #if SIMDE_MATH_BUILTIN_LIBM(isinf)
156 #define simde_math_isinf(v) __builtin_isinf(v)
157 #elif defined(isinf) || defined(SIMDE_MATH_HAVE_MATH_H)
158 #define simde_math_isinf(v) isinf(v)
159 #elif defined(SIMDE_MATH_HAVE_CMATH)
160 #define simde_math_isinf(v) std::isinf(v)
161 #endif
162 #endif
163
164 #if !defined(simde_math_isinff)
165 #if HEDLEY_HAS_BUILTIN(__builtin_isinff) || \
166 HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \
167 HEDLEY_ARM_VERSION_CHECK(4,1,0)
168 #define simde_math_isinff(v) __builtin_isinff(v)
169 #elif defined(SIMDE_MATH_HAVE_CMATH)
170 #define simde_math_isinff(v) std::isinf(v)
171 #elif defined(simde_math_isinf)
172 #define simde_math_isinff(v) simde_math_isinf(HEDLEY_STATIC_CAST(double, v))
173 #endif
174 #endif
175
176 #if !defined(simde_math_isnan)
177 #if SIMDE_MATH_BUILTIN_LIBM(isnan)
178 #define simde_math_isnan(v) __builtin_isnan(v)
179 #elif defined(isnan) || defined(SIMDE_MATH_HAVE_MATH_H)
180 #define simde_math_isnan(v) isnan(v)
181 #elif defined(SIMDE_MATH_HAVE_CMATH)
182 #define simde_math_isnan(v) std::isnan(v)
183 #endif
184 #endif
185
186 #if !defined(simde_math_isnanf)
187 #if HEDLEY_HAS_BUILTIN(__builtin_isnanf) || \
188 HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \
189 HEDLEY_ARM_VERSION_CHECK(4,1,0)
190 /* XL C/C++ has __builtin_isnan but not __builtin_isnanf */
191 #define simde_math_isnanf(v) __builtin_isnanf(v)
192 #elif defined(SIMDE_MATH_HAVE_CMATH)
193 #define simde_math_isnanf(v) std::isnan(v)
194 #elif defined(simde_math_isnan)
195 #define simde_math_isnanf(v) simde_math_isnan(HEDLEY_STATIC_CAST(double, v))
196 #endif
197 #endif
198
199 #if !defined(simde_math_isnormal)
200 #if SIMDE_MATH_BUILTIN_LIBM(isnormal)
201 #define simde_math_isnormal(v) __builtin_isnormal(v)
202 #elif defined(isnormal) || defined(SIMDE_MATH_HAVE_MATH_H)
203 #define simde_math_isnormal(v) isnormal(v)
204 #elif defined(SIMDE_MATH_HAVE_CMATH)
205 #define simde_math_isnormal(v) std::isnormal(v)
206 #elif defined(simde_math_isnan)
207 #define simde_math_isnormal(v) simde_math_isnormal(v)
208 #endif
209 #endif
210
211 /*** Functions from C99 ***/
212
213 #if !defined(simde_math_abs)
214 #if SIMDE_MATH_BUILTIN_LIBM(abs)
215 #define simde_math_abs(v) __builtin_abs(v)
216 #elif defined(SIMDE_MATH_HAVE_CMATH)
217 #define simde_math_abs(v) std::abs(v)
218 #elif defined(SIMDE_MATH_HAVE_MATH_H)
219 #define simde_math_abs(v) abs(v)
220 #endif
221 #endif
222
223 #if !defined(simde_math_absf)
224 #if SIMDE_MATH_BUILTIN_LIBM(absf)
225 #define simde_math_absf(v) __builtin_absf(v)
226 #elif defined(SIMDE_MATH_HAVE_CMATH)
227 #define simde_math_absf(v) std::abs(v)
228 #elif defined(SIMDE_MATH_HAVE_MATH_H)
229 #define simde_math_absf(v) absf(v)
230 #endif
231 #endif
232
233 #if !defined(simde_math_acos)
234 #if SIMDE_MATH_BUILTIN_LIBM(acos)
235 #define simde_math_acos(v) __builtin_acos(v)
236 #elif defined(SIMDE_MATH_HAVE_CMATH)
237 #define simde_math_acos(v) std::acos(v)
238 #elif defined(SIMDE_MATH_HAVE_MATH_H)
239 #define simde_math_acos(v) acos(v)
240 #endif
241 #endif
242
243 #if !defined(simde_math_acosf)
244 #if SIMDE_MATH_BUILTIN_LIBM(acosf)
245 #define simde_math_acosf(v) __builtin_acosf(v)
246 #elif defined(SIMDE_MATH_HAVE_CMATH)
247 #define simde_math_acosf(v) std::acos(v)
248 #elif defined(SIMDE_MATH_HAVE_MATH_H)
249 #define simde_math_acosf(v) acosf(v)
250 #endif
251 #endif
252
253 #if !defined(simde_math_acosh)
254 #if SIMDE_MATH_BUILTIN_LIBM(acosh)
255 #define simde_math_acosh(v) __builtin_acosh(v)
256 #elif defined(SIMDE_MATH_HAVE_CMATH)
257 #define simde_math_acosh(v) std::acosh(v)
258 #elif defined(SIMDE_MATH_HAVE_MATH_H)
259 #define simde_math_acosh(v) acosh(v)
260 #endif
261 #endif
262
263 #if !defined(simde_math_acoshf)
264 #if SIMDE_MATH_BUILTIN_LIBM(acoshf)
265 #define simde_math_acoshf(v) __builtin_acoshf(v)
266 #elif defined(SIMDE_MATH_HAVE_CMATH)
267 #define simde_math_acoshf(v) std::acosh(v)
268 #elif defined(SIMDE_MATH_HAVE_MATH_H)
269 #define simde_math_acoshf(v) acoshf(v)
270 #endif
271 #endif
272
273 #if !defined(simde_math_asin)
274 #if SIMDE_MATH_BUILTIN_LIBM(asin)
275 #define simde_math_asin(v) __builtin_asin(v)
276 #elif defined(SIMDE_MATH_HAVE_CMATH)
277 #define simde_math_asin(v) std::asin(v)
278 #elif defined(SIMDE_MATH_HAVE_MATH_H)
279 #define simde_math_asin(v) asin(v)
280 #endif
281 #endif
282
283 #if !defined(simde_math_asinf)
284 #if SIMDE_MATH_BUILTIN_LIBM(asinf)
285 #define simde_math_asinf(v) __builtin_asinf(v)
286 #elif defined(SIMDE_MATH_HAVE_CMATH)
287 #define simde_math_asinf(v) std::asin(v)
288 #elif defined(SIMDE_MATH_HAVE_MATH_H)
289 #define simde_math_asinf(v) asinf(v)
290 #endif
291 #endif
292
293 #if !defined(simde_math_asinh)
294 #if SIMDE_MATH_BUILTIN_LIBM(asinh)
295 #define simde_math_asinh(v) __builtin_asinh(v)
296 #elif defined(SIMDE_MATH_HAVE_CMATH)
297 #define simde_math_asinh(v) std::asinh(v)
298 #elif defined(SIMDE_MATH_HAVE_MATH_H)
299 #define simde_math_asinh(v) asinh(v)
300 #endif
301 #endif
302
303 #if !defined(simde_math_asinhf)
304 #if SIMDE_MATH_BUILTIN_LIBM(asinhf)
305 #define simde_math_asinhf(v) __builtin_asinhf(v)
306 #elif defined(SIMDE_MATH_HAVE_CMATH)
307 #define simde_math_asinhf(v) std::asinh(v)
308 #elif defined(SIMDE_MATH_HAVE_MATH_H)
309 #define simde_math_asinhf(v) asinhf(v)
310 #endif
311 #endif
312
313 #if !defined(simde_math_atan)
314 #if SIMDE_MATH_BUILTIN_LIBM(atan)
315 #define simde_math_atan(v) __builtin_atan(v)
316 #elif defined(SIMDE_MATH_HAVE_CMATH)
317 #define simde_math_atan(v) std::atan(v)
318 #elif defined(SIMDE_MATH_HAVE_MATH_H)
319 #define simde_math_atan(v) atan(v)
320 #endif
321 #endif
322
323 #if !defined(simde_math_atan2)
324 #if SIMDE_MATH_BUILTIN_LIBM(atan2)
325 #define simde_math_atan2(y, x) __builtin_atan2(y, x)
326 #elif defined(SIMDE_MATH_HAVE_CMATH)
327 #define simde_math_atan2(y, x) std::atan2(y, x)
328 #elif defined(SIMDE_MATH_HAVE_MATH_H)
329 #define simde_math_atan2(y, x) atan2(y, x)
330 #endif
331 #endif
332
333 #if !defined(simde_math_atan2f)
334 #if SIMDE_MATH_BUILTIN_LIBM(atan2f)
335 #define simde_math_atan2f(y, x) __builtin_atan2f(y, x)
336 #elif defined(SIMDE_MATH_HAVE_CMATH)
337 #define simde_math_atan2f(y, x) std::atan2(y, x)
338 #elif defined(SIMDE_MATH_HAVE_MATH_H)
339 #define simde_math_atan2f(y, x) atan2f(y, x)
340 #endif
341 #endif
342
343 #if !defined(simde_math_atanf)
344 #if SIMDE_MATH_BUILTIN_LIBM(atanf)
345 #define simde_math_atanf(v) __builtin_atanf(v)
346 #elif defined(SIMDE_MATH_HAVE_CMATH)
347 #define simde_math_atanf(v) std::atan(v)
348 #elif defined(SIMDE_MATH_HAVE_MATH_H)
349 #define simde_math_atanf(v) atanf(v)
350 #endif
351 #endif
352
353 #if !defined(simde_math_atanh)
354 #if SIMDE_MATH_BUILTIN_LIBM(atanh)
355 #define simde_math_atanh(v) __builtin_atanh(v)
356 #elif defined(SIMDE_MATH_HAVE_CMATH)
357 #define simde_math_atanh(v) std::atanh(v)
358 #elif defined(SIMDE_MATH_HAVE_MATH_H)
359 #define simde_math_atanh(v) atanh(v)
360 #endif
361 #endif
362
363 #if !defined(simde_math_atanhf)
364 #if SIMDE_MATH_BUILTIN_LIBM(atanhf)
365 #define simde_math_atanhf(v) __builtin_atanhf(v)
366 #elif defined(SIMDE_MATH_HAVE_CMATH)
367 #define simde_math_atanhf(v) std::atanh(v)
368 #elif defined(SIMDE_MATH_HAVE_MATH_H)
369 #define simde_math_atanhf(v) atanhf(v)
370 #endif
371 #endif
372
373 #if !defined(simde_math_cbrt)
374 #if SIMDE_MATH_BUILTIN_LIBM(cbrt)
375 #define simde_math_cbrt(v) __builtin_cbrt(v)
376 #elif defined(SIMDE_MATH_HAVE_CMATH)
377 #define simde_math_cbrt(v) std::cbrt(v)
378 #elif defined(SIMDE_MATH_HAVE_MATH_H)
379 #define simde_math_cbrt(v) cbrt(v)
380 #endif
381 #endif
382
383 #if !defined(simde_math_cbrtf)
384 #if SIMDE_MATH_BUILTIN_LIBM(cbrtf)
385 #define simde_math_cbrtf(v) __builtin_cbrtf(v)
386 #elif defined(SIMDE_MATH_HAVE_CMATH)
387 #define simde_math_cbrtf(v) std::cbrt(v)
388 #elif defined(SIMDE_MATH_HAVE_MATH_H)
389 #define simde_math_cbrtf(v) cbrtf(v)
390 #endif
391 #endif
392
393 #if !defined(simde_math_ceil)
394 #if SIMDE_MATH_BUILTIN_LIBM(ceil)
395 #define simde_math_ceil(v) __builtin_ceil(v)
396 #elif defined(SIMDE_MATH_HAVE_CMATH)
397 #define simde_math_ceil(v) std::ceil(v)
398 #elif defined(SIMDE_MATH_HAVE_MATH_H)
399 #define simde_math_ceil(v) ceil(v)
400 #endif
401 #endif
402
403 #if !defined(simde_math_ceilf)
404 #if SIMDE_MATH_BUILTIN_LIBM(ceilf)
405 #define simde_math_ceilf(v) __builtin_ceilf(v)
406 #elif defined(SIMDE_MATH_HAVE_CMATH)
407 #define simde_math_ceilf(v) std::ceil(v)
408 #elif defined(SIMDE_MATH_HAVE_MATH_H)
409 #define simde_math_ceilf(v) ceilf(v)
410 #endif
411 #endif
412
413 #if !defined(simde_math_copysign)
414 #if SIMDE_MATH_BUILTIN_LIBM(copysign)
415 #define simde_math_copysign(x, y) __builtin_copysign(x, y)
416 #elif defined(SIMDE_MATH_HAVE_CMATH)
417 #define simde_math_copysign(x, y) std::copysign(x, y)
418 #elif defined(SIMDE_MATH_HAVE_MATH_H)
419 #define simde_math_copysign(x, y) copysign(x, y)
420 #endif
421 #endif
422
423 #if !defined(simde_math_copysignf)
424 #if SIMDE_MATH_BUILTIN_LIBM(copysignf)
425 #define simde_math_copysignf(x, y) __builtin_copysignf(x, y)
426 #elif defined(SIMDE_MATH_HAVE_CMATH)
427 #define simde_math_copysignf(x, y) std::copysignf(x, y)
428 #elif defined(SIMDE_MATH_HAVE_MATH_H)
429 #define simde_math_copysignf(x, y) copysignf(x, y)
430 #endif
431 #endif
432
433 #if !defined(simde_math_cos)
434 #if SIMDE_MATH_BUILTIN_LIBM(cos)
435 #define simde_math_cos(v) __builtin_cos(v)
436 #elif defined(SIMDE_MATH_HAVE_CMATH)
437 #define simde_math_cos(v) std::cos(v)
438 #elif defined(SIMDE_MATH_HAVE_MATH_H)
439 #define simde_math_cos(v) cos(v)
440 #endif
441 #endif
442
443 #if !defined(simde_math_cosf)
444 #if SIMDE_MATH_BUILTIN_LIBM(cosf)
445 #define simde_math_cosf(v) __builtin_cosf(v)
446 #elif defined(SIMDE_MATH_HAVE_CMATH)
447 #define simde_math_cosf(v) std::cos(v)
448 #elif defined(SIMDE_MATH_HAVE_MATH_H)
449 #define simde_math_cosf(v) cosf(v)
450 #endif
451 #endif
452
453 #if !defined(simde_math_cosh)
454 #if SIMDE_MATH_BUILTIN_LIBM(cosh)
455 #define simde_math_cosh(v) __builtin_cosh(v)
456 #elif defined(SIMDE_MATH_HAVE_CMATH)
457 #define simde_math_cosh(v) std::cosh(v)
458 #elif defined(SIMDE_MATH_HAVE_MATH_H)
459 #define simde_math_cosh(v) cosh(v)
460 #endif
461 #endif
462
463 #if !defined(simde_math_coshf)
464 #if SIMDE_MATH_BUILTIN_LIBM(coshf)
465 #define simde_math_coshf(v) __builtin_coshf(v)
466 #elif defined(SIMDE_MATH_HAVE_CMATH)
467 #define simde_math_coshf(v) std::cosh(v)
468 #elif defined(SIMDE_MATH_HAVE_MATH_H)
469 #define simde_math_coshf(v) coshf(v)
470 #endif
471 #endif
472
473 #if !defined(simde_math_erf)
474 #if SIMDE_MATH_BUILTIN_LIBM(erf)
475 #define simde_math_erf(v) __builtin_erf(v)
476 #elif defined(SIMDE_MATH_HAVE_CMATH)
477 #define simde_math_erf(v) std::erf(v)
478 #elif defined(SIMDE_MATH_HAVE_MATH_H)
479 #define simde_math_erf(v) erf(v)
480 #endif
481 #endif
482
483 #if !defined(simde_math_erff)
484 #if SIMDE_MATH_BUILTIN_LIBM(erff)
485 #define simde_math_erff(v) __builtin_erff(v)
486 #elif defined(SIMDE_MATH_HAVE_CMATH)
487 #define simde_math_erff(v) std::erf(v)
488 #elif defined(SIMDE_MATH_HAVE_MATH_H)
489 #define simde_math_erff(v) erff(v)
490 #endif
491 #endif
492
493 #if !defined(simde_math_erfc)
494 #if SIMDE_MATH_BUILTIN_LIBM(erfc)
495 #define simde_math_erfc(v) __builtin_erfc(v)
496 #elif defined(SIMDE_MATH_HAVE_CMATH)
497 #define simde_math_erfc(v) std::erfc(v)
498 #elif defined(SIMDE_MATH_HAVE_MATH_H)
499 #define simde_math_erfc(v) erfc(v)
500 #endif
501 #endif
502
503 #if !defined(simde_math_erfcf)
504 #if SIMDE_MATH_BUILTIN_LIBM(erfcf)
505 #define simde_math_erfcf(v) __builtin_erfcf(v)
506 #elif defined(SIMDE_MATH_HAVE_CMATH)
507 #define simde_math_erfcf(v) std::erfc(v)
508 #elif defined(SIMDE_MATH_HAVE_MATH_H)
509 #define simde_math_erfcf(v) erfcf(v)
510 #endif
511 #endif
512
513 #if !defined(simde_math_exp)
514 #if SIMDE_MATH_BUILTIN_LIBM(exp)
515 #define simde_math_exp(v) __builtin_exp(v)
516 #elif defined(SIMDE_MATH_HAVE_CMATH)
517 #define simde_math_exp(v) std::exp(v)
518 #elif defined(SIMDE_MATH_HAVE_MATH_H)
519 #define simde_math_exp(v) exp(v)
520 #endif
521 #endif
522
523 #if !defined(simde_math_expf)
524 #if SIMDE_MATH_BUILTIN_LIBM(expf)
525 #define simde_math_expf(v) __builtin_expf(v)
526 #elif defined(SIMDE_MATH_HAVE_CMATH)
527 #define simde_math_expf(v) std::exp(v)
528 #elif defined(SIMDE_MATH_HAVE_MATH_H)
529 #define simde_math_expf(v) expf(v)
530 #endif
531 #endif
532
533 #if !defined(simde_math_expm1)
534 #if SIMDE_MATH_BUILTIN_LIBM(expm1)
535 #define simde_math_expm1(v) __builtin_expm1(v)
536 #elif defined(SIMDE_MATH_HAVE_CMATH)
537 #define simde_math_expm1(v) std::expm1(v)
538 #elif defined(SIMDE_MATH_HAVE_MATH_H)
539 #define simde_math_expm1(v) expm1(v)
540 #endif
541 #endif
542
543 #if !defined(simde_math_expm1f)
544 #if SIMDE_MATH_BUILTIN_LIBM(expm1f)
545 #define simde_math_expm1f(v) __builtin_expm1f(v)
546 #elif defined(SIMDE_MATH_HAVE_CMATH)
547 #define simde_math_expm1f(v) std::expm1(v)
548 #elif defined(SIMDE_MATH_HAVE_MATH_H)
549 #define simde_math_expm1f(v) expm1f(v)
550 #endif
551 #endif
552
553 #if !defined(simde_math_exp2)
554 #if SIMDE_MATH_BUILTIN_LIBM(exp2)
555 #define simde_math_exp2(v) __builtin_exp2(v)
556 #elif defined(SIMDE_MATH_HAVE_CMATH)
557 #define simde_math_exp2(v) std::exp2(v)
558 #elif defined(SIMDE_MATH_HAVE_MATH_H)
559 #define simde_math_exp2(v) exp2(v)
560 #endif
561 #endif
562
563 #if !defined(simde_math_exp2f)
564 #if SIMDE_MATH_BUILTIN_LIBM(exp2f)
565 #define simde_math_exp2f(v) __builtin_exp2f(v)
566 #elif defined(SIMDE_MATH_HAVE_CMATH)
567 #define simde_math_exp2f(v) std::exp2(v)
568 #elif defined(SIMDE_MATH_HAVE_MATH_H)
569 #define simde_math_exp2f(v) exp2f(v)
570 #endif
571 #endif
572
573 #if HEDLEY_HAS_BUILTIN(__builtin_exp10) || HEDLEY_GCC_VERSION_CHECK(3,4,0)
574 # define simde_math_exp10(v) __builtin_exp10(v)
575 #else
576 # define simde_math_exp10(v) pow(10.0, (v))
577 #endif
578
579 #if HEDLEY_HAS_BUILTIN(__builtin_exp10f) || HEDLEY_GCC_VERSION_CHECK(3,4,0)
580 # define simde_math_exp10f(v) __builtin_exp10f(v)
581 #else
582 # define simde_math_exp10f(v) powf(10.0f, (v))
583 #endif
584
585 #if !defined(simde_math_fabs)
586 #if SIMDE_MATH_BUILTIN_LIBM(fabs)
587 #define simde_math_fabs(v) __builtin_fabs(v)
588 #elif defined(SIMDE_MATH_HAVE_CMATH)
589 #define simde_math_fabs(v) std::fabs(v)
590 #elif defined(SIMDE_MATH_HAVE_MATH_H)
591 #define simde_math_fabs(v) fabs(v)
592 #endif
593 #endif
594
595 #if !defined(simde_math_fabsf)
596 #if SIMDE_MATH_BUILTIN_LIBM(fabsf)
597 #define simde_math_fabsf(v) __builtin_fabsf(v)
598 #elif defined(SIMDE_MATH_HAVE_CMATH)
599 #define simde_math_fabsf(v) std::fabs(v)
600 #elif defined(SIMDE_MATH_HAVE_MATH_H)
601 #define simde_math_fabsf(v) fabsf(v)
602 #endif
603 #endif
604
605 #if !defined(simde_math_floor)
606 #if SIMDE_MATH_BUILTIN_LIBM(floor)
607 #define simde_math_floor(v) __builtin_floor(v)
608 #elif defined(SIMDE_MATH_HAVE_CMATH)
609 #define simde_math_floor(v) std::floor(v)
610 #elif defined(SIMDE_MATH_HAVE_MATH_H)
611 #define simde_math_floor(v) floor(v)
612 #endif
613 #endif
614
615 #if !defined(simde_math_floorf)
616 #if SIMDE_MATH_BUILTIN_LIBM(floorf)
617 #define simde_math_floorf(v) __builtin_floorf(v)
618 #elif defined(SIMDE_MATH_HAVE_CMATH)
619 #define simde_math_floorf(v) std::floor(v)
620 #elif defined(SIMDE_MATH_HAVE_MATH_H)
621 #define simde_math_floorf(v) floorf(v)
622 #endif
623 #endif
624
625 #if !defined(simde_math_hypot)
626 #if SIMDE_MATH_BUILTIN_LIBM(hypot)
627 #define simde_math_hypot(y, x) __builtin_hypot(y, x)
628 #elif defined(SIMDE_MATH_HAVE_CMATH)
629 #define simde_math_hypot(y, x) std::hypot(y, x)
630 #elif defined(SIMDE_MATH_HAVE_MATH_H)
631 #define simde_math_hypot(y, x) hypot(y, x)
632 #endif
633 #endif
634
635 #if !defined(simde_math_hypotf)
636 #if SIMDE_MATH_BUILTIN_LIBM(hypotf)
637 #define simde_math_hypotf(y, x) __builtin_hypotf(y, x)
638 #elif defined(SIMDE_MATH_HAVE_CMATH)
639 #define simde_math_hypotf(y, x) std::hypot(y, x)
640 #elif defined(SIMDE_MATH_HAVE_MATH_H)
641 #define simde_math_hypotf(y, x) hypotf(y, x)
642 #endif
643 #endif
644
645 #if !defined(simde_math_log)
646 #if SIMDE_MATH_BUILTIN_LIBM(log)
647 #define simde_math_log(v) __builtin_log(v)
648 #elif defined(SIMDE_MATH_HAVE_CMATH)
649 #define simde_math_log(v) std::log(v)
650 #elif defined(SIMDE_MATH_HAVE_MATH_H)
651 #define simde_math_log(v) log(v)
652 #endif
653 #endif
654
655 #if !defined(simde_math_logf)
656 #if SIMDE_MATH_BUILTIN_LIBM(logf)
657 #define simde_math_logf(v) __builtin_logf(v)
658 #elif defined(SIMDE_MATH_HAVE_CMATH)
659 #define simde_math_logf(v) std::log(v)
660 #elif defined(SIMDE_MATH_HAVE_MATH_H)
661 #define simde_math_logf(v) logf(v)
662 #endif
663 #endif
664
665 #if !defined(simde_math_logb)
666 #if SIMDE_MATH_BUILTIN_LIBM(logb)
667 #define simde_math_logb(v) __builtin_logb(v)
668 #elif defined(SIMDE_MATH_HAVE_CMATH)
669 #define simde_math_logb(v) std::logb(v)
670 #elif defined(SIMDE_MATH_HAVE_MATH_H)
671 #define simde_math_logb(v) logb(v)
672 #endif
673 #endif
674
675 #if !defined(simde_math_logbf)
676 #if SIMDE_MATH_BUILTIN_LIBM(logbf)
677 #define simde_math_logbf(v) __builtin_logbf(v)
678 #elif defined(SIMDE_MATH_HAVE_CMATH)
679 #define simde_math_logbf(v) std::logb(v)
680 #elif defined(SIMDE_MATH_HAVE_MATH_H)
681 #define simde_math_logbf(v) logbf(v)
682 #endif
683 #endif
684
685 #if !defined(simde_math_log1p)
686 #if SIMDE_MATH_BUILTIN_LIBM(log1p)
687 #define simde_math_log1p(v) __builtin_log1p(v)
688 #elif defined(SIMDE_MATH_HAVE_CMATH)
689 #define simde_math_log1p(v) std::log1p(v)
690 #elif defined(SIMDE_MATH_HAVE_MATH_H)
691 #define simde_math_log1p(v) log1p(v)
692 #endif
693 #endif
694
695 #if !defined(simde_math_log1pf)
696 #if SIMDE_MATH_BUILTIN_LIBM(log1pf)
697 #define simde_math_log1pf(v) __builtin_log1pf(v)
698 #elif defined(SIMDE_MATH_HAVE_CMATH)
699 #define simde_math_log1pf(v) std::log1p(v)
700 #elif defined(SIMDE_MATH_HAVE_MATH_H)
701 #define simde_math_log1pf(v) log1pf(v)
702 #endif
703 #endif
704
705 #if !defined(simde_math_log2)
706 #if SIMDE_MATH_BUILTIN_LIBM(log2)
707 #define simde_math_log2(v) __builtin_log2(v)
708 #elif defined(SIMDE_MATH_HAVE_CMATH)
709 #define simde_math_log2(v) std::log2(v)
710 #elif defined(SIMDE_MATH_HAVE_MATH_H)
711 #define simde_math_log2(v) log2(v)
712 #endif
713 #endif
714
715 #if !defined(simde_math_log2f)
716 #if SIMDE_MATH_BUILTIN_LIBM(log2f)
717 #define simde_math_log2f(v) __builtin_log2f(v)
718 #elif defined(SIMDE_MATH_HAVE_CMATH)
719 #define simde_math_log2f(v) std::log2(v)
720 #elif defined(SIMDE_MATH_HAVE_MATH_H)
721 #define simde_math_log2f(v) log2f(v)
722 #endif
723 #endif
724
725 #if !defined(simde_math_log10)
726 #if SIMDE_MATH_BUILTIN_LIBM(log10)
727 #define simde_math_log10(v) __builtin_log10(v)
728 #elif defined(SIMDE_MATH_HAVE_CMATH)
729 #define simde_math_log10(v) std::log10(v)
730 #elif defined(SIMDE_MATH_HAVE_MATH_H)
731 #define simde_math_log10(v) log10(v)
732 #endif
733 #endif
734
735 #if !defined(simde_math_log10f)
736 #if SIMDE_MATH_BUILTIN_LIBM(log10f)
737 #define simde_math_log10f(v) __builtin_log10f(v)
738 #elif defined(SIMDE_MATH_HAVE_CMATH)
739 #define simde_math_log10f(v) std::log10(v)
740 #elif defined(SIMDE_MATH_HAVE_MATH_H)
741 #define simde_math_log10f(v) log10f(v)
742 #endif
743 #endif
744
745 #if !defined(simde_math_nearbyint)
746 #if SIMDE_MATH_BUILTIN_LIBM(nearbyint)
747 #define simde_math_nearbyint(v) __builtin_nearbyint(v)
748 #elif defined(SIMDE_MATH_HAVE_CMATH)
749 #define simde_math_nearbyint(v) std::nearbyint(v)
750 #elif defined(SIMDE_MATH_HAVE_MATH_H)
751 #define simde_math_nearbyint(v) nearbyint(v)
752 #endif
753 #endif
754
755 #if !defined(simde_math_nearbyintf)
756 #if SIMDE_MATH_BUILTIN_LIBM(nearbyintf)
757 #define simde_math_nearbyintf(v) __builtin_nearbyintf(v)
758 #elif defined(SIMDE_MATH_HAVE_CMATH)
759 #define simde_math_nearbyintf(v) std::nearbyint(v)
760 #elif defined(SIMDE_MATH_HAVE_MATH_H)
761 #define simde_math_nearbyintf(v) nearbyintf(v)
762 #endif
763 #endif
764
765 #if !defined(simde_math_pow)
766 #if SIMDE_MATH_BUILTIN_LIBM(pow)
767 #define simde_math_pow(y, x) __builtin_pow(y, x)
768 #elif defined(SIMDE_MATH_HAVE_CMATH)
769 #define simde_math_pow(y, x) std::pow(y, x)
770 #elif defined(SIMDE_MATH_HAVE_MATH_H)
771 #define simde_math_pow(y, x) pow(y, x)
772 #endif
773 #endif
774
775 #if !defined(simde_math_powf)
776 #if SIMDE_MATH_BUILTIN_LIBM(powf)
777 #define simde_math_powf(y, x) __builtin_powf(y, x)
778 #elif defined(SIMDE_MATH_HAVE_CMATH)
779 #define simde_math_powf(y, x) std::pow(y, x)
780 #elif defined(SIMDE_MATH_HAVE_MATH_H)
781 #define simde_math_powf(y, x) powf(y, x)
782 #endif
783 #endif
784
785 #if !defined(simde_math_round)
786 #if SIMDE_MATH_BUILTIN_LIBM(round)
787 #define simde_math_round(v) __builtin_round(v)
788 #elif defined(SIMDE_MATH_HAVE_CMATH)
789 #define simde_math_round(v) std::round(v)
790 #elif defined(SIMDE_MATH_HAVE_MATH_H)
791 #define simde_math_round(v) round(v)
792 #endif
793 #endif
794
795 #if !defined(simde_math_roundf)
796 #if SIMDE_MATH_BUILTIN_LIBM(roundf)
797 #define simde_math_roundf(v) __builtin_roundf(v)
798 #elif defined(SIMDE_MATH_HAVE_CMATH)
799 #define simde_math_roundf(v) std::round(v)
800 #elif defined(SIMDE_MATH_HAVE_MATH_H)
801 #define simde_math_roundf(v) roundf(v)
802 #endif
803 #endif
804
805 #if !defined(simde_math_sin)
806 #if SIMDE_MATH_BUILTIN_LIBM(sin)
807 #define simde_math_sin(v) __builtin_sin(v)
808 #elif defined(SIMDE_MATH_HAVE_CMATH)
809 #define simde_math_sin(v) std::sin(v)
810 #elif defined(SIMDE_MATH_HAVE_MATH_H)
811 #define simde_math_sin(v) sin(v)
812 #endif
813 #endif
814
815 #if !defined(simde_math_sinf)
816 #if SIMDE_MATH_BUILTIN_LIBM(sinf)
817 #define simde_math_sinf(v) __builtin_sinf(v)
818 #elif defined(SIMDE_MATH_HAVE_CMATH)
819 #define simde_math_sinf(v) std::sin(v)
820 #elif defined(SIMDE_MATH_HAVE_MATH_H)
821 #define simde_math_sinf(v) sinf(v)
822 #endif
823 #endif
824
825 #if !defined(simde_math_sinh)
826 #if SIMDE_MATH_BUILTIN_LIBM(sinh)
827 #define simde_math_sinh(v) __builtin_sinh(v)
828 #elif defined(SIMDE_MATH_HAVE_CMATH)
829 #define simde_math_sinh(v) std::sinh(v)
830 #elif defined(SIMDE_MATH_HAVE_MATH_H)
831 #define simde_math_sinh(v) sinh(v)
832 #endif
833 #endif
834
835 #if !defined(simde_math_sinhf)
836 #if SIMDE_MATH_BUILTIN_LIBM(sinhf)
837 #define simde_math_sinhf(v) __builtin_sinhf(v)
838 #elif defined(SIMDE_MATH_HAVE_CMATH)
839 #define simde_math_sinhf(v) std::sinh(v)
840 #elif defined(SIMDE_MATH_HAVE_MATH_H)
841 #define simde_math_sinhf(v) sinhf(v)
842 #endif
843 #endif
844
845 #if !defined(simde_math_sqrt)
846 #if SIMDE_MATH_BUILTIN_LIBM(sqrt)
847 #define simde_math_sqrt(v) __builtin_sqrt(v)
848 #elif defined(SIMDE_MATH_HAVE_CMATH)
849 #define simde_math_sqrt(v) std::sqrt(v)
850 #elif defined(SIMDE_MATH_HAVE_MATH_H)
851 #define simde_math_sqrt(v) sqrt(v)
852 #endif
853 #endif
854
855 #if !defined(simde_math_sqrtf)
856 #if SIMDE_MATH_BUILTIN_LIBM(sqrtf)
857 #define simde_math_sqrtf(v) __builtin_sqrtf(v)
858 #elif defined(SIMDE_MATH_HAVE_CMATH)
859 #define simde_math_sqrtf(v) std::sqrt(v)
860 #elif defined(SIMDE_MATH_HAVE_MATH_H)
861 #define simde_math_sqrtf(v) sqrtf(v)
862 #endif
863 #endif
864
865 #if !defined(simde_math_tan)
866 #if SIMDE_MATH_BUILTIN_LIBM(tan)
867 #define simde_math_tan(v) __builtin_tan(v)
868 #elif defined(SIMDE_MATH_HAVE_CMATH)
869 #define simde_math_tan(v) std::tan(v)
870 #elif defined(SIMDE_MATH_HAVE_MATH_H)
871 #define simde_math_tan(v) tan(v)
872 #endif
873 #endif
874
875 #if !defined(simde_math_tanf)
876 #if SIMDE_MATH_BUILTIN_LIBM(tanf)
877 #define simde_math_tanf(v) __builtin_tanf(v)
878 #elif defined(SIMDE_MATH_HAVE_CMATH)
879 #define simde_math_tanf(v) std::tan(v)
880 #elif defined(SIMDE_MATH_HAVE_MATH_H)
881 #define simde_math_tanf(v) tanf(v)
882 #endif
883 #endif
884
885 #if !defined(simde_math_tanh)
886 #if SIMDE_MATH_BUILTIN_LIBM(tanh)
887 #define simde_math_tanh(v) __builtin_tanh(v)
888 #elif defined(SIMDE_MATH_HAVE_CMATH)
889 #define simde_math_tanh(v) std::tanh(v)
890 #elif defined(SIMDE_MATH_HAVE_MATH_H)
891 #define simde_math_tanh(v) tanh(v)
892 #endif
893 #endif
894
895 #if !defined(simde_math_tanhf)
896 #if SIMDE_MATH_BUILTIN_LIBM(tanhf)
897 #define simde_math_tanhf(v) __builtin_tanhf(v)
898 #elif defined(SIMDE_MATH_HAVE_CMATH)
899 #define simde_math_tanhf(v) std::tanh(v)
900 #elif defined(SIMDE_MATH_HAVE_MATH_H)
901 #define simde_math_tanhf(v) tanhf(v)
902 #endif
903 #endif
904
905 #if !defined(simde_math_trunc)
906 #if SIMDE_MATH_BUILTIN_LIBM(trunc)
907 #define simde_math_trunc(v) __builtin_trunc(v)
908 #elif defined(SIMDE_MATH_HAVE_CMATH)
909 #define simde_math_trunc(v) std::trunc(v)
910 #elif defined(SIMDE_MATH_HAVE_MATH_H)
911 #define simde_math_trunc(v) trunc(v)
912 #endif
913 #endif
914
915 #if !defined(simde_math_truncf)
916 #if SIMDE_MATH_BUILTIN_LIBM(truncf)
917 #define simde_math_truncf(v) __builtin_truncf(v)
918 #elif defined(SIMDE_MATH_HAVE_CMATH)
919 #define simde_math_truncf(v) std::trunc(v)
920 #elif defined(SIMDE_MATH_HAVE_MATH_H)
921 #define simde_math_truncf(v) truncf(v)
922 #endif
923 #endif
924
925 /*** Additional functions not in libm ***/
926
927 #if defined(simde_math_fabs) && defined(simde_math_sqrt) && defined(simde_math_exp)
928 static HEDLEY_INLINE
929 double
simde_math_cdfnorm(double x)930 simde_math_cdfnorm(double x) {
931 /* https://www.johndcook.com/blog/cpp_phi/
932 * Public Domain */
933 static const double a1 = 0.254829592;
934 static const double a2 = -0.284496736;
935 static const double a3 = 1.421413741;
936 static const double a4 = -1.453152027;
937 static const double a5 = 1.061405429;
938 static const double p = 0.3275911;
939
940 const int sign = x < 0;
941 x = simde_math_fabs(x) / simde_math_sqrt(2.0);
942
943 /* A&S formula 7.1.26 */
944 double t = 1.0 / (1.0 + p * x);
945 double y = 1.0 - (((((a5 * t + a4) * t) + a3) * t + a2) * t + a1) * t * simde_math_exp(-x * x);
946
947 return 0.5 * (1.0 + (sign ? -y : y));
948 }
949 #define simde_math_cdfnorm simde_math_cdfnorm
950 #endif
951
952 #if defined(simde_math_fabsf) && defined(simde_math_sqrtf) && defined(simde_math_expf)
953 static HEDLEY_INLINE
954 float
simde_math_cdfnormf(float x)955 simde_math_cdfnormf(float x) {
956 /* https://www.johndcook.com/blog/cpp_phi/
957 * Public Domain */
958 static const float a1 = 0.254829592f;
959 static const float a2 = -0.284496736f;
960 static const float a3 = 1.421413741f;
961 static const float a4 = -1.453152027f;
962 static const float a5 = 1.061405429f;
963 static const float p = 0.3275911f;
964
965 const int sign = x < 0;
966 x = simde_math_fabsf(x) / simde_math_sqrtf(2.0f);
967
968 /* A&S formula 7.1.26 */
969 float t = 1.0f / (1.0f + p * x);
970 float y = 1.0f - (((((a5 * t + a4) * t) + a3) * t + a2) * t + a1) * t * simde_math_expf(-x * x);
971
972 return 0.5f * (1.0f + (sign ? -y : y));
973 }
974 #define simde_math_cdfnormf simde_math_cdfnormf
975 #endif
976
977 #if !defined(simde_math_erfinvf) && defined(simde_math_logf) && defined(simde_math_copysignf) && defined(simde_math_sqrtf)
978 static HEDLEY_INLINE
979 float
simde_math_erfinvf(float x)980 simde_math_erfinvf(float x) {
981 /* https://stackoverflow.com/questions/27229371/inverse-error-function-in-c */
982 float tt1, tt2, lnx;
983 float sgn = simde_math_copysignf(1.0f, x);
984
985 x = (1.0f - x) * (1.0f + x);
986 lnx = simde_math_logf(x);
987
988 tt1 = 2.0f / (HEDLEY_STATIC_CAST(float, SIMDE_MATH_PI) * 0.147f) + 0.5f * lnx;
989 tt2 = (1.0f / 0.147f) * lnx;
990
991 return sgn * simde_math_sqrtf(-tt1 + simde_math_sqrtf(tt1 * tt1 - tt2));
992 }
993 #define simde_math_erfinvf simde_math_erfinvf
994 #endif
995
996 #if !defined(simde_math_erfinv) && defined(simde_math_log) && defined(simde_math_copysign) && defined(simde_math_sqrt)
997 static HEDLEY_INLINE
998 double
simde_math_erfinv(double x)999 simde_math_erfinv(double x) {
1000 /* https://stackoverflow.com/questions/27229371/inverse-error-function-in-c */
1001 double tt1, tt2, lnx;
1002 double sgn = simde_math_copysign(1.0, x);
1003
1004 x = (1.0 - x) * (1.0 + x);
1005 lnx = simde_math_log(x);
1006
1007 tt1 = 2.0 / (SIMDE_MATH_PI * 0.147) + 0.5 * lnx;
1008 tt2 = (1.0 / 0.147) * lnx;
1009
1010 return sgn * simde_math_sqrt(-tt1 + simde_math_sqrt(tt1 * tt1 - tt2));
1011 }
1012 #define simde_math_erfinvf simde_math_erfinvf
1013 #endif
1014
1015 static HEDLEY_INLINE
1016 double
simde_math_rad2deg(double radians)1017 simde_math_rad2deg(double radians) {
1018 return radians * (180.0 / SIMDE_MATH_PI);
1019 }
1020
1021 static HEDLEY_INLINE
1022 double
simde_math_deg2rad(double degrees)1023 simde_math_deg2rad(double degrees) {
1024 return degrees * (SIMDE_MATH_PI / 180.0);
1025 }
1026
1027 static HEDLEY_INLINE
1028 float
simde_math_rad2degf(float radians)1029 simde_math_rad2degf(float radians) {
1030 return radians * (180.0f / HEDLEY_STATIC_CAST(float, SIMDE_MATH_PI));
1031 }
1032
1033 static HEDLEY_INLINE
1034 float
simde_math_deg2radf(float degrees)1035 simde_math_deg2radf(float degrees) {
1036 return degrees * (HEDLEY_STATIC_CAST(float, SIMDE_MATH_PI) / 180.0f);
1037 }
1038
1039 #endif /* !defined(SIMDE_MATH_H) */
1040