blob: ac57360cca9ec39f86751b9e61ae701b489711ba [file] [log] [blame]
Richard Smith081bb592015-10-08 20:40:34 +00001// -*- C++ -*-
Louis Dionne9bd93882021-11-17 16:25:01 -05002//===----------------------------------------------------------------------===//
Richard Smith081bb592015-10-08 20:40:34 +00003//
Chandler Carruthd2012102019-01-19 10:56:40 +00004// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5// See https://llvm.org/LICENSE.txt for license information.
6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
Richard Smith081bb592015-10-08 20:40:34 +00007//
8//===----------------------------------------------------------------------===//
9
10#ifndef _LIBCPP_MATH_H
11#define _LIBCPP_MATH_H
12
13/*
14 math.h synopsis
15
16Macros:
17
18 HUGE_VAL
19 HUGE_VALF // C99
20 HUGE_VALL // C99
21 INFINITY // C99
22 NAN // C99
23 FP_INFINITE // C99
24 FP_NAN // C99
25 FP_NORMAL // C99
26 FP_SUBNORMAL // C99
27 FP_ZERO // C99
28 FP_FAST_FMA // C99
29 FP_FAST_FMAF // C99
30 FP_FAST_FMAL // C99
31 FP_ILOGB0 // C99
32 FP_ILOGBNAN // C99
33 MATH_ERRNO // C99
34 MATH_ERREXCEPT // C99
35 math_errhandling // C99
36
37Types:
38
39 float_t // C99
40 double_t // C99
41
42// C90
43
44floating_point abs(floating_point x);
45
46floating_point acos (arithmetic x);
47float acosf(float x);
48long double acosl(long double x);
49
50floating_point asin (arithmetic x);
51float asinf(float x);
52long double asinl(long double x);
53
54floating_point atan (arithmetic x);
55float atanf(float x);
56long double atanl(long double x);
57
58floating_point atan2 (arithmetic y, arithmetic x);
59float atan2f(float y, float x);
60long double atan2l(long double y, long double x);
61
62floating_point ceil (arithmetic x);
63float ceilf(float x);
64long double ceill(long double x);
65
66floating_point cos (arithmetic x);
67float cosf(float x);
68long double cosl(long double x);
69
70floating_point cosh (arithmetic x);
71float coshf(float x);
72long double coshl(long double x);
73
74floating_point exp (arithmetic x);
75float expf(float x);
76long double expl(long double x);
77
78floating_point fabs (arithmetic x);
79float fabsf(float x);
80long double fabsl(long double x);
81
82floating_point floor (arithmetic x);
83float floorf(float x);
84long double floorl(long double x);
85
86floating_point fmod (arithmetic x, arithmetic y);
87float fmodf(float x, float y);
88long double fmodl(long double x, long double y);
89
90floating_point frexp (arithmetic value, int* exp);
91float frexpf(float value, int* exp);
92long double frexpl(long double value, int* exp);
93
94floating_point ldexp (arithmetic value, int exp);
95float ldexpf(float value, int exp);
96long double ldexpl(long double value, int exp);
97
98floating_point log (arithmetic x);
99float logf(float x);
100long double logl(long double x);
101
102floating_point log10 (arithmetic x);
103float log10f(float x);
104long double log10l(long double x);
105
106floating_point modf (floating_point value, floating_point* iptr);
107float modff(float value, float* iptr);
108long double modfl(long double value, long double* iptr);
109
110floating_point pow (arithmetic x, arithmetic y);
111float powf(float x, float y);
112long double powl(long double x, long double y);
113
114floating_point sin (arithmetic x);
115float sinf(float x);
116long double sinl(long double x);
117
118floating_point sinh (arithmetic x);
119float sinhf(float x);
120long double sinhl(long double x);
121
122floating_point sqrt (arithmetic x);
123float sqrtf(float x);
124long double sqrtl(long double x);
125
126floating_point tan (arithmetic x);
127float tanf(float x);
128long double tanl(long double x);
129
130floating_point tanh (arithmetic x);
131float tanhf(float x);
132long double tanhl(long double x);
133
134// C99
135
136bool signbit(arithmetic x);
137
138int fpclassify(arithmetic x);
139
140bool isfinite(arithmetic x);
141bool isinf(arithmetic x);
142bool isnan(arithmetic x);
143bool isnormal(arithmetic x);
144
145bool isgreater(arithmetic x, arithmetic y);
146bool isgreaterequal(arithmetic x, arithmetic y);
147bool isless(arithmetic x, arithmetic y);
148bool islessequal(arithmetic x, arithmetic y);
149bool islessgreater(arithmetic x, arithmetic y);
150bool isunordered(arithmetic x, arithmetic y);
151
152floating_point acosh (arithmetic x);
153float acoshf(float x);
154long double acoshl(long double x);
155
156floating_point asinh (arithmetic x);
157float asinhf(float x);
158long double asinhl(long double x);
159
160floating_point atanh (arithmetic x);
161float atanhf(float x);
162long double atanhl(long double x);
163
164floating_point cbrt (arithmetic x);
165float cbrtf(float x);
166long double cbrtl(long double x);
167
168floating_point copysign (arithmetic x, arithmetic y);
169float copysignf(float x, float y);
170long double copysignl(long double x, long double y);
171
172floating_point erf (arithmetic x);
173float erff(float x);
174long double erfl(long double x);
175
176floating_point erfc (arithmetic x);
177float erfcf(float x);
178long double erfcl(long double x);
179
180floating_point exp2 (arithmetic x);
181float exp2f(float x);
182long double exp2l(long double x);
183
184floating_point expm1 (arithmetic x);
185float expm1f(float x);
186long double expm1l(long double x);
187
188floating_point fdim (arithmetic x, arithmetic y);
189float fdimf(float x, float y);
190long double fdiml(long double x, long double y);
191
192floating_point fma (arithmetic x, arithmetic y, arithmetic z);
193float fmaf(float x, float y, float z);
194long double fmal(long double x, long double y, long double z);
195
196floating_point fmax (arithmetic x, arithmetic y);
197float fmaxf(float x, float y);
198long double fmaxl(long double x, long double y);
199
200floating_point fmin (arithmetic x, arithmetic y);
201float fminf(float x, float y);
202long double fminl(long double x, long double y);
203
204floating_point hypot (arithmetic x, arithmetic y);
205float hypotf(float x, float y);
206long double hypotl(long double x, long double y);
207
208int ilogb (arithmetic x);
209int ilogbf(float x);
210int ilogbl(long double x);
211
212floating_point lgamma (arithmetic x);
213float lgammaf(float x);
214long double lgammal(long double x);
215
216long long llrint (arithmetic x);
217long long llrintf(float x);
218long long llrintl(long double x);
219
220long long llround (arithmetic x);
221long long llroundf(float x);
222long long llroundl(long double x);
223
224floating_point log1p (arithmetic x);
225float log1pf(float x);
226long double log1pl(long double x);
227
228floating_point log2 (arithmetic x);
229float log2f(float x);
230long double log2l(long double x);
231
232floating_point logb (arithmetic x);
233float logbf(float x);
234long double logbl(long double x);
235
236long lrint (arithmetic x);
237long lrintf(float x);
238long lrintl(long double x);
239
240long lround (arithmetic x);
241long lroundf(float x);
242long lroundl(long double x);
243
244double nan (const char* str);
245float nanf(const char* str);
246long double nanl(const char* str);
247
248floating_point nearbyint (arithmetic x);
249float nearbyintf(float x);
250long double nearbyintl(long double x);
251
252floating_point nextafter (arithmetic x, arithmetic y);
253float nextafterf(float x, float y);
254long double nextafterl(long double x, long double y);
255
256floating_point nexttoward (arithmetic x, long double y);
257float nexttowardf(float x, long double y);
258long double nexttowardl(long double x, long double y);
259
260floating_point remainder (arithmetic x, arithmetic y);
261float remainderf(float x, float y);
262long double remainderl(long double x, long double y);
263
264floating_point remquo (arithmetic x, arithmetic y, int* pquo);
265float remquof(float x, float y, int* pquo);
266long double remquol(long double x, long double y, int* pquo);
267
268floating_point rint (arithmetic x);
269float rintf(float x);
270long double rintl(long double x);
271
272floating_point round (arithmetic x);
273float roundf(float x);
274long double roundl(long double x);
275
276floating_point scalbln (arithmetic x, long ex);
277float scalblnf(float x, long ex);
278long double scalblnl(long double x, long ex);
279
280floating_point scalbn (arithmetic x, int ex);
281float scalbnf(float x, int ex);
282long double scalbnl(long double x, int ex);
283
284floating_point tgamma (arithmetic x);
285float tgammaf(float x);
286long double tgammal(long double x);
287
288floating_point trunc (arithmetic x);
289float truncf(float x);
290long double truncl(long double x);
291
292*/
293
294#include <__config>
Richard Smith081bb592015-10-08 20:40:34 +0000295
296#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
Arthur O'Dwyer6eeaa002022-02-01 20:16:40 -0500297# pragma GCC system_header
Richard Smith081bb592015-10-08 20:40:34 +0000298#endif
299
Mikhail Maltsev34b4f972018-02-22 09:34:08 +0000300#include_next <math.h>
301
Richard Smith081bb592015-10-08 20:40:34 +0000302#ifdef __cplusplus
303
304// We support including .h headers inside 'extern "C"' contexts, so switch
305// back to C++ linkage before including these C++ headers.
306extern "C++" {
307
Nikolas Klauser6c8f7122022-07-24 16:03:12 +0200308#include <__type_traits/promote.h>
Arthur O'Dwyer65077c02022-01-07 09:45:05 -0500309#include <limits>
Eric Fiselier6c9e1a72020-02-15 18:55:07 -0500310#include <stdlib.h>
Richard Smith081bb592015-10-08 20:40:34 +0000311#include <type_traits>
312
Richard Smith081bb592015-10-08 20:40:34 +0000313// signbit
314
315#ifdef signbit
316
317template <class _A1>
Nikolas Klauser4956e722022-10-12 15:41:22 +0200318_LIBCPP_HIDE_FROM_ABI
Richard Smith081bb592015-10-08 20:40:34 +0000319bool
Nikolas Klauser9806f452022-10-12 15:45:09 +0200320__libcpp_signbit(_A1 __x) _NOEXCEPT
Richard Smith081bb592015-10-08 20:40:34 +0000321{
Ilya Tokarc3abffb2021-02-10 13:05:19 -0500322#if __has_builtin(__builtin_signbit)
Nikolas Klauser9806f452022-10-12 15:45:09 +0200323 return __builtin_signbit(__x);
Ilya Tokarc3abffb2021-02-10 13:05:19 -0500324#else
Nikolas Klauser9806f452022-10-12 15:45:09 +0200325 return signbit(__x);
Ilya Tokarc3abffb2021-02-10 13:05:19 -0500326#endif
Richard Smith081bb592015-10-08 20:40:34 +0000327}
328
329#undef signbit
330
331template <class _A1>
Nikolas Klauser4956e722022-10-12 15:41:22 +0200332inline _LIBCPP_HIDE_FROM_ABI
Duncan P. N. Exon Smith321d6bf2017-04-21 23:14:55 +0000333typename std::enable_if<std::is_floating_point<_A1>::value, bool>::type
Nikolas Klauser9806f452022-10-12 15:45:09 +0200334signbit(_A1 __x) _NOEXCEPT
Richard Smith081bb592015-10-08 20:40:34 +0000335{
Nikolas Klauser9806f452022-10-12 15:45:09 +0200336 return __libcpp_signbit((typename std::__promote<_A1>::type)__x);
Richard Smith081bb592015-10-08 20:40:34 +0000337}
338
Duncan P. N. Exon Smith321d6bf2017-04-21 23:14:55 +0000339template <class _A1>
Nikolas Klauser4956e722022-10-12 15:41:22 +0200340inline _LIBCPP_HIDE_FROM_ABI
Duncan P. N. Exon Smith321d6bf2017-04-21 23:14:55 +0000341typename std::enable_if<
342 std::is_integral<_A1>::value && std::is_signed<_A1>::value, bool>::type
Nikolas Klauser9806f452022-10-12 15:45:09 +0200343signbit(_A1 __x) _NOEXCEPT
344{ return __x < 0; }
Duncan P. N. Exon Smith321d6bf2017-04-21 23:14:55 +0000345
346template <class _A1>
Nikolas Klauser4956e722022-10-12 15:41:22 +0200347inline _LIBCPP_HIDE_FROM_ABI
Duncan P. N. Exon Smith321d6bf2017-04-21 23:14:55 +0000348typename std::enable_if<
349 std::is_integral<_A1>::value && !std::is_signed<_A1>::value, bool>::type
350signbit(_A1) _NOEXCEPT
351{ return false; }
352
Shoaib Meenai159375f2017-04-07 02:20:52 +0000353#elif defined(_LIBCPP_MSVCRT)
Saleem Abdulrasool257256b2017-02-18 19:28:38 +0000354
355template <typename _A1>
Nikolas Klauser4956e722022-10-12 15:41:22 +0200356inline _LIBCPP_HIDE_FROM_ABI
Duncan P. N. Exon Smith321d6bf2017-04-21 23:14:55 +0000357typename std::enable_if<std::is_floating_point<_A1>::value, bool>::type
Nikolas Klauser9806f452022-10-12 15:45:09 +0200358signbit(_A1 __x) _NOEXCEPT
Saleem Abdulrasool257256b2017-02-18 19:28:38 +0000359{
Nikolas Klauser9806f452022-10-12 15:45:09 +0200360 return ::signbit(static_cast<typename std::__promote<_A1>::type>(__x));
Saleem Abdulrasool257256b2017-02-18 19:28:38 +0000361}
362
Duncan P. N. Exon Smith321d6bf2017-04-21 23:14:55 +0000363template <class _A1>
Nikolas Klauser4956e722022-10-12 15:41:22 +0200364inline _LIBCPP_HIDE_FROM_ABI
Duncan P. N. Exon Smith321d6bf2017-04-21 23:14:55 +0000365typename std::enable_if<
366 std::is_integral<_A1>::value && std::is_signed<_A1>::value, bool>::type
Nikolas Klauser9806f452022-10-12 15:45:09 +0200367signbit(_A1 __x) _NOEXCEPT
368{ return __x < 0; }
Duncan P. N. Exon Smith321d6bf2017-04-21 23:14:55 +0000369
370template <class _A1>
Nikolas Klauser4956e722022-10-12 15:41:22 +0200371inline _LIBCPP_HIDE_FROM_ABI
Duncan P. N. Exon Smith321d6bf2017-04-21 23:14:55 +0000372typename std::enable_if<
373 std::is_integral<_A1>::value && !std::is_signed<_A1>::value, bool>::type
374signbit(_A1) _NOEXCEPT
375{ return false; }
376
Louis Dionne2b1ceaa2021-04-20 12:03:32 -0400377#endif // signbit
Richard Smith081bb592015-10-08 20:40:34 +0000378
379// fpclassify
380
381#ifdef fpclassify
382
383template <class _A1>
Nikolas Klauser4956e722022-10-12 15:41:22 +0200384_LIBCPP_HIDE_FROM_ABI
Richard Smith081bb592015-10-08 20:40:34 +0000385int
Nikolas Klauser9806f452022-10-12 15:45:09 +0200386__libcpp_fpclassify(_A1 __x) _NOEXCEPT
Richard Smith081bb592015-10-08 20:40:34 +0000387{
Ilya Tokarc3abffb2021-02-10 13:05:19 -0500388#if __has_builtin(__builtin_fpclassify)
389 return __builtin_fpclassify(FP_NAN, FP_INFINITE, FP_NORMAL, FP_SUBNORMAL,
Nikolas Klauser9806f452022-10-12 15:45:09 +0200390 FP_ZERO, __x);
Ilya Tokarc3abffb2021-02-10 13:05:19 -0500391#else
Nikolas Klauser9806f452022-10-12 15:45:09 +0200392 return fpclassify(__x);
Ilya Tokarc3abffb2021-02-10 13:05:19 -0500393#endif
Richard Smith081bb592015-10-08 20:40:34 +0000394}
395
396#undef fpclassify
397
398template <class _A1>
Nikolas Klauser4956e722022-10-12 15:41:22 +0200399inline _LIBCPP_HIDE_FROM_ABI
Duncan P. N. Exon Smith321d6bf2017-04-21 23:14:55 +0000400typename std::enable_if<std::is_floating_point<_A1>::value, int>::type
Nikolas Klauser9806f452022-10-12 15:45:09 +0200401fpclassify(_A1 __x) _NOEXCEPT
Richard Smith081bb592015-10-08 20:40:34 +0000402{
Nikolas Klauser9806f452022-10-12 15:45:09 +0200403 return __libcpp_fpclassify((typename std::__promote<_A1>::type)__x);
Richard Smith081bb592015-10-08 20:40:34 +0000404}
405
Duncan P. N. Exon Smith321d6bf2017-04-21 23:14:55 +0000406template <class _A1>
Nikolas Klauser4956e722022-10-12 15:41:22 +0200407inline _LIBCPP_HIDE_FROM_ABI
Duncan P. N. Exon Smith321d6bf2017-04-21 23:14:55 +0000408typename std::enable_if<std::is_integral<_A1>::value, int>::type
Nikolas Klauser9806f452022-10-12 15:45:09 +0200409fpclassify(_A1 __x) _NOEXCEPT
410{ return __x == 0 ? FP_ZERO : FP_NORMAL; }
Duncan P. N. Exon Smith321d6bf2017-04-21 23:14:55 +0000411
Shoaib Meenai159375f2017-04-07 02:20:52 +0000412#elif defined(_LIBCPP_MSVCRT)
Saleem Abdulrasool257256b2017-02-18 19:28:38 +0000413
414template <typename _A1>
Nikolas Klauser4956e722022-10-12 15:41:22 +0200415inline _LIBCPP_HIDE_FROM_ABI
Duncan P. N. Exon Smith321d6bf2017-04-21 23:14:55 +0000416typename std::enable_if<std::is_floating_point<_A1>::value, bool>::type
Nikolas Klauser9806f452022-10-12 15:45:09 +0200417fpclassify(_A1 __x) _NOEXCEPT
Saleem Abdulrasool257256b2017-02-18 19:28:38 +0000418{
Nikolas Klauser9806f452022-10-12 15:45:09 +0200419 return ::fpclassify(static_cast<typename std::__promote<_A1>::type>(__x));
Saleem Abdulrasool257256b2017-02-18 19:28:38 +0000420}
421
Duncan P. N. Exon Smith321d6bf2017-04-21 23:14:55 +0000422template <class _A1>
Nikolas Klauser4956e722022-10-12 15:41:22 +0200423inline _LIBCPP_HIDE_FROM_ABI
Duncan P. N. Exon Smith321d6bf2017-04-21 23:14:55 +0000424typename std::enable_if<std::is_integral<_A1>::value, int>::type
Nikolas Klauser9806f452022-10-12 15:45:09 +0200425fpclassify(_A1 __x) _NOEXCEPT
426{ return __x == 0 ? FP_ZERO : FP_NORMAL; }
Duncan P. N. Exon Smith321d6bf2017-04-21 23:14:55 +0000427
Louis Dionne2b1ceaa2021-04-20 12:03:32 -0400428#endif // fpclassify
Richard Smith081bb592015-10-08 20:40:34 +0000429
430// isfinite
431
432#ifdef isfinite
433
434template <class _A1>
Nikolas Klauser4956e722022-10-12 15:41:22 +0200435_LIBCPP_HIDE_FROM_ABI
Richard Smith081bb592015-10-08 20:40:34 +0000436bool
Nikolas Klauser9806f452022-10-12 15:45:09 +0200437__libcpp_isfinite(_A1 __x) _NOEXCEPT
Richard Smith081bb592015-10-08 20:40:34 +0000438{
Ilya Tokarc3abffb2021-02-10 13:05:19 -0500439#if __has_builtin(__builtin_isfinite)
Nikolas Klauser9806f452022-10-12 15:45:09 +0200440 return __builtin_isfinite(__x);
Ilya Tokarc3abffb2021-02-10 13:05:19 -0500441#else
Nikolas Klauser9806f452022-10-12 15:45:09 +0200442 return isfinite(__x);
Ilya Tokarc3abffb2021-02-10 13:05:19 -0500443#endif
Richard Smith081bb592015-10-08 20:40:34 +0000444}
445
446#undef isfinite
447
448template <class _A1>
Nikolas Klauser4956e722022-10-12 15:41:22 +0200449inline _LIBCPP_HIDE_FROM_ABI
Duncan P. N. Exon Smith321d6bf2017-04-21 23:14:55 +0000450typename std::enable_if<
451 std::is_arithmetic<_A1>::value && std::numeric_limits<_A1>::has_infinity,
452 bool>::type
Nikolas Klauser9806f452022-10-12 15:45:09 +0200453isfinite(_A1 __x) _NOEXCEPT
Richard Smith081bb592015-10-08 20:40:34 +0000454{
Nikolas Klauser9806f452022-10-12 15:45:09 +0200455 return __libcpp_isfinite((typename std::__promote<_A1>::type)__x);
Richard Smith081bb592015-10-08 20:40:34 +0000456}
457
Duncan P. N. Exon Smith321d6bf2017-04-21 23:14:55 +0000458template <class _A1>
Nikolas Klauser4956e722022-10-12 15:41:22 +0200459inline _LIBCPP_HIDE_FROM_ABI
Duncan P. N. Exon Smith321d6bf2017-04-21 23:14:55 +0000460typename std::enable_if<
461 std::is_arithmetic<_A1>::value && !std::numeric_limits<_A1>::has_infinity,
462 bool>::type
463isfinite(_A1) _NOEXCEPT
464{ return true; }
465
Louis Dionne2b1ceaa2021-04-20 12:03:32 -0400466#endif // isfinite
Richard Smith081bb592015-10-08 20:40:34 +0000467
468// isinf
469
470#ifdef isinf
471
472template <class _A1>
Nikolas Klauser4956e722022-10-12 15:41:22 +0200473_LIBCPP_HIDE_FROM_ABI
Richard Smith081bb592015-10-08 20:40:34 +0000474bool
Nikolas Klauser9806f452022-10-12 15:45:09 +0200475__libcpp_isinf(_A1 __x) _NOEXCEPT
Richard Smith081bb592015-10-08 20:40:34 +0000476{
Ilya Tokarc3abffb2021-02-10 13:05:19 -0500477#if __has_builtin(__builtin_isinf)
Nikolas Klauser9806f452022-10-12 15:45:09 +0200478 return __builtin_isinf(__x);
Ilya Tokarc3abffb2021-02-10 13:05:19 -0500479#else
Nikolas Klauser9806f452022-10-12 15:45:09 +0200480 return isinf(__x);
Ilya Tokarc3abffb2021-02-10 13:05:19 -0500481#endif
Richard Smith081bb592015-10-08 20:40:34 +0000482}
483
484#undef isinf
485
486template <class _A1>
Nikolas Klauser4956e722022-10-12 15:41:22 +0200487inline _LIBCPP_HIDE_FROM_ABI
Duncan P. N. Exon Smith321d6bf2017-04-21 23:14:55 +0000488typename std::enable_if<
489 std::is_arithmetic<_A1>::value && std::numeric_limits<_A1>::has_infinity,
490 bool>::type
Nikolas Klauser9806f452022-10-12 15:45:09 +0200491isinf(_A1 __x) _NOEXCEPT
Richard Smith081bb592015-10-08 20:40:34 +0000492{
Nikolas Klauser9806f452022-10-12 15:45:09 +0200493 return __libcpp_isinf((typename std::__promote<_A1>::type)__x);
Richard Smith081bb592015-10-08 20:40:34 +0000494}
495
Duncan P. N. Exon Smith321d6bf2017-04-21 23:14:55 +0000496template <class _A1>
Nikolas Klauser4956e722022-10-12 15:41:22 +0200497inline _LIBCPP_HIDE_FROM_ABI
Duncan P. N. Exon Smith321d6bf2017-04-21 23:14:55 +0000498typename std::enable_if<
499 std::is_arithmetic<_A1>::value && !std::numeric_limits<_A1>::has_infinity,
500 bool>::type
501isinf(_A1) _NOEXCEPT
502{ return false; }
503
Richard Smithafccfd32018-05-01 03:05:40 +0000504#ifdef _LIBCPP_PREFERRED_OVERLOAD
Nikolas Klauser4956e722022-10-12 15:41:22 +0200505inline _LIBCPP_HIDE_FROM_ABI
Richard Smithafccfd32018-05-01 03:05:40 +0000506bool
Nikolas Klauser9806f452022-10-12 15:45:09 +0200507isinf(float __x) _NOEXCEPT { return __libcpp_isinf(__x); }
Richard Smithafccfd32018-05-01 03:05:40 +0000508
Nikolas Klauser4956e722022-10-12 15:41:22 +0200509inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_PREFERRED_OVERLOAD
Richard Smithafccfd32018-05-01 03:05:40 +0000510bool
Nikolas Klauser9806f452022-10-12 15:45:09 +0200511isinf(double __x) _NOEXCEPT { return __libcpp_isinf(__x); }
Richard Smithafccfd32018-05-01 03:05:40 +0000512
Nikolas Klauser4956e722022-10-12 15:41:22 +0200513inline _LIBCPP_HIDE_FROM_ABI
Richard Smithafccfd32018-05-01 03:05:40 +0000514bool
Nikolas Klauser9806f452022-10-12 15:45:09 +0200515isinf(long double __x) _NOEXCEPT { return __libcpp_isinf(__x); }
Richard Smithafccfd32018-05-01 03:05:40 +0000516#endif
517
Louis Dionne2b1ceaa2021-04-20 12:03:32 -0400518#endif // isinf
Richard Smith081bb592015-10-08 20:40:34 +0000519
520// isnan
521
522#ifdef isnan
523
524template <class _A1>
Nikolas Klauser4956e722022-10-12 15:41:22 +0200525_LIBCPP_HIDE_FROM_ABI
Richard Smith081bb592015-10-08 20:40:34 +0000526bool
Nikolas Klauser9806f452022-10-12 15:45:09 +0200527__libcpp_isnan(_A1 __x) _NOEXCEPT
Richard Smith081bb592015-10-08 20:40:34 +0000528{
Ilya Tokar6caf83a2019-11-15 12:29:02 -0500529#if __has_builtin(__builtin_isnan)
Nikolas Klauser9806f452022-10-12 15:45:09 +0200530 return __builtin_isnan(__x);
Ilya Tokar6caf83a2019-11-15 12:29:02 -0500531#else
Nikolas Klauser9806f452022-10-12 15:45:09 +0200532 return isnan(__x);
Ilya Tokar6caf83a2019-11-15 12:29:02 -0500533#endif
Richard Smith081bb592015-10-08 20:40:34 +0000534}
535
536#undef isnan
537
538template <class _A1>
Nikolas Klauser4956e722022-10-12 15:41:22 +0200539inline _LIBCPP_HIDE_FROM_ABI
Duncan P. N. Exon Smith321d6bf2017-04-21 23:14:55 +0000540typename std::enable_if<std::is_floating_point<_A1>::value, bool>::type
Nikolas Klauser9806f452022-10-12 15:45:09 +0200541isnan(_A1 __x) _NOEXCEPT
Richard Smith081bb592015-10-08 20:40:34 +0000542{
Nikolas Klauser9806f452022-10-12 15:45:09 +0200543 return __libcpp_isnan((typename std::__promote<_A1>::type)__x);
Richard Smith081bb592015-10-08 20:40:34 +0000544}
545
Duncan P. N. Exon Smith321d6bf2017-04-21 23:14:55 +0000546template <class _A1>
Nikolas Klauser4956e722022-10-12 15:41:22 +0200547inline _LIBCPP_HIDE_FROM_ABI
Duncan P. N. Exon Smith321d6bf2017-04-21 23:14:55 +0000548typename std::enable_if<std::is_integral<_A1>::value, bool>::type
549isnan(_A1) _NOEXCEPT
550{ return false; }
551
Richard Smithafccfd32018-05-01 03:05:40 +0000552#ifdef _LIBCPP_PREFERRED_OVERLOAD
Nikolas Klauser4956e722022-10-12 15:41:22 +0200553inline _LIBCPP_HIDE_FROM_ABI
Richard Smithafccfd32018-05-01 03:05:40 +0000554bool
Nikolas Klauser9806f452022-10-12 15:45:09 +0200555isnan(float __x) _NOEXCEPT { return __libcpp_isnan(__x); }
Richard Smithafccfd32018-05-01 03:05:40 +0000556
Nikolas Klauser4956e722022-10-12 15:41:22 +0200557inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_PREFERRED_OVERLOAD
Richard Smithafccfd32018-05-01 03:05:40 +0000558bool
Nikolas Klauser9806f452022-10-12 15:45:09 +0200559isnan(double __x) _NOEXCEPT { return __libcpp_isnan(__x); }
Richard Smithafccfd32018-05-01 03:05:40 +0000560
Nikolas Klauser4956e722022-10-12 15:41:22 +0200561inline _LIBCPP_HIDE_FROM_ABI
Richard Smithafccfd32018-05-01 03:05:40 +0000562bool
Nikolas Klauser9806f452022-10-12 15:45:09 +0200563isnan(long double __x) _NOEXCEPT { return __libcpp_isnan(__x); }
Richard Smithafccfd32018-05-01 03:05:40 +0000564#endif
565
Louis Dionne2b1ceaa2021-04-20 12:03:32 -0400566#endif // isnan
Richard Smith081bb592015-10-08 20:40:34 +0000567
568// isnormal
569
570#ifdef isnormal
571
572template <class _A1>
Nikolas Klauser4956e722022-10-12 15:41:22 +0200573_LIBCPP_HIDE_FROM_ABI
Richard Smith081bb592015-10-08 20:40:34 +0000574bool
Nikolas Klauser9806f452022-10-12 15:45:09 +0200575__libcpp_isnormal(_A1 __x) _NOEXCEPT
Richard Smith081bb592015-10-08 20:40:34 +0000576{
Ilya Tokarc3abffb2021-02-10 13:05:19 -0500577#if __has_builtin(__builtin_isnormal)
Nikolas Klauser9806f452022-10-12 15:45:09 +0200578 return __builtin_isnormal(__x);
Ilya Tokarc3abffb2021-02-10 13:05:19 -0500579#else
Nikolas Klauser9806f452022-10-12 15:45:09 +0200580 return isnormal(__x);
Ilya Tokarc3abffb2021-02-10 13:05:19 -0500581#endif
Richard Smith081bb592015-10-08 20:40:34 +0000582}
583
584#undef isnormal
585
586template <class _A1>
Nikolas Klauser4956e722022-10-12 15:41:22 +0200587inline _LIBCPP_HIDE_FROM_ABI
Duncan P. N. Exon Smith321d6bf2017-04-21 23:14:55 +0000588typename std::enable_if<std::is_floating_point<_A1>::value, bool>::type
Nikolas Klauser9806f452022-10-12 15:45:09 +0200589isnormal(_A1 __x) _NOEXCEPT
Richard Smith081bb592015-10-08 20:40:34 +0000590{
Nikolas Klauser9806f452022-10-12 15:45:09 +0200591 return __libcpp_isnormal((typename std::__promote<_A1>::type)__x);
Richard Smith081bb592015-10-08 20:40:34 +0000592}
593
Duncan P. N. Exon Smith321d6bf2017-04-21 23:14:55 +0000594template <class _A1>
Nikolas Klauser4956e722022-10-12 15:41:22 +0200595inline _LIBCPP_HIDE_FROM_ABI
Duncan P. N. Exon Smith321d6bf2017-04-21 23:14:55 +0000596typename std::enable_if<std::is_integral<_A1>::value, bool>::type
Nikolas Klauser9806f452022-10-12 15:45:09 +0200597isnormal(_A1 __x) _NOEXCEPT
598{ return __x != 0; }
Duncan P. N. Exon Smith321d6bf2017-04-21 23:14:55 +0000599
Louis Dionne2b1ceaa2021-04-20 12:03:32 -0400600#endif // isnormal
Richard Smith081bb592015-10-08 20:40:34 +0000601
602// isgreater
603
604#ifdef isgreater
605
606template <class _A1, class _A2>
Nikolas Klauser4956e722022-10-12 15:41:22 +0200607_LIBCPP_HIDE_FROM_ABI
Richard Smith081bb592015-10-08 20:40:34 +0000608bool
Nikolas Klauser9806f452022-10-12 15:45:09 +0200609__libcpp_isgreater(_A1 __x, _A2 __y) _NOEXCEPT
Richard Smith081bb592015-10-08 20:40:34 +0000610{
Nikolas Klauser9806f452022-10-12 15:45:09 +0200611 return isgreater(__x, __y);
Richard Smith081bb592015-10-08 20:40:34 +0000612}
613
614#undef isgreater
615
616template <class _A1, class _A2>
Nikolas Klauser4956e722022-10-12 15:41:22 +0200617inline _LIBCPP_HIDE_FROM_ABI
Richard Smith081bb592015-10-08 20:40:34 +0000618typename std::enable_if
619<
620 std::is_arithmetic<_A1>::value &&
621 std::is_arithmetic<_A2>::value,
622 bool
623>::type
Nikolas Klauser9806f452022-10-12 15:45:09 +0200624isgreater(_A1 __x, _A2 __y) _NOEXCEPT
Richard Smith081bb592015-10-08 20:40:34 +0000625{
626 typedef typename std::__promote<_A1, _A2>::type type;
Nikolas Klauser9806f452022-10-12 15:45:09 +0200627 return __libcpp_isgreater((type)__x, (type)__y);
Richard Smith081bb592015-10-08 20:40:34 +0000628}
629
Louis Dionne2b1ceaa2021-04-20 12:03:32 -0400630#endif // isgreater
Richard Smith081bb592015-10-08 20:40:34 +0000631
632// isgreaterequal
633
634#ifdef isgreaterequal
635
636template <class _A1, class _A2>
Nikolas Klauser4956e722022-10-12 15:41:22 +0200637_LIBCPP_HIDE_FROM_ABI
Richard Smith081bb592015-10-08 20:40:34 +0000638bool
Nikolas Klauser9806f452022-10-12 15:45:09 +0200639__libcpp_isgreaterequal(_A1 __x, _A2 __y) _NOEXCEPT
Richard Smith081bb592015-10-08 20:40:34 +0000640{
Nikolas Klauser9806f452022-10-12 15:45:09 +0200641 return isgreaterequal(__x, __y);
Richard Smith081bb592015-10-08 20:40:34 +0000642}
643
644#undef isgreaterequal
645
646template <class _A1, class _A2>
Nikolas Klauser4956e722022-10-12 15:41:22 +0200647inline _LIBCPP_HIDE_FROM_ABI
Richard Smith081bb592015-10-08 20:40:34 +0000648typename std::enable_if
649<
650 std::is_arithmetic<_A1>::value &&
651 std::is_arithmetic<_A2>::value,
652 bool
653>::type
Nikolas Klauser9806f452022-10-12 15:45:09 +0200654isgreaterequal(_A1 __x, _A2 __y) _NOEXCEPT
Richard Smith081bb592015-10-08 20:40:34 +0000655{
656 typedef typename std::__promote<_A1, _A2>::type type;
Nikolas Klauser9806f452022-10-12 15:45:09 +0200657 return __libcpp_isgreaterequal((type)__x, (type)__y);
Richard Smith081bb592015-10-08 20:40:34 +0000658}
659
Louis Dionne2b1ceaa2021-04-20 12:03:32 -0400660#endif // isgreaterequal
Richard Smith081bb592015-10-08 20:40:34 +0000661
662// isless
663
664#ifdef isless
665
666template <class _A1, class _A2>
Nikolas Klauser4956e722022-10-12 15:41:22 +0200667_LIBCPP_HIDE_FROM_ABI
Richard Smith081bb592015-10-08 20:40:34 +0000668bool
Nikolas Klauser9806f452022-10-12 15:45:09 +0200669__libcpp_isless(_A1 __x, _A2 __y) _NOEXCEPT
Richard Smith081bb592015-10-08 20:40:34 +0000670{
Nikolas Klauser9806f452022-10-12 15:45:09 +0200671 return isless(__x, __y);
Richard Smith081bb592015-10-08 20:40:34 +0000672}
673
674#undef isless
675
676template <class _A1, class _A2>
Nikolas Klauser4956e722022-10-12 15:41:22 +0200677inline _LIBCPP_HIDE_FROM_ABI
Richard Smith081bb592015-10-08 20:40:34 +0000678typename std::enable_if
679<
680 std::is_arithmetic<_A1>::value &&
681 std::is_arithmetic<_A2>::value,
682 bool
683>::type
Nikolas Klauser9806f452022-10-12 15:45:09 +0200684isless(_A1 __x, _A2 __y) _NOEXCEPT
Richard Smith081bb592015-10-08 20:40:34 +0000685{
686 typedef typename std::__promote<_A1, _A2>::type type;
Nikolas Klauser9806f452022-10-12 15:45:09 +0200687 return __libcpp_isless((type)__x, (type)__y);
Richard Smith081bb592015-10-08 20:40:34 +0000688}
689
Louis Dionne2b1ceaa2021-04-20 12:03:32 -0400690#endif // isless
Richard Smith081bb592015-10-08 20:40:34 +0000691
692// islessequal
693
694#ifdef islessequal
695
696template <class _A1, class _A2>
Nikolas Klauser4956e722022-10-12 15:41:22 +0200697_LIBCPP_HIDE_FROM_ABI
Richard Smith081bb592015-10-08 20:40:34 +0000698bool
Nikolas Klauser9806f452022-10-12 15:45:09 +0200699__libcpp_islessequal(_A1 __x, _A2 __y) _NOEXCEPT
Richard Smith081bb592015-10-08 20:40:34 +0000700{
Nikolas Klauser9806f452022-10-12 15:45:09 +0200701 return islessequal(__x, __y);
Richard Smith081bb592015-10-08 20:40:34 +0000702}
703
704#undef islessequal
705
706template <class _A1, class _A2>
Nikolas Klauser4956e722022-10-12 15:41:22 +0200707inline _LIBCPP_HIDE_FROM_ABI
Richard Smith081bb592015-10-08 20:40:34 +0000708typename std::enable_if
709<
710 std::is_arithmetic<_A1>::value &&
711 std::is_arithmetic<_A2>::value,
712 bool
713>::type
Nikolas Klauser9806f452022-10-12 15:45:09 +0200714islessequal(_A1 __x, _A2 __y) _NOEXCEPT
Richard Smith081bb592015-10-08 20:40:34 +0000715{
716 typedef typename std::__promote<_A1, _A2>::type type;
Nikolas Klauser9806f452022-10-12 15:45:09 +0200717 return __libcpp_islessequal((type)__x, (type)__y);
Richard Smith081bb592015-10-08 20:40:34 +0000718}
719
Louis Dionne2b1ceaa2021-04-20 12:03:32 -0400720#endif // islessequal
Richard Smith081bb592015-10-08 20:40:34 +0000721
722// islessgreater
723
724#ifdef islessgreater
725
726template <class _A1, class _A2>
Nikolas Klauser4956e722022-10-12 15:41:22 +0200727_LIBCPP_HIDE_FROM_ABI
Richard Smith081bb592015-10-08 20:40:34 +0000728bool
Nikolas Klauser9806f452022-10-12 15:45:09 +0200729__libcpp_islessgreater(_A1 __x, _A2 __y) _NOEXCEPT
Richard Smith081bb592015-10-08 20:40:34 +0000730{
Nikolas Klauser9806f452022-10-12 15:45:09 +0200731 return islessgreater(__x, __y);
Richard Smith081bb592015-10-08 20:40:34 +0000732}
733
734#undef islessgreater
735
736template <class _A1, class _A2>
Nikolas Klauser4956e722022-10-12 15:41:22 +0200737inline _LIBCPP_HIDE_FROM_ABI
Richard Smith081bb592015-10-08 20:40:34 +0000738typename std::enable_if
739<
740 std::is_arithmetic<_A1>::value &&
741 std::is_arithmetic<_A2>::value,
742 bool
743>::type
Nikolas Klauser9806f452022-10-12 15:45:09 +0200744islessgreater(_A1 __x, _A2 __y) _NOEXCEPT
Richard Smith081bb592015-10-08 20:40:34 +0000745{
746 typedef typename std::__promote<_A1, _A2>::type type;
Nikolas Klauser9806f452022-10-12 15:45:09 +0200747 return __libcpp_islessgreater((type)__x, (type)__y);
Richard Smith081bb592015-10-08 20:40:34 +0000748}
749
Louis Dionne2b1ceaa2021-04-20 12:03:32 -0400750#endif // islessgreater
Richard Smith081bb592015-10-08 20:40:34 +0000751
752// isunordered
753
754#ifdef isunordered
755
756template <class _A1, class _A2>
Nikolas Klauser4956e722022-10-12 15:41:22 +0200757_LIBCPP_HIDE_FROM_ABI
Richard Smith081bb592015-10-08 20:40:34 +0000758bool
Nikolas Klauser9806f452022-10-12 15:45:09 +0200759__libcpp_isunordered(_A1 __x, _A2 __y) _NOEXCEPT
Richard Smith081bb592015-10-08 20:40:34 +0000760{
Nikolas Klauser9806f452022-10-12 15:45:09 +0200761 return isunordered(__x, __y);
Richard Smith081bb592015-10-08 20:40:34 +0000762}
763
764#undef isunordered
765
766template <class _A1, class _A2>
Nikolas Klauser4956e722022-10-12 15:41:22 +0200767inline _LIBCPP_HIDE_FROM_ABI
Richard Smith081bb592015-10-08 20:40:34 +0000768typename std::enable_if
769<
770 std::is_arithmetic<_A1>::value &&
771 std::is_arithmetic<_A2>::value,
772 bool
773>::type
Nikolas Klauser9806f452022-10-12 15:45:09 +0200774isunordered(_A1 __x, _A2 __y) _NOEXCEPT
Richard Smith081bb592015-10-08 20:40:34 +0000775{
776 typedef typename std::__promote<_A1, _A2>::type type;
Nikolas Klauser9806f452022-10-12 15:45:09 +0200777 return __libcpp_isunordered((type)__x, (type)__y);
Richard Smith081bb592015-10-08 20:40:34 +0000778}
779
Louis Dionne2b1ceaa2021-04-20 12:03:32 -0400780#endif // isunordered
Richard Smith081bb592015-10-08 20:40:34 +0000781
Richard Smith081bb592015-10-08 20:40:34 +0000782// abs
Eric Fiselier6c9e1a72020-02-15 18:55:07 -0500783//
784// handled in stdlib.h
Richard Smith081bb592015-10-08 20:40:34 +0000785
Eric Fiselier2b85c6e2019-04-23 18:01:58 +0000786// div
Eric Fiselier6c9e1a72020-02-15 18:55:07 -0500787//
788// handled in stdlib.h
Eric Fiselier2b85c6e2019-04-23 18:01:58 +0000789
Richard Smith081bb592015-10-08 20:40:34 +0000790// acos
791
David Tenty7249ac92022-02-07 18:22:35 -0500792# if !defined(__sun__)
Nikolas Klauser9806f452022-10-12 15:45:09 +0200793inline _LIBCPP_HIDE_FROM_ABI float acos(float __x) _NOEXCEPT {return ::acosf(__x);}
794inline _LIBCPP_HIDE_FROM_ABI long double acos(long double __x) _NOEXCEPT {return ::acosl(__x);}
David Tenty7249ac92022-02-07 18:22:35 -0500795# endif
Richard Smith081bb592015-10-08 20:40:34 +0000796
797template <class _A1>
Nikolas Klauser4956e722022-10-12 15:41:22 +0200798inline _LIBCPP_HIDE_FROM_ABI
Richard Smith081bb592015-10-08 20:40:34 +0000799typename std::enable_if<std::is_integral<_A1>::value, double>::type
Nikolas Klauser9806f452022-10-12 15:45:09 +0200800acos(_A1 __x) _NOEXCEPT {return ::acos((double)__x);}
Richard Smith081bb592015-10-08 20:40:34 +0000801
802// asin
803
David Tenty7249ac92022-02-07 18:22:35 -0500804# if !defined(__sun__)
Nikolas Klauser9806f452022-10-12 15:45:09 +0200805inline _LIBCPP_HIDE_FROM_ABI float asin(float __x) _NOEXCEPT {return ::asinf(__x);}
806inline _LIBCPP_HIDE_FROM_ABI long double asin(long double __x) _NOEXCEPT {return ::asinl(__x);}
David Tenty7249ac92022-02-07 18:22:35 -0500807# endif
Richard Smith081bb592015-10-08 20:40:34 +0000808
809template <class _A1>
Nikolas Klauser4956e722022-10-12 15:41:22 +0200810inline _LIBCPP_HIDE_FROM_ABI
Richard Smith081bb592015-10-08 20:40:34 +0000811typename std::enable_if<std::is_integral<_A1>::value, double>::type
Nikolas Klauser9806f452022-10-12 15:45:09 +0200812asin(_A1 __x) _NOEXCEPT {return ::asin((double)__x);}
Richard Smith081bb592015-10-08 20:40:34 +0000813
814// atan
815
David Tenty7249ac92022-02-07 18:22:35 -0500816# if !defined(__sun__)
Nikolas Klauser9806f452022-10-12 15:45:09 +0200817inline _LIBCPP_HIDE_FROM_ABI float atan(float __x) _NOEXCEPT {return ::atanf(__x);}
818inline _LIBCPP_HIDE_FROM_ABI long double atan(long double __x) _NOEXCEPT {return ::atanl(__x);}
David Tenty7249ac92022-02-07 18:22:35 -0500819# endif
Richard Smith081bb592015-10-08 20:40:34 +0000820
821template <class _A1>
Nikolas Klauser4956e722022-10-12 15:41:22 +0200822inline _LIBCPP_HIDE_FROM_ABI
Richard Smith081bb592015-10-08 20:40:34 +0000823typename std::enable_if<std::is_integral<_A1>::value, double>::type
Nikolas Klauser9806f452022-10-12 15:45:09 +0200824atan(_A1 __x) _NOEXCEPT {return ::atan((double)__x);}
Richard Smith081bb592015-10-08 20:40:34 +0000825
826// atan2
827
David Tenty7249ac92022-02-07 18:22:35 -0500828# if !defined(__sun__)
Nikolas Klauser9806f452022-10-12 15:45:09 +0200829inline _LIBCPP_HIDE_FROM_ABI float atan2(float __y, float __x) _NOEXCEPT {return ::atan2f(__y, __x);}
830inline _LIBCPP_HIDE_FROM_ABI long double atan2(long double __y, long double __x) _NOEXCEPT {return ::atan2l(__y, __x);}
David Tenty7249ac92022-02-07 18:22:35 -0500831# endif
Richard Smith081bb592015-10-08 20:40:34 +0000832
833template <class _A1, class _A2>
Nikolas Klauser4956e722022-10-12 15:41:22 +0200834inline _LIBCPP_HIDE_FROM_ABI
Louis Dionne9ce598d2021-09-08 09:14:43 -0400835typename std::__enable_if_t
Richard Smith081bb592015-10-08 20:40:34 +0000836<
837 std::is_arithmetic<_A1>::value &&
838 std::is_arithmetic<_A2>::value,
839 std::__promote<_A1, _A2>
840>::type
Nikolas Klauser9806f452022-10-12 15:45:09 +0200841atan2(_A1 __y, _A2 __x) _NOEXCEPT
Richard Smith081bb592015-10-08 20:40:34 +0000842{
843 typedef typename std::__promote<_A1, _A2>::type __result_type;
Eric Fiselier3906a132019-06-23 20:28:29 +0000844 static_assert((!(std::_IsSame<_A1, __result_type>::value &&
845 std::_IsSame<_A2, __result_type>::value)), "");
Nikolas Klauser9806f452022-10-12 15:45:09 +0200846 return ::atan2((__result_type)__y, (__result_type)__x);
Richard Smith081bb592015-10-08 20:40:34 +0000847}
848
849// ceil
850
David Tenty7249ac92022-02-07 18:22:35 -0500851# if !defined(__sun__)
Nikolas Klauser9806f452022-10-12 15:45:09 +0200852inline _LIBCPP_HIDE_FROM_ABI float ceil(float __x) _NOEXCEPT {return ::ceilf(__x);}
853inline _LIBCPP_HIDE_FROM_ABI long double ceil(long double __x) _NOEXCEPT {return ::ceill(__x);}
David Tenty7249ac92022-02-07 18:22:35 -0500854# endif
Richard Smith081bb592015-10-08 20:40:34 +0000855
856template <class _A1>
Nikolas Klauser4956e722022-10-12 15:41:22 +0200857inline _LIBCPP_HIDE_FROM_ABI
Richard Smith081bb592015-10-08 20:40:34 +0000858typename std::enable_if<std::is_integral<_A1>::value, double>::type
Nikolas Klauser9806f452022-10-12 15:45:09 +0200859ceil(_A1 __x) _NOEXCEPT {return ::ceil((double)__x);}
Richard Smith081bb592015-10-08 20:40:34 +0000860
861// cos
862
David Tenty7249ac92022-02-07 18:22:35 -0500863# if !defined(__sun__)
Nikolas Klauser9806f452022-10-12 15:45:09 +0200864inline _LIBCPP_HIDE_FROM_ABI float cos(float __x) _NOEXCEPT {return ::cosf(__x);}
865inline _LIBCPP_HIDE_FROM_ABI long double cos(long double __x) _NOEXCEPT {return ::cosl(__x);}
David Tenty7249ac92022-02-07 18:22:35 -0500866# endif
Richard Smith081bb592015-10-08 20:40:34 +0000867
868template <class _A1>
Nikolas Klauser4956e722022-10-12 15:41:22 +0200869inline _LIBCPP_HIDE_FROM_ABI
Richard Smith081bb592015-10-08 20:40:34 +0000870typename std::enable_if<std::is_integral<_A1>::value, double>::type
Nikolas Klauser9806f452022-10-12 15:45:09 +0200871cos(_A1 __x) _NOEXCEPT {return ::cos((double)__x);}
Richard Smith081bb592015-10-08 20:40:34 +0000872
873// cosh
874
David Tenty7249ac92022-02-07 18:22:35 -0500875# if !defined(__sun__)
Nikolas Klauser9806f452022-10-12 15:45:09 +0200876inline _LIBCPP_HIDE_FROM_ABI float cosh(float __x) _NOEXCEPT {return ::coshf(__x);}
877inline _LIBCPP_HIDE_FROM_ABI long double cosh(long double __x) _NOEXCEPT {return ::coshl(__x);}
David Tenty7249ac92022-02-07 18:22:35 -0500878# endif
Richard Smith081bb592015-10-08 20:40:34 +0000879
880template <class _A1>
Nikolas Klauser4956e722022-10-12 15:41:22 +0200881inline _LIBCPP_HIDE_FROM_ABI
Richard Smith081bb592015-10-08 20:40:34 +0000882typename std::enable_if<std::is_integral<_A1>::value, double>::type
Nikolas Klauser9806f452022-10-12 15:45:09 +0200883cosh(_A1 __x) _NOEXCEPT {return ::cosh((double)__x);}
Richard Smith081bb592015-10-08 20:40:34 +0000884
885// exp
886
David Tenty7249ac92022-02-07 18:22:35 -0500887# if !defined(__sun__)
Nikolas Klauser9806f452022-10-12 15:45:09 +0200888inline _LIBCPP_HIDE_FROM_ABI float exp(float __x) _NOEXCEPT {return ::expf(__x);}
889inline _LIBCPP_HIDE_FROM_ABI long double exp(long double __x) _NOEXCEPT {return ::expl(__x);}
David Tenty7249ac92022-02-07 18:22:35 -0500890# endif
Richard Smith081bb592015-10-08 20:40:34 +0000891
892template <class _A1>
Nikolas Klauser4956e722022-10-12 15:41:22 +0200893inline _LIBCPP_HIDE_FROM_ABI
Richard Smith081bb592015-10-08 20:40:34 +0000894typename std::enable_if<std::is_integral<_A1>::value, double>::type
Nikolas Klauser9806f452022-10-12 15:45:09 +0200895exp(_A1 __x) _NOEXCEPT {return ::exp((double)__x);}
Richard Smith081bb592015-10-08 20:40:34 +0000896
897// fabs
898
David Tenty7249ac92022-02-07 18:22:35 -0500899# if !defined(__sun__)
Nikolas Klauser9806f452022-10-12 15:45:09 +0200900inline _LIBCPP_HIDE_FROM_ABI float fabs(float __x) _NOEXCEPT {return ::fabsf(__x);}
901inline _LIBCPP_HIDE_FROM_ABI long double fabs(long double __x) _NOEXCEPT {return ::fabsl(__x);}
David Tenty7249ac92022-02-07 18:22:35 -0500902# endif
Richard Smith081bb592015-10-08 20:40:34 +0000903
904template <class _A1>
Nikolas Klauser4956e722022-10-12 15:41:22 +0200905inline _LIBCPP_HIDE_FROM_ABI
Richard Smith081bb592015-10-08 20:40:34 +0000906typename std::enable_if<std::is_integral<_A1>::value, double>::type
Nikolas Klauser9806f452022-10-12 15:45:09 +0200907fabs(_A1 __x) _NOEXCEPT {return ::fabs((double)__x);}
Richard Smith081bb592015-10-08 20:40:34 +0000908
909// floor
910
David Tenty7249ac92022-02-07 18:22:35 -0500911# if !defined(__sun__)
Nikolas Klauser9806f452022-10-12 15:45:09 +0200912inline _LIBCPP_HIDE_FROM_ABI float floor(float __x) _NOEXCEPT {return ::floorf(__x);}
913inline _LIBCPP_HIDE_FROM_ABI long double floor(long double __x) _NOEXCEPT {return ::floorl(__x);}
David Tenty7249ac92022-02-07 18:22:35 -0500914# endif
Richard Smith081bb592015-10-08 20:40:34 +0000915
916template <class _A1>
Nikolas Klauser4956e722022-10-12 15:41:22 +0200917inline _LIBCPP_HIDE_FROM_ABI
Richard Smith081bb592015-10-08 20:40:34 +0000918typename std::enable_if<std::is_integral<_A1>::value, double>::type
Nikolas Klauser9806f452022-10-12 15:45:09 +0200919floor(_A1 __x) _NOEXCEPT {return ::floor((double)__x);}
Richard Smith081bb592015-10-08 20:40:34 +0000920
921// fmod
922
David Tenty7249ac92022-02-07 18:22:35 -0500923# if !defined(__sun__)
Nikolas Klauser9806f452022-10-12 15:45:09 +0200924inline _LIBCPP_HIDE_FROM_ABI float fmod(float __x, float __y) _NOEXCEPT {return ::fmodf(__x, __y);}
925inline _LIBCPP_HIDE_FROM_ABI long double fmod(long double __x, long double __y) _NOEXCEPT {return ::fmodl(__x, __y);}
David Tenty7249ac92022-02-07 18:22:35 -0500926# endif
Richard Smith081bb592015-10-08 20:40:34 +0000927
928template <class _A1, class _A2>
Nikolas Klauser4956e722022-10-12 15:41:22 +0200929inline _LIBCPP_HIDE_FROM_ABI
Louis Dionne9ce598d2021-09-08 09:14:43 -0400930typename std::__enable_if_t
Richard Smith081bb592015-10-08 20:40:34 +0000931<
932 std::is_arithmetic<_A1>::value &&
933 std::is_arithmetic<_A2>::value,
934 std::__promote<_A1, _A2>
935>::type
Nikolas Klauser9806f452022-10-12 15:45:09 +0200936fmod(_A1 __x, _A2 __y) _NOEXCEPT
Richard Smith081bb592015-10-08 20:40:34 +0000937{
938 typedef typename std::__promote<_A1, _A2>::type __result_type;
Eric Fiselier3906a132019-06-23 20:28:29 +0000939 static_assert((!(std::_IsSame<_A1, __result_type>::value &&
940 std::_IsSame<_A2, __result_type>::value)), "");
Nikolas Klauser9806f452022-10-12 15:45:09 +0200941 return ::fmod((__result_type)__x, (__result_type)__y);
Richard Smith081bb592015-10-08 20:40:34 +0000942}
943
944// frexp
945
David Tenty7249ac92022-02-07 18:22:35 -0500946# if !defined(__sun__)
Nikolas Klauser9806f452022-10-12 15:45:09 +0200947inline _LIBCPP_HIDE_FROM_ABI float frexp(float __x, int* __e) _NOEXCEPT {return ::frexpf(__x, __e);}
948inline _LIBCPP_HIDE_FROM_ABI long double frexp(long double __x, int* __e) _NOEXCEPT {return ::frexpl(__x, __e);}
David Tenty7249ac92022-02-07 18:22:35 -0500949# endif
Richard Smith081bb592015-10-08 20:40:34 +0000950
951template <class _A1>
Nikolas Klauser4956e722022-10-12 15:41:22 +0200952inline _LIBCPP_HIDE_FROM_ABI
Richard Smith081bb592015-10-08 20:40:34 +0000953typename std::enable_if<std::is_integral<_A1>::value, double>::type
Nikolas Klauser9806f452022-10-12 15:45:09 +0200954frexp(_A1 __x, int* __e) _NOEXCEPT {return ::frexp((double)__x, __e);}
Richard Smith081bb592015-10-08 20:40:34 +0000955
956// ldexp
957
David Tenty7249ac92022-02-07 18:22:35 -0500958# if !defined(__sun__)
Nikolas Klauser9806f452022-10-12 15:45:09 +0200959inline _LIBCPP_HIDE_FROM_ABI float ldexp(float __x, int __e) _NOEXCEPT {return ::ldexpf(__x, __e);}
960inline _LIBCPP_HIDE_FROM_ABI long double ldexp(long double __x, int __e) _NOEXCEPT {return ::ldexpl(__x, __e);}
David Tenty7249ac92022-02-07 18:22:35 -0500961# endif
Richard Smith081bb592015-10-08 20:40:34 +0000962
963template <class _A1>
Nikolas Klauser4956e722022-10-12 15:41:22 +0200964inline _LIBCPP_HIDE_FROM_ABI
Richard Smith081bb592015-10-08 20:40:34 +0000965typename std::enable_if<std::is_integral<_A1>::value, double>::type
Nikolas Klauser9806f452022-10-12 15:45:09 +0200966ldexp(_A1 __x, int __e) _NOEXCEPT {return ::ldexp((double)__x, __e);}
Richard Smith081bb592015-10-08 20:40:34 +0000967
968// log
969
David Tenty7249ac92022-02-07 18:22:35 -0500970# if !defined(__sun__)
Nikolas Klauser9806f452022-10-12 15:45:09 +0200971inline _LIBCPP_HIDE_FROM_ABI float log(float __x) _NOEXCEPT {return ::logf(__x);}
972inline _LIBCPP_HIDE_FROM_ABI long double log(long double __x) _NOEXCEPT {return ::logl(__x);}
David Tenty7249ac92022-02-07 18:22:35 -0500973# endif
Richard Smith081bb592015-10-08 20:40:34 +0000974
975template <class _A1>
Nikolas Klauser4956e722022-10-12 15:41:22 +0200976inline _LIBCPP_HIDE_FROM_ABI
Richard Smith081bb592015-10-08 20:40:34 +0000977typename std::enable_if<std::is_integral<_A1>::value, double>::type
Nikolas Klauser9806f452022-10-12 15:45:09 +0200978log(_A1 __x) _NOEXCEPT {return ::log((double)__x);}
Richard Smith081bb592015-10-08 20:40:34 +0000979
980// log10
981
David Tenty7249ac92022-02-07 18:22:35 -0500982# if !defined(__sun__)
Nikolas Klauser9806f452022-10-12 15:45:09 +0200983inline _LIBCPP_HIDE_FROM_ABI float log10(float __x) _NOEXCEPT {return ::log10f(__x);}
984inline _LIBCPP_HIDE_FROM_ABI long double log10(long double __x) _NOEXCEPT {return ::log10l(__x);}
David Tenty7249ac92022-02-07 18:22:35 -0500985# endif
Richard Smith081bb592015-10-08 20:40:34 +0000986
987template <class _A1>
Nikolas Klauser4956e722022-10-12 15:41:22 +0200988inline _LIBCPP_HIDE_FROM_ABI
Richard Smith081bb592015-10-08 20:40:34 +0000989typename std::enable_if<std::is_integral<_A1>::value, double>::type
Nikolas Klauser9806f452022-10-12 15:45:09 +0200990log10(_A1 __x) _NOEXCEPT {return ::log10((double)__x);}
Richard Smith081bb592015-10-08 20:40:34 +0000991
992// modf
993
David Tenty7249ac92022-02-07 18:22:35 -0500994# if !defined(__sun__)
Nikolas Klauser9806f452022-10-12 15:45:09 +0200995inline _LIBCPP_HIDE_FROM_ABI float modf(float __x, float* __y) _NOEXCEPT {return ::modff(__x, __y);}
996inline _LIBCPP_HIDE_FROM_ABI long double modf(long double __x, long double* __y) _NOEXCEPT {return ::modfl(__x, __y);}
David Tenty7249ac92022-02-07 18:22:35 -0500997# endif
Richard Smith081bb592015-10-08 20:40:34 +0000998
999// pow
1000
David Tenty7249ac92022-02-07 18:22:35 -05001001# if !defined(__sun__)
Nikolas Klauser9806f452022-10-12 15:45:09 +02001002inline _LIBCPP_HIDE_FROM_ABI float pow(float __x, float __y) _NOEXCEPT {return ::powf(__x, __y);}
1003inline _LIBCPP_HIDE_FROM_ABI long double pow(long double __x, long double __y) _NOEXCEPT {return ::powl(__x, __y);}
David Tenty7249ac92022-02-07 18:22:35 -05001004# endif
Richard Smith081bb592015-10-08 20:40:34 +00001005
1006template <class _A1, class _A2>
Nikolas Klauser4956e722022-10-12 15:41:22 +02001007inline _LIBCPP_HIDE_FROM_ABI
Louis Dionne9ce598d2021-09-08 09:14:43 -04001008typename std::__enable_if_t
Richard Smith081bb592015-10-08 20:40:34 +00001009<
1010 std::is_arithmetic<_A1>::value &&
1011 std::is_arithmetic<_A2>::value,
1012 std::__promote<_A1, _A2>
1013>::type
Nikolas Klauser9806f452022-10-12 15:45:09 +02001014pow(_A1 __x, _A2 __y) _NOEXCEPT
Richard Smith081bb592015-10-08 20:40:34 +00001015{
1016 typedef typename std::__promote<_A1, _A2>::type __result_type;
Eric Fiselier3906a132019-06-23 20:28:29 +00001017 static_assert((!(std::_IsSame<_A1, __result_type>::value &&
1018 std::_IsSame<_A2, __result_type>::value)), "");
Nikolas Klauser9806f452022-10-12 15:45:09 +02001019 return ::pow((__result_type)__x, (__result_type)__y);
Richard Smith081bb592015-10-08 20:40:34 +00001020}
1021
1022// sin
1023
David Tenty7249ac92022-02-07 18:22:35 -05001024# if !defined(__sun__)
Nikolas Klauser9806f452022-10-12 15:45:09 +02001025inline _LIBCPP_HIDE_FROM_ABI float sin(float __x) _NOEXCEPT {return ::sinf(__x);}
1026inline _LIBCPP_HIDE_FROM_ABI long double sin(long double __x) _NOEXCEPT {return ::sinl(__x);}
Richard Smith081bb592015-10-08 20:40:34 +00001027#endif
1028
1029template <class _A1>
Nikolas Klauser4956e722022-10-12 15:41:22 +02001030inline _LIBCPP_HIDE_FROM_ABI
Richard Smith081bb592015-10-08 20:40:34 +00001031typename std::enable_if<std::is_integral<_A1>::value, double>::type
Nikolas Klauser9806f452022-10-12 15:45:09 +02001032sin(_A1 __x) _NOEXCEPT {return ::sin((double)__x);}
Richard Smith081bb592015-10-08 20:40:34 +00001033
1034// sinh
1035
David Tenty7249ac92022-02-07 18:22:35 -05001036# if !defined(__sun__)
Nikolas Klauser9806f452022-10-12 15:45:09 +02001037inline _LIBCPP_HIDE_FROM_ABI float sinh(float __x) _NOEXCEPT {return ::sinhf(__x);}
1038inline _LIBCPP_HIDE_FROM_ABI long double sinh(long double __x) _NOEXCEPT {return ::sinhl(__x);}
David Tenty7249ac92022-02-07 18:22:35 -05001039# endif
Richard Smith081bb592015-10-08 20:40:34 +00001040
1041template <class _A1>
Nikolas Klauser4956e722022-10-12 15:41:22 +02001042inline _LIBCPP_HIDE_FROM_ABI
Richard Smith081bb592015-10-08 20:40:34 +00001043typename std::enable_if<std::is_integral<_A1>::value, double>::type
Nikolas Klauser9806f452022-10-12 15:45:09 +02001044sinh(_A1 __x) _NOEXCEPT {return ::sinh((double)__x);}
Richard Smith081bb592015-10-08 20:40:34 +00001045
1046// sqrt
1047
David Tenty7249ac92022-02-07 18:22:35 -05001048# if !defined(__sun__)
Nikolas Klauser9806f452022-10-12 15:45:09 +02001049inline _LIBCPP_HIDE_FROM_ABI float sqrt(float __x) _NOEXCEPT {return ::sqrtf(__x);}
1050inline _LIBCPP_HIDE_FROM_ABI long double sqrt(long double __x) _NOEXCEPT {return ::sqrtl(__x);}
David Tenty7249ac92022-02-07 18:22:35 -05001051# endif
Richard Smith081bb592015-10-08 20:40:34 +00001052
Richard Smith081bb592015-10-08 20:40:34 +00001053template <class _A1>
Nikolas Klauser4956e722022-10-12 15:41:22 +02001054inline _LIBCPP_HIDE_FROM_ABI
Richard Smith081bb592015-10-08 20:40:34 +00001055typename std::enable_if<std::is_integral<_A1>::value, double>::type
Nikolas Klauser9806f452022-10-12 15:45:09 +02001056sqrt(_A1 __x) _NOEXCEPT {return ::sqrt((double)__x);}
Richard Smith081bb592015-10-08 20:40:34 +00001057
1058// tan
1059
David Tenty7249ac92022-02-07 18:22:35 -05001060# if !defined(__sun__)
Nikolas Klauser9806f452022-10-12 15:45:09 +02001061inline _LIBCPP_HIDE_FROM_ABI float tan(float __x) _NOEXCEPT {return ::tanf(__x);}
1062inline _LIBCPP_HIDE_FROM_ABI long double tan(long double __x) _NOEXCEPT {return ::tanl(__x);}
David Tenty7249ac92022-02-07 18:22:35 -05001063# endif
Richard Smith081bb592015-10-08 20:40:34 +00001064
1065template <class _A1>
Nikolas Klauser4956e722022-10-12 15:41:22 +02001066inline _LIBCPP_HIDE_FROM_ABI
Richard Smith081bb592015-10-08 20:40:34 +00001067typename std::enable_if<std::is_integral<_A1>::value, double>::type
Nikolas Klauser9806f452022-10-12 15:45:09 +02001068tan(_A1 __x) _NOEXCEPT {return ::tan((double)__x);}
Richard Smith081bb592015-10-08 20:40:34 +00001069
1070// tanh
1071
David Tenty7249ac92022-02-07 18:22:35 -05001072# if !defined(__sun__)
Nikolas Klauser9806f452022-10-12 15:45:09 +02001073inline _LIBCPP_HIDE_FROM_ABI float tanh(float __x) _NOEXCEPT {return ::tanhf(__x);}
1074inline _LIBCPP_HIDE_FROM_ABI long double tanh(long double __x) _NOEXCEPT {return ::tanhl(__x);}
David Tenty7249ac92022-02-07 18:22:35 -05001075# endif
Richard Smith081bb592015-10-08 20:40:34 +00001076
1077template <class _A1>
Nikolas Klauser4956e722022-10-12 15:41:22 +02001078inline _LIBCPP_HIDE_FROM_ABI
Richard Smith081bb592015-10-08 20:40:34 +00001079typename std::enable_if<std::is_integral<_A1>::value, double>::type
Nikolas Klauser9806f452022-10-12 15:45:09 +02001080tanh(_A1 __x) _NOEXCEPT {return ::tanh((double)__x);}
Richard Smith081bb592015-10-08 20:40:34 +00001081
1082// acosh
1083
Nikolas Klauser9806f452022-10-12 15:45:09 +02001084inline _LIBCPP_HIDE_FROM_ABI float acosh(float __x) _NOEXCEPT {return ::acoshf(__x);}
1085inline _LIBCPP_HIDE_FROM_ABI long double acosh(long double __x) _NOEXCEPT {return ::acoshl(__x);}
Richard Smith081bb592015-10-08 20:40:34 +00001086
1087template <class _A1>
Nikolas Klauser4956e722022-10-12 15:41:22 +02001088inline _LIBCPP_HIDE_FROM_ABI
Richard Smith081bb592015-10-08 20:40:34 +00001089typename std::enable_if<std::is_integral<_A1>::value, double>::type
Nikolas Klauser9806f452022-10-12 15:45:09 +02001090acosh(_A1 __x) _NOEXCEPT {return ::acosh((double)__x);}
Richard Smith081bb592015-10-08 20:40:34 +00001091
1092// asinh
1093
Nikolas Klauser9806f452022-10-12 15:45:09 +02001094inline _LIBCPP_HIDE_FROM_ABI float asinh(float __x) _NOEXCEPT {return ::asinhf(__x);}
1095inline _LIBCPP_HIDE_FROM_ABI long double asinh(long double __x) _NOEXCEPT {return ::asinhl(__x);}
Richard Smith081bb592015-10-08 20:40:34 +00001096
1097template <class _A1>
Nikolas Klauser4956e722022-10-12 15:41:22 +02001098inline _LIBCPP_HIDE_FROM_ABI
Richard Smith081bb592015-10-08 20:40:34 +00001099typename std::enable_if<std::is_integral<_A1>::value, double>::type
Nikolas Klauser9806f452022-10-12 15:45:09 +02001100asinh(_A1 __x) _NOEXCEPT {return ::asinh((double)__x);}
Richard Smith081bb592015-10-08 20:40:34 +00001101
1102// atanh
1103
Nikolas Klauser9806f452022-10-12 15:45:09 +02001104inline _LIBCPP_HIDE_FROM_ABI float atanh(float __x) _NOEXCEPT {return ::atanhf(__x);}
1105inline _LIBCPP_HIDE_FROM_ABI long double atanh(long double __x) _NOEXCEPT {return ::atanhl(__x);}
Richard Smith081bb592015-10-08 20:40:34 +00001106
1107template <class _A1>
Nikolas Klauser4956e722022-10-12 15:41:22 +02001108inline _LIBCPP_HIDE_FROM_ABI
Richard Smith081bb592015-10-08 20:40:34 +00001109typename std::enable_if<std::is_integral<_A1>::value, double>::type
Nikolas Klauser9806f452022-10-12 15:45:09 +02001110atanh(_A1 __x) _NOEXCEPT {return ::atanh((double)__x);}
Richard Smith081bb592015-10-08 20:40:34 +00001111
1112// cbrt
1113
Nikolas Klauser9806f452022-10-12 15:45:09 +02001114inline _LIBCPP_HIDE_FROM_ABI float cbrt(float __x) _NOEXCEPT {return ::cbrtf(__x);}
1115inline _LIBCPP_HIDE_FROM_ABI long double cbrt(long double __x) _NOEXCEPT {return ::cbrtl(__x);}
Richard Smith081bb592015-10-08 20:40:34 +00001116
1117template <class _A1>
Nikolas Klauser4956e722022-10-12 15:41:22 +02001118inline _LIBCPP_HIDE_FROM_ABI
Richard Smith081bb592015-10-08 20:40:34 +00001119typename std::enable_if<std::is_integral<_A1>::value, double>::type
Nikolas Klauser9806f452022-10-12 15:45:09 +02001120cbrt(_A1 __x) _NOEXCEPT {return ::cbrt((double)__x);}
Richard Smith081bb592015-10-08 20:40:34 +00001121
1122// copysign
1123
Marek Kurdeja933f0d2021-07-21 15:58:17 +02001124#if __has_builtin(__builtin_copysignf)
1125_LIBCPP_CONSTEXPR
1126#endif
Nikolas Klauser9806f452022-10-12 15:45:09 +02001127inline _LIBCPP_HIDE_FROM_ABI float __libcpp_copysign(float __x, float __y) _NOEXCEPT {
Ilya Tokarc3abffb2021-02-10 13:05:19 -05001128#if __has_builtin(__builtin_copysignf)
Nikolas Klauser9806f452022-10-12 15:45:09 +02001129 return __builtin_copysignf(__x, __y);
Ilya Tokarc3abffb2021-02-10 13:05:19 -05001130#else
Nikolas Klauser9806f452022-10-12 15:45:09 +02001131 return ::copysignf(__x, __y);
Ilya Tokarc3abffb2021-02-10 13:05:19 -05001132#endif
Richard Smith081bb592015-10-08 20:40:34 +00001133}
Marek Kurdeja933f0d2021-07-21 15:58:17 +02001134
1135#if __has_builtin(__builtin_copysign)
1136_LIBCPP_CONSTEXPR
1137#endif
Nikolas Klauser9806f452022-10-12 15:45:09 +02001138inline _LIBCPP_HIDE_FROM_ABI double __libcpp_copysign(double __x, double __y) _NOEXCEPT {
Marek Kurdeja933f0d2021-07-21 15:58:17 +02001139#if __has_builtin(__builtin_copysign)
Nikolas Klauser9806f452022-10-12 15:45:09 +02001140 return __builtin_copysign(__x, __y);
Marek Kurdeja933f0d2021-07-21 15:58:17 +02001141#else
Nikolas Klauser9806f452022-10-12 15:45:09 +02001142 return ::copysign(__x, __y);
Marek Kurdeja933f0d2021-07-21 15:58:17 +02001143#endif
1144}
1145
1146#if __has_builtin(__builtin_copysignl)
1147_LIBCPP_CONSTEXPR
1148#endif
Nikolas Klauser9806f452022-10-12 15:45:09 +02001149inline _LIBCPP_HIDE_FROM_ABI long double __libcpp_copysign(long double __x, long double __y) _NOEXCEPT {
Ilya Tokarc3abffb2021-02-10 13:05:19 -05001150#if __has_builtin(__builtin_copysignl)
Nikolas Klauser9806f452022-10-12 15:45:09 +02001151 return __builtin_copysignl(__x, __y);
Ilya Tokarc3abffb2021-02-10 13:05:19 -05001152#else
Nikolas Klauser9806f452022-10-12 15:45:09 +02001153 return ::copysignl(__x, __y);
Ilya Tokarc3abffb2021-02-10 13:05:19 -05001154#endif
Richard Smith081bb592015-10-08 20:40:34 +00001155}
Richard Smith081bb592015-10-08 20:40:34 +00001156
1157template <class _A1, class _A2>
Marek Kurdeja933f0d2021-07-21 15:58:17 +02001158#if __has_builtin(__builtin_copysign)
1159_LIBCPP_CONSTEXPR
1160#endif
Nikolas Klauser4956e722022-10-12 15:41:22 +02001161inline _LIBCPP_HIDE_FROM_ABI
Louis Dionne9ce598d2021-09-08 09:14:43 -04001162typename std::__enable_if_t
Marek Kurdeja933f0d2021-07-21 15:58:17 +02001163<
1164 std::is_arithmetic<_A1>::value &&
1165 std::is_arithmetic<_A2>::value,
1166 std::__promote<_A1, _A2>
1167>::type
Nikolas Klauser9806f452022-10-12 15:45:09 +02001168__libcpp_copysign(_A1 __x, _A2 __y) _NOEXCEPT {
Marek Kurdeja933f0d2021-07-21 15:58:17 +02001169 typedef typename std::__promote<_A1, _A2>::type __result_type;
1170 static_assert((!(std::_IsSame<_A1, __result_type>::value &&
1171 std::_IsSame<_A2, __result_type>::value)), "");
1172#if __has_builtin(__builtin_copysign)
Nikolas Klauser9806f452022-10-12 15:45:09 +02001173 return __builtin_copysign((__result_type)__x, (__result_type)__y);
Marek Kurdeja933f0d2021-07-21 15:58:17 +02001174#else
Nikolas Klauser9806f452022-10-12 15:45:09 +02001175 return ::copysign((__result_type)__x, (__result_type)__y);
Marek Kurdeja933f0d2021-07-21 15:58:17 +02001176#endif
1177}
1178
Nikolas Klauser9806f452022-10-12 15:45:09 +02001179inline _LIBCPP_HIDE_FROM_ABI float copysign(float __x, float __y) _NOEXCEPT {
1180 return ::__libcpp_copysign(__x, __y);
Marek Kurdeja933f0d2021-07-21 15:58:17 +02001181}
1182
Nikolas Klauser9806f452022-10-12 15:45:09 +02001183inline _LIBCPP_HIDE_FROM_ABI long double copysign(long double __x, long double __y) _NOEXCEPT {
1184 return ::__libcpp_copysign(__x, __y);
Marek Kurdeja933f0d2021-07-21 15:58:17 +02001185}
1186
1187template <class _A1, class _A2>
Nikolas Klauser4956e722022-10-12 15:41:22 +02001188inline _LIBCPP_HIDE_FROM_ABI
Louis Dionne9ce598d2021-09-08 09:14:43 -04001189typename std::__enable_if_t
Richard Smith081bb592015-10-08 20:40:34 +00001190<
1191 std::is_arithmetic<_A1>::value &&
1192 std::is_arithmetic<_A2>::value,
1193 std::__promote<_A1, _A2>
1194>::type
Nikolas Klauser9806f452022-10-12 15:45:09 +02001195 copysign(_A1 __x, _A2 __y) _NOEXCEPT {
1196 return ::__libcpp_copysign(__x, __y);
Richard Smith081bb592015-10-08 20:40:34 +00001197}
1198
Richard Smith081bb592015-10-08 20:40:34 +00001199// erf
1200
Nikolas Klauser9806f452022-10-12 15:45:09 +02001201inline _LIBCPP_HIDE_FROM_ABI float erf(float __x) _NOEXCEPT {return ::erff(__x);}
1202inline _LIBCPP_HIDE_FROM_ABI long double erf(long double __x) _NOEXCEPT {return ::erfl(__x);}
Richard Smith081bb592015-10-08 20:40:34 +00001203
1204template <class _A1>
Nikolas Klauser4956e722022-10-12 15:41:22 +02001205inline _LIBCPP_HIDE_FROM_ABI
Richard Smith081bb592015-10-08 20:40:34 +00001206typename std::enable_if<std::is_integral<_A1>::value, double>::type
Nikolas Klauser9806f452022-10-12 15:45:09 +02001207erf(_A1 __x) _NOEXCEPT {return ::erf((double)__x);}
Richard Smith081bb592015-10-08 20:40:34 +00001208
1209// erfc
1210
Nikolas Klauser9806f452022-10-12 15:45:09 +02001211inline _LIBCPP_HIDE_FROM_ABI float erfc(float __x) _NOEXCEPT {return ::erfcf(__x);}
1212inline _LIBCPP_HIDE_FROM_ABI long double erfc(long double __x) _NOEXCEPT {return ::erfcl(__x);}
Richard Smith081bb592015-10-08 20:40:34 +00001213
1214template <class _A1>
Nikolas Klauser4956e722022-10-12 15:41:22 +02001215inline _LIBCPP_HIDE_FROM_ABI
Richard Smith081bb592015-10-08 20:40:34 +00001216typename std::enable_if<std::is_integral<_A1>::value, double>::type
Nikolas Klauser9806f452022-10-12 15:45:09 +02001217erfc(_A1 __x) _NOEXCEPT {return ::erfc((double)__x);}
Richard Smith081bb592015-10-08 20:40:34 +00001218
1219// exp2
1220
Nikolas Klauser9806f452022-10-12 15:45:09 +02001221inline _LIBCPP_HIDE_FROM_ABI float exp2(float __x) _NOEXCEPT {return ::exp2f(__x);}
1222inline _LIBCPP_HIDE_FROM_ABI long double exp2(long double __x) _NOEXCEPT {return ::exp2l(__x);}
Richard Smith081bb592015-10-08 20:40:34 +00001223
1224template <class _A1>
Nikolas Klauser4956e722022-10-12 15:41:22 +02001225inline _LIBCPP_HIDE_FROM_ABI
Richard Smith081bb592015-10-08 20:40:34 +00001226typename std::enable_if<std::is_integral<_A1>::value, double>::type
Nikolas Klauser9806f452022-10-12 15:45:09 +02001227exp2(_A1 __x) _NOEXCEPT {return ::exp2((double)__x);}
Richard Smith081bb592015-10-08 20:40:34 +00001228
1229// expm1
1230
Nikolas Klauser9806f452022-10-12 15:45:09 +02001231inline _LIBCPP_HIDE_FROM_ABI float expm1(float __x) _NOEXCEPT {return ::expm1f(__x);}
1232inline _LIBCPP_HIDE_FROM_ABI long double expm1(long double __x) _NOEXCEPT {return ::expm1l(__x);}
Richard Smith081bb592015-10-08 20:40:34 +00001233
1234template <class _A1>
Nikolas Klauser4956e722022-10-12 15:41:22 +02001235inline _LIBCPP_HIDE_FROM_ABI
Richard Smith081bb592015-10-08 20:40:34 +00001236typename std::enable_if<std::is_integral<_A1>::value, double>::type
Nikolas Klauser9806f452022-10-12 15:45:09 +02001237expm1(_A1 __x) _NOEXCEPT {return ::expm1((double)__x);}
Richard Smith081bb592015-10-08 20:40:34 +00001238
1239// fdim
1240
Nikolas Klauser9806f452022-10-12 15:45:09 +02001241inline _LIBCPP_HIDE_FROM_ABI float fdim(float __x, float __y) _NOEXCEPT {return ::fdimf(__x, __y);}
1242inline _LIBCPP_HIDE_FROM_ABI long double fdim(long double __x, long double __y) _NOEXCEPT {return ::fdiml(__x, __y);}
Richard Smith081bb592015-10-08 20:40:34 +00001243
1244template <class _A1, class _A2>
Nikolas Klauser4956e722022-10-12 15:41:22 +02001245inline _LIBCPP_HIDE_FROM_ABI
Louis Dionne9ce598d2021-09-08 09:14:43 -04001246typename std::__enable_if_t
Richard Smith081bb592015-10-08 20:40:34 +00001247<
1248 std::is_arithmetic<_A1>::value &&
1249 std::is_arithmetic<_A2>::value,
1250 std::__promote<_A1, _A2>
1251>::type
Nikolas Klauser9806f452022-10-12 15:45:09 +02001252fdim(_A1 __x, _A2 __y) _NOEXCEPT
Richard Smith081bb592015-10-08 20:40:34 +00001253{
1254 typedef typename std::__promote<_A1, _A2>::type __result_type;
Eric Fiselier3906a132019-06-23 20:28:29 +00001255 static_assert((!(std::_IsSame<_A1, __result_type>::value &&
1256 std::_IsSame<_A2, __result_type>::value)), "");
Nikolas Klauser9806f452022-10-12 15:45:09 +02001257 return ::fdim((__result_type)__x, (__result_type)__y);
Richard Smith081bb592015-10-08 20:40:34 +00001258}
1259
1260// fma
1261
Nikolas Klauser9806f452022-10-12 15:45:09 +02001262inline _LIBCPP_HIDE_FROM_ABI float fma(float __x, float __y, float __z) _NOEXCEPT
Ilya Tokarc3abffb2021-02-10 13:05:19 -05001263{
1264#if __has_builtin(__builtin_fmaf)
Nikolas Klauser9806f452022-10-12 15:45:09 +02001265 return __builtin_fmaf(__x, __y, __z);
Ilya Tokarc3abffb2021-02-10 13:05:19 -05001266#else
Nikolas Klauser9806f452022-10-12 15:45:09 +02001267 return ::fmaf(__x, __y, __z);
Ilya Tokarc3abffb2021-02-10 13:05:19 -05001268#endif
1269}
Nikolas Klauser9806f452022-10-12 15:45:09 +02001270inline _LIBCPP_HIDE_FROM_ABI long double fma(long double __x, long double __y, long double __z) _NOEXCEPT
Ilya Tokarc3abffb2021-02-10 13:05:19 -05001271{
1272#if __has_builtin(__builtin_fmal)
Nikolas Klauser9806f452022-10-12 15:45:09 +02001273 return __builtin_fmal(__x, __y, __z);
Ilya Tokarc3abffb2021-02-10 13:05:19 -05001274#else
Nikolas Klauser9806f452022-10-12 15:45:09 +02001275 return ::fmal(__x, __y, __z);
Ilya Tokarc3abffb2021-02-10 13:05:19 -05001276#endif
1277}
Richard Smith081bb592015-10-08 20:40:34 +00001278
1279template <class _A1, class _A2, class _A3>
Nikolas Klauser4956e722022-10-12 15:41:22 +02001280inline _LIBCPP_HIDE_FROM_ABI
Louis Dionne9ce598d2021-09-08 09:14:43 -04001281typename std::__enable_if_t
Richard Smith081bb592015-10-08 20:40:34 +00001282<
1283 std::is_arithmetic<_A1>::value &&
1284 std::is_arithmetic<_A2>::value &&
1285 std::is_arithmetic<_A3>::value,
1286 std::__promote<_A1, _A2, _A3>
1287>::type
Nikolas Klauser9806f452022-10-12 15:45:09 +02001288fma(_A1 __x, _A2 __y, _A3 __z) _NOEXCEPT
Richard Smith081bb592015-10-08 20:40:34 +00001289{
1290 typedef typename std::__promote<_A1, _A2, _A3>::type __result_type;
Eric Fiselier3906a132019-06-23 20:28:29 +00001291 static_assert((!(std::_IsSame<_A1, __result_type>::value &&
1292 std::_IsSame<_A2, __result_type>::value &&
1293 std::_IsSame<_A3, __result_type>::value)), "");
Ilya Tokarc3abffb2021-02-10 13:05:19 -05001294#if __has_builtin(__builtin_fma)
Nikolas Klauser9806f452022-10-12 15:45:09 +02001295 return __builtin_fma((__result_type)__x, (__result_type)__y, (__result_type)__z);
Ilya Tokarc3abffb2021-02-10 13:05:19 -05001296#else
Nikolas Klauser9806f452022-10-12 15:45:09 +02001297 return ::fma((__result_type)__x, (__result_type)__y, (__result_type)__z);
Ilya Tokarc3abffb2021-02-10 13:05:19 -05001298#endif
Richard Smith081bb592015-10-08 20:40:34 +00001299}
1300
1301// fmax
1302
Nikolas Klauser9806f452022-10-12 15:45:09 +02001303inline _LIBCPP_HIDE_FROM_ABI float fmax(float __x, float __y) _NOEXCEPT {return ::fmaxf(__x, __y);}
1304inline _LIBCPP_HIDE_FROM_ABI long double fmax(long double __x, long double __y) _NOEXCEPT {return ::fmaxl(__x, __y);}
Richard Smith081bb592015-10-08 20:40:34 +00001305
1306template <class _A1, class _A2>
Nikolas Klauser4956e722022-10-12 15:41:22 +02001307inline _LIBCPP_HIDE_FROM_ABI
Louis Dionne9ce598d2021-09-08 09:14:43 -04001308typename std::__enable_if_t
Richard Smith081bb592015-10-08 20:40:34 +00001309<
1310 std::is_arithmetic<_A1>::value &&
1311 std::is_arithmetic<_A2>::value,
1312 std::__promote<_A1, _A2>
1313>::type
Nikolas Klauser9806f452022-10-12 15:45:09 +02001314fmax(_A1 __x, _A2 __y) _NOEXCEPT
Richard Smith081bb592015-10-08 20:40:34 +00001315{
1316 typedef typename std::__promote<_A1, _A2>::type __result_type;
Eric Fiselier3906a132019-06-23 20:28:29 +00001317 static_assert((!(std::_IsSame<_A1, __result_type>::value &&
1318 std::_IsSame<_A2, __result_type>::value)), "");
Nikolas Klauser9806f452022-10-12 15:45:09 +02001319 return ::fmax((__result_type)__x, (__result_type)__y);
Richard Smith081bb592015-10-08 20:40:34 +00001320}
1321
1322// fmin
1323
Nikolas Klauser9806f452022-10-12 15:45:09 +02001324inline _LIBCPP_HIDE_FROM_ABI float fmin(float __x, float __y) _NOEXCEPT {return ::fminf(__x, __y);}
1325inline _LIBCPP_HIDE_FROM_ABI long double fmin(long double __x, long double __y) _NOEXCEPT {return ::fminl(__x, __y);}
Richard Smith081bb592015-10-08 20:40:34 +00001326
1327template <class _A1, class _A2>
Nikolas Klauser4956e722022-10-12 15:41:22 +02001328inline _LIBCPP_HIDE_FROM_ABI
Louis Dionne9ce598d2021-09-08 09:14:43 -04001329typename std::__enable_if_t
Richard Smith081bb592015-10-08 20:40:34 +00001330<
1331 std::is_arithmetic<_A1>::value &&
1332 std::is_arithmetic<_A2>::value,
1333 std::__promote<_A1, _A2>
1334>::type
Nikolas Klauser9806f452022-10-12 15:45:09 +02001335fmin(_A1 __x, _A2 __y) _NOEXCEPT
Richard Smith081bb592015-10-08 20:40:34 +00001336{
1337 typedef typename std::__promote<_A1, _A2>::type __result_type;
Eric Fiselier3906a132019-06-23 20:28:29 +00001338 static_assert((!(std::_IsSame<_A1, __result_type>::value &&
1339 std::_IsSame<_A2, __result_type>::value)), "");
Nikolas Klauser9806f452022-10-12 15:45:09 +02001340 return ::fmin((__result_type)__x, (__result_type)__y);
Richard Smith081bb592015-10-08 20:40:34 +00001341}
1342
1343// hypot
1344
Nikolas Klauser9806f452022-10-12 15:45:09 +02001345inline _LIBCPP_HIDE_FROM_ABI float hypot(float __x, float __y) _NOEXCEPT {return ::hypotf(__x, __y);}
1346inline _LIBCPP_HIDE_FROM_ABI long double hypot(long double __x, long double __y) _NOEXCEPT {return ::hypotl(__x, __y);}
Richard Smith081bb592015-10-08 20:40:34 +00001347
1348template <class _A1, class _A2>
Nikolas Klauser4956e722022-10-12 15:41:22 +02001349inline _LIBCPP_HIDE_FROM_ABI
Louis Dionne9ce598d2021-09-08 09:14:43 -04001350typename std::__enable_if_t
Richard Smith081bb592015-10-08 20:40:34 +00001351<
1352 std::is_arithmetic<_A1>::value &&
1353 std::is_arithmetic<_A2>::value,
1354 std::__promote<_A1, _A2>
1355>::type
Nikolas Klauser9806f452022-10-12 15:45:09 +02001356hypot(_A1 __x, _A2 __y) _NOEXCEPT
Richard Smith081bb592015-10-08 20:40:34 +00001357{
1358 typedef typename std::__promote<_A1, _A2>::type __result_type;
Eric Fiselier3906a132019-06-23 20:28:29 +00001359 static_assert((!(std::_IsSame<_A1, __result_type>::value &&
1360 std::_IsSame<_A2, __result_type>::value)), "");
Nikolas Klauser9806f452022-10-12 15:45:09 +02001361 return ::hypot((__result_type)__x, (__result_type)__y);
Richard Smith081bb592015-10-08 20:40:34 +00001362}
1363
1364// ilogb
1365
Nikolas Klauser9806f452022-10-12 15:45:09 +02001366inline _LIBCPP_HIDE_FROM_ABI int ilogb(float __x) _NOEXCEPT {return ::ilogbf(__x);}
1367inline _LIBCPP_HIDE_FROM_ABI int ilogb(long double __x) _NOEXCEPT {return ::ilogbl(__x);}
Richard Smith081bb592015-10-08 20:40:34 +00001368
1369template <class _A1>
Nikolas Klauser4956e722022-10-12 15:41:22 +02001370inline _LIBCPP_HIDE_FROM_ABI
Richard Smith081bb592015-10-08 20:40:34 +00001371typename std::enable_if<std::is_integral<_A1>::value, int>::type
Nikolas Klauser9806f452022-10-12 15:45:09 +02001372ilogb(_A1 __x) _NOEXCEPT {return ::ilogb((double)__x);}
Richard Smith081bb592015-10-08 20:40:34 +00001373
1374// lgamma
1375
Nikolas Klauser9806f452022-10-12 15:45:09 +02001376inline _LIBCPP_HIDE_FROM_ABI float lgamma(float __x) _NOEXCEPT {return ::lgammaf(__x);}
1377inline _LIBCPP_HIDE_FROM_ABI long double lgamma(long double __x) _NOEXCEPT {return ::lgammal(__x);}
Richard Smith081bb592015-10-08 20:40:34 +00001378
1379template <class _A1>
Nikolas Klauser4956e722022-10-12 15:41:22 +02001380inline _LIBCPP_HIDE_FROM_ABI
Richard Smith081bb592015-10-08 20:40:34 +00001381typename std::enable_if<std::is_integral<_A1>::value, double>::type
Nikolas Klauser9806f452022-10-12 15:45:09 +02001382lgamma(_A1 __x) _NOEXCEPT {return ::lgamma((double)__x);}
Richard Smith081bb592015-10-08 20:40:34 +00001383
1384// llrint
1385
Nikolas Klauser9806f452022-10-12 15:45:09 +02001386inline _LIBCPP_HIDE_FROM_ABI long long llrint(float __x) _NOEXCEPT
Ilya Tokarc3abffb2021-02-10 13:05:19 -05001387{
1388#if __has_builtin(__builtin_llrintf)
Nikolas Klauser9806f452022-10-12 15:45:09 +02001389 return __builtin_llrintf(__x);
Ilya Tokarc3abffb2021-02-10 13:05:19 -05001390#else
Nikolas Klauser9806f452022-10-12 15:45:09 +02001391 return ::llrintf(__x);
Ilya Tokarc3abffb2021-02-10 13:05:19 -05001392#endif
1393}
Nikolas Klauser9806f452022-10-12 15:45:09 +02001394inline _LIBCPP_HIDE_FROM_ABI long long llrint(long double __x) _NOEXCEPT
Ilya Tokarc3abffb2021-02-10 13:05:19 -05001395{
1396#if __has_builtin(__builtin_llrintl)
Nikolas Klauser9806f452022-10-12 15:45:09 +02001397 return __builtin_llrintl(__x);
Ilya Tokarc3abffb2021-02-10 13:05:19 -05001398#else
Nikolas Klauser9806f452022-10-12 15:45:09 +02001399 return ::llrintl(__x);
Ilya Tokarc3abffb2021-02-10 13:05:19 -05001400#endif
1401}
Richard Smith081bb592015-10-08 20:40:34 +00001402
1403template <class _A1>
Nikolas Klauser4956e722022-10-12 15:41:22 +02001404inline _LIBCPP_HIDE_FROM_ABI
Richard Smith081bb592015-10-08 20:40:34 +00001405typename std::enable_if<std::is_integral<_A1>::value, long long>::type
Nikolas Klauser9806f452022-10-12 15:45:09 +02001406llrint(_A1 __x) _NOEXCEPT
Ilya Tokarc3abffb2021-02-10 13:05:19 -05001407{
1408#if __has_builtin(__builtin_llrint)
Nikolas Klauser9806f452022-10-12 15:45:09 +02001409 return __builtin_llrint((double)__x);
Ilya Tokarc3abffb2021-02-10 13:05:19 -05001410#else
Nikolas Klauser9806f452022-10-12 15:45:09 +02001411 return ::llrint((double)__x);
Ilya Tokarc3abffb2021-02-10 13:05:19 -05001412#endif
1413}
Richard Smith081bb592015-10-08 20:40:34 +00001414
1415// llround
1416
Nikolas Klauser9806f452022-10-12 15:45:09 +02001417inline _LIBCPP_HIDE_FROM_ABI long long llround(float __x) _NOEXCEPT
Ilya Tokarc3abffb2021-02-10 13:05:19 -05001418{
1419#if __has_builtin(__builtin_llroundf)
Nikolas Klauser9806f452022-10-12 15:45:09 +02001420 return __builtin_llroundf(__x);
Ilya Tokarc3abffb2021-02-10 13:05:19 -05001421#else
Nikolas Klauser9806f452022-10-12 15:45:09 +02001422 return ::llroundf(__x);
Ilya Tokarc3abffb2021-02-10 13:05:19 -05001423#endif
1424}
Nikolas Klauser9806f452022-10-12 15:45:09 +02001425inline _LIBCPP_HIDE_FROM_ABI long long llround(long double __x) _NOEXCEPT
Ilya Tokarc3abffb2021-02-10 13:05:19 -05001426{
1427#if __has_builtin(__builtin_llroundl)
Nikolas Klauser9806f452022-10-12 15:45:09 +02001428 return __builtin_llroundl(__x);
Ilya Tokarc3abffb2021-02-10 13:05:19 -05001429#else
Nikolas Klauser9806f452022-10-12 15:45:09 +02001430 return ::llroundl(__x);
Ilya Tokarc3abffb2021-02-10 13:05:19 -05001431#endif
1432}
Richard Smith081bb592015-10-08 20:40:34 +00001433
1434template <class _A1>
Nikolas Klauser4956e722022-10-12 15:41:22 +02001435inline _LIBCPP_HIDE_FROM_ABI
Richard Smith081bb592015-10-08 20:40:34 +00001436typename std::enable_if<std::is_integral<_A1>::value, long long>::type
Nikolas Klauser9806f452022-10-12 15:45:09 +02001437llround(_A1 __x) _NOEXCEPT
Ilya Tokarc3abffb2021-02-10 13:05:19 -05001438{
1439#if __has_builtin(__builtin_llround)
Nikolas Klauser9806f452022-10-12 15:45:09 +02001440 return __builtin_llround((double)__x);
Ilya Tokarc3abffb2021-02-10 13:05:19 -05001441#else
Nikolas Klauser9806f452022-10-12 15:45:09 +02001442 return ::llround((double)__x);
Ilya Tokarc3abffb2021-02-10 13:05:19 -05001443#endif
1444}
Richard Smith081bb592015-10-08 20:40:34 +00001445
1446// log1p
1447
Nikolas Klauser9806f452022-10-12 15:45:09 +02001448inline _LIBCPP_HIDE_FROM_ABI float log1p(float __x) _NOEXCEPT {return ::log1pf(__x);}
1449inline _LIBCPP_HIDE_FROM_ABI long double log1p(long double __x) _NOEXCEPT {return ::log1pl(__x);}
Richard Smith081bb592015-10-08 20:40:34 +00001450
1451template <class _A1>
Nikolas Klauser4956e722022-10-12 15:41:22 +02001452inline _LIBCPP_HIDE_FROM_ABI
Richard Smith081bb592015-10-08 20:40:34 +00001453typename std::enable_if<std::is_integral<_A1>::value, double>::type
Nikolas Klauser9806f452022-10-12 15:45:09 +02001454log1p(_A1 __x) _NOEXCEPT {return ::log1p((double)__x);}
Richard Smith081bb592015-10-08 20:40:34 +00001455
1456// log2
1457
Nikolas Klauser9806f452022-10-12 15:45:09 +02001458inline _LIBCPP_HIDE_FROM_ABI float log2(float __x) _NOEXCEPT {return ::log2f(__x);}
1459inline _LIBCPP_HIDE_FROM_ABI long double log2(long double __x) _NOEXCEPT {return ::log2l(__x);}
Richard Smith081bb592015-10-08 20:40:34 +00001460
1461template <class _A1>
Nikolas Klauser4956e722022-10-12 15:41:22 +02001462inline _LIBCPP_HIDE_FROM_ABI
Richard Smith081bb592015-10-08 20:40:34 +00001463typename std::enable_if<std::is_integral<_A1>::value, double>::type
Nikolas Klauser9806f452022-10-12 15:45:09 +02001464log2(_A1 __x) _NOEXCEPT {return ::log2((double)__x);}
Richard Smith081bb592015-10-08 20:40:34 +00001465
1466// logb
1467
Nikolas Klauser9806f452022-10-12 15:45:09 +02001468inline _LIBCPP_HIDE_FROM_ABI float logb(float __x) _NOEXCEPT {return ::logbf(__x);}
1469inline _LIBCPP_HIDE_FROM_ABI long double logb(long double __x) _NOEXCEPT {return ::logbl(__x);}
Richard Smith081bb592015-10-08 20:40:34 +00001470
1471template <class _A1>
Nikolas Klauser4956e722022-10-12 15:41:22 +02001472inline _LIBCPP_HIDE_FROM_ABI
Richard Smith081bb592015-10-08 20:40:34 +00001473typename std::enable_if<std::is_integral<_A1>::value, double>::type
Nikolas Klauser9806f452022-10-12 15:45:09 +02001474logb(_A1 __x) _NOEXCEPT {return ::logb((double)__x);}
Richard Smith081bb592015-10-08 20:40:34 +00001475
1476// lrint
1477
Nikolas Klauser9806f452022-10-12 15:45:09 +02001478inline _LIBCPP_HIDE_FROM_ABI long lrint(float __x) _NOEXCEPT
Ilya Tokarc3abffb2021-02-10 13:05:19 -05001479{
1480#if __has_builtin(__builtin_lrintf)
Nikolas Klauser9806f452022-10-12 15:45:09 +02001481 return __builtin_lrintf(__x);
Ilya Tokarc3abffb2021-02-10 13:05:19 -05001482#else
Nikolas Klauser9806f452022-10-12 15:45:09 +02001483 return ::lrintf(__x);
Ilya Tokarc3abffb2021-02-10 13:05:19 -05001484#endif
1485}
Nikolas Klauser9806f452022-10-12 15:45:09 +02001486inline _LIBCPP_HIDE_FROM_ABI long lrint(long double __x) _NOEXCEPT
Ilya Tokarc3abffb2021-02-10 13:05:19 -05001487{
1488#if __has_builtin(__builtin_lrintl)
Nikolas Klauser9806f452022-10-12 15:45:09 +02001489 return __builtin_lrintl(__x);
Ilya Tokarc3abffb2021-02-10 13:05:19 -05001490#else
Nikolas Klauser9806f452022-10-12 15:45:09 +02001491 return ::lrintl(__x);
Ilya Tokarc3abffb2021-02-10 13:05:19 -05001492#endif
1493}
Richard Smith081bb592015-10-08 20:40:34 +00001494
1495template <class _A1>
Nikolas Klauser4956e722022-10-12 15:41:22 +02001496inline _LIBCPP_HIDE_FROM_ABI
Richard Smith081bb592015-10-08 20:40:34 +00001497typename std::enable_if<std::is_integral<_A1>::value, long>::type
Nikolas Klauser9806f452022-10-12 15:45:09 +02001498lrint(_A1 __x) _NOEXCEPT
Ilya Tokarc3abffb2021-02-10 13:05:19 -05001499{
1500#if __has_builtin(__builtin_lrint)
Nikolas Klauser9806f452022-10-12 15:45:09 +02001501 return __builtin_lrint((double)__x);
Ilya Tokarc3abffb2021-02-10 13:05:19 -05001502#else
Nikolas Klauser9806f452022-10-12 15:45:09 +02001503 return ::lrint((double)__x);
Ilya Tokarc3abffb2021-02-10 13:05:19 -05001504#endif
1505}
Richard Smith081bb592015-10-08 20:40:34 +00001506
1507// lround
1508
Nikolas Klauser9806f452022-10-12 15:45:09 +02001509inline _LIBCPP_HIDE_FROM_ABI long lround(float __x) _NOEXCEPT
Ilya Tokarc3abffb2021-02-10 13:05:19 -05001510{
1511#if __has_builtin(__builtin_lroundf)
Nikolas Klauser9806f452022-10-12 15:45:09 +02001512 return __builtin_lroundf(__x);
Ilya Tokarc3abffb2021-02-10 13:05:19 -05001513#else
Nikolas Klauser9806f452022-10-12 15:45:09 +02001514 return ::lroundf(__x);
Ilya Tokarc3abffb2021-02-10 13:05:19 -05001515#endif
1516}
Nikolas Klauser9806f452022-10-12 15:45:09 +02001517inline _LIBCPP_HIDE_FROM_ABI long lround(long double __x) _NOEXCEPT
Ilya Tokarc3abffb2021-02-10 13:05:19 -05001518{
1519#if __has_builtin(__builtin_lroundl)
Nikolas Klauser9806f452022-10-12 15:45:09 +02001520 return __builtin_lroundl(__x);
Ilya Tokarc3abffb2021-02-10 13:05:19 -05001521#else
Nikolas Klauser9806f452022-10-12 15:45:09 +02001522 return ::lroundl(__x);
Ilya Tokarc3abffb2021-02-10 13:05:19 -05001523#endif
1524}
Richard Smith081bb592015-10-08 20:40:34 +00001525
1526template <class _A1>
Nikolas Klauser4956e722022-10-12 15:41:22 +02001527inline _LIBCPP_HIDE_FROM_ABI
Richard Smith081bb592015-10-08 20:40:34 +00001528typename std::enable_if<std::is_integral<_A1>::value, long>::type
Nikolas Klauser9806f452022-10-12 15:45:09 +02001529lround(_A1 __x) _NOEXCEPT
Ilya Tokarc3abffb2021-02-10 13:05:19 -05001530{
1531#if __has_builtin(__builtin_lround)
Nikolas Klauser9806f452022-10-12 15:45:09 +02001532 return __builtin_lround((double)__x);
Ilya Tokarc3abffb2021-02-10 13:05:19 -05001533#else
Nikolas Klauser9806f452022-10-12 15:45:09 +02001534 return ::lround((double)__x);
Ilya Tokarc3abffb2021-02-10 13:05:19 -05001535#endif
1536}
Richard Smith081bb592015-10-08 20:40:34 +00001537
1538// nan
1539
1540// nearbyint
1541
Nikolas Klauser9806f452022-10-12 15:45:09 +02001542inline _LIBCPP_HIDE_FROM_ABI float nearbyint(float __x) _NOEXCEPT {return ::nearbyintf(__x);}
1543inline _LIBCPP_HIDE_FROM_ABI long double nearbyint(long double __x) _NOEXCEPT {return ::nearbyintl(__x);}
Richard Smith081bb592015-10-08 20:40:34 +00001544
1545template <class _A1>
Nikolas Klauser4956e722022-10-12 15:41:22 +02001546inline _LIBCPP_HIDE_FROM_ABI
Richard Smith081bb592015-10-08 20:40:34 +00001547typename std::enable_if<std::is_integral<_A1>::value, double>::type
Nikolas Klauser9806f452022-10-12 15:45:09 +02001548nearbyint(_A1 __x) _NOEXCEPT {return ::nearbyint((double)__x);}
Richard Smith081bb592015-10-08 20:40:34 +00001549
1550// nextafter
1551
Nikolas Klauser9806f452022-10-12 15:45:09 +02001552inline _LIBCPP_HIDE_FROM_ABI float nextafter(float __x, float __y) _NOEXCEPT {return ::nextafterf(__x, __y);}
1553inline _LIBCPP_HIDE_FROM_ABI long double nextafter(long double __x, long double __y) _NOEXCEPT {return ::nextafterl(__x, __y);}
Richard Smith081bb592015-10-08 20:40:34 +00001554
1555template <class _A1, class _A2>
Nikolas Klauser4956e722022-10-12 15:41:22 +02001556inline _LIBCPP_HIDE_FROM_ABI
Louis Dionne9ce598d2021-09-08 09:14:43 -04001557typename std::__enable_if_t
Richard Smith081bb592015-10-08 20:40:34 +00001558<
1559 std::is_arithmetic<_A1>::value &&
1560 std::is_arithmetic<_A2>::value,
1561 std::__promote<_A1, _A2>
1562>::type
Nikolas Klauser9806f452022-10-12 15:45:09 +02001563nextafter(_A1 __x, _A2 __y) _NOEXCEPT
Richard Smith081bb592015-10-08 20:40:34 +00001564{
1565 typedef typename std::__promote<_A1, _A2>::type __result_type;
Eric Fiselier3906a132019-06-23 20:28:29 +00001566 static_assert((!(std::_IsSame<_A1, __result_type>::value &&
1567 std::_IsSame<_A2, __result_type>::value)), "");
Nikolas Klauser9806f452022-10-12 15:45:09 +02001568 return ::nextafter((__result_type)__x, (__result_type)__y);
Richard Smith081bb592015-10-08 20:40:34 +00001569}
1570
1571// nexttoward
1572
Nikolas Klauser9806f452022-10-12 15:45:09 +02001573inline _LIBCPP_HIDE_FROM_ABI float nexttoward(float __x, long double __y) _NOEXCEPT {return ::nexttowardf(__x, __y);}
1574inline _LIBCPP_HIDE_FROM_ABI long double nexttoward(long double __x, long double __y) _NOEXCEPT {return ::nexttowardl(__x, __y);}
Richard Smith081bb592015-10-08 20:40:34 +00001575
1576template <class _A1>
Nikolas Klauser4956e722022-10-12 15:41:22 +02001577inline _LIBCPP_HIDE_FROM_ABI
Richard Smith081bb592015-10-08 20:40:34 +00001578typename std::enable_if<std::is_integral<_A1>::value, double>::type
Nikolas Klauser9806f452022-10-12 15:45:09 +02001579nexttoward(_A1 __x, long double __y) _NOEXCEPT {return ::nexttoward((double)__x, __y);}
Richard Smith081bb592015-10-08 20:40:34 +00001580
1581// remainder
1582
Nikolas Klauser9806f452022-10-12 15:45:09 +02001583inline _LIBCPP_HIDE_FROM_ABI float remainder(float __x, float __y) _NOEXCEPT {return ::remainderf(__x, __y);}
1584inline _LIBCPP_HIDE_FROM_ABI long double remainder(long double __x, long double __y) _NOEXCEPT {return ::remainderl(__x, __y);}
Richard Smith081bb592015-10-08 20:40:34 +00001585
1586template <class _A1, class _A2>
Nikolas Klauser4956e722022-10-12 15:41:22 +02001587inline _LIBCPP_HIDE_FROM_ABI
Louis Dionne9ce598d2021-09-08 09:14:43 -04001588typename std::__enable_if_t
Richard Smith081bb592015-10-08 20:40:34 +00001589<
1590 std::is_arithmetic<_A1>::value &&
1591 std::is_arithmetic<_A2>::value,
1592 std::__promote<_A1, _A2>
1593>::type
Nikolas Klauser9806f452022-10-12 15:45:09 +02001594remainder(_A1 __x, _A2 __y) _NOEXCEPT
Richard Smith081bb592015-10-08 20:40:34 +00001595{
1596 typedef typename std::__promote<_A1, _A2>::type __result_type;
Eric Fiselier3906a132019-06-23 20:28:29 +00001597 static_assert((!(std::_IsSame<_A1, __result_type>::value &&
1598 std::_IsSame<_A2, __result_type>::value)), "");
Nikolas Klauser9806f452022-10-12 15:45:09 +02001599 return ::remainder((__result_type)__x, (__result_type)__y);
Richard Smith081bb592015-10-08 20:40:34 +00001600}
1601
1602// remquo
1603
Nikolas Klauser9806f452022-10-12 15:45:09 +02001604inline _LIBCPP_HIDE_FROM_ABI float remquo(float __x, float __y, int* __z) _NOEXCEPT {return ::remquof(__x, __y, __z);}
1605inline _LIBCPP_HIDE_FROM_ABI long double remquo(long double __x, long double __y, int* __z) _NOEXCEPT {return ::remquol(__x, __y, __z);}
Richard Smith081bb592015-10-08 20:40:34 +00001606
1607template <class _A1, class _A2>
Nikolas Klauser4956e722022-10-12 15:41:22 +02001608inline _LIBCPP_HIDE_FROM_ABI
Louis Dionne9ce598d2021-09-08 09:14:43 -04001609typename std::__enable_if_t
Richard Smith081bb592015-10-08 20:40:34 +00001610<
1611 std::is_arithmetic<_A1>::value &&
1612 std::is_arithmetic<_A2>::value,
1613 std::__promote<_A1, _A2>
1614>::type
Nikolas Klauser9806f452022-10-12 15:45:09 +02001615remquo(_A1 __x, _A2 __y, int* __z) _NOEXCEPT
Richard Smith081bb592015-10-08 20:40:34 +00001616{
1617 typedef typename std::__promote<_A1, _A2>::type __result_type;
Eric Fiselier3906a132019-06-23 20:28:29 +00001618 static_assert((!(std::_IsSame<_A1, __result_type>::value &&
1619 std::_IsSame<_A2, __result_type>::value)), "");
Nikolas Klauser9806f452022-10-12 15:45:09 +02001620 return ::remquo((__result_type)__x, (__result_type)__y, __z);
Richard Smith081bb592015-10-08 20:40:34 +00001621}
1622
1623// rint
1624
Nikolas Klauser9806f452022-10-12 15:45:09 +02001625inline _LIBCPP_HIDE_FROM_ABI float rint(float __x) _NOEXCEPT
Ilya Tokarc3abffb2021-02-10 13:05:19 -05001626{
1627#if __has_builtin(__builtin_rintf)
Nikolas Klauser9806f452022-10-12 15:45:09 +02001628 return __builtin_rintf(__x);
Ilya Tokarc3abffb2021-02-10 13:05:19 -05001629#else
Nikolas Klauser9806f452022-10-12 15:45:09 +02001630 return ::rintf(__x);
Ilya Tokarc3abffb2021-02-10 13:05:19 -05001631#endif
1632}
Nikolas Klauser9806f452022-10-12 15:45:09 +02001633inline _LIBCPP_HIDE_FROM_ABI long double rint(long double __x) _NOEXCEPT
Ilya Tokarc3abffb2021-02-10 13:05:19 -05001634{
1635#if __has_builtin(__builtin_rintl)
Nikolas Klauser9806f452022-10-12 15:45:09 +02001636 return __builtin_rintl(__x);
Ilya Tokarc3abffb2021-02-10 13:05:19 -05001637#else
Nikolas Klauser9806f452022-10-12 15:45:09 +02001638 return ::rintl(__x);
Ilya Tokarc3abffb2021-02-10 13:05:19 -05001639#endif
1640}
Richard Smith081bb592015-10-08 20:40:34 +00001641
1642template <class _A1>
Nikolas Klauser4956e722022-10-12 15:41:22 +02001643inline _LIBCPP_HIDE_FROM_ABI
Richard Smith081bb592015-10-08 20:40:34 +00001644typename std::enable_if<std::is_integral<_A1>::value, double>::type
Nikolas Klauser9806f452022-10-12 15:45:09 +02001645rint(_A1 __x) _NOEXCEPT
Ilya Tokarc3abffb2021-02-10 13:05:19 -05001646{
1647#if __has_builtin(__builtin_rint)
Nikolas Klauser9806f452022-10-12 15:45:09 +02001648 return __builtin_rint((double)__x);
Ilya Tokarc3abffb2021-02-10 13:05:19 -05001649#else
Nikolas Klauser9806f452022-10-12 15:45:09 +02001650 return ::rint((double)__x);
Ilya Tokarc3abffb2021-02-10 13:05:19 -05001651#endif
1652}
Richard Smith081bb592015-10-08 20:40:34 +00001653
1654// round
1655
Nikolas Klauser9806f452022-10-12 15:45:09 +02001656inline _LIBCPP_HIDE_FROM_ABI float round(float __x) _NOEXCEPT
Ilya Tokarc3abffb2021-02-10 13:05:19 -05001657{
1658#if __has_builtin(__builtin_round)
Nikolas Klauser9806f452022-10-12 15:45:09 +02001659 return __builtin_round(__x);
Ilya Tokarc3abffb2021-02-10 13:05:19 -05001660#else
Nikolas Klauser9806f452022-10-12 15:45:09 +02001661 return ::round(__x);
Ilya Tokarc3abffb2021-02-10 13:05:19 -05001662#endif
1663}
Nikolas Klauser9806f452022-10-12 15:45:09 +02001664inline _LIBCPP_HIDE_FROM_ABI long double round(long double __x) _NOEXCEPT
Ilya Tokarc3abffb2021-02-10 13:05:19 -05001665{
1666#if __has_builtin(__builtin_roundl)
Nikolas Klauser9806f452022-10-12 15:45:09 +02001667 return __builtin_roundl(__x);
Ilya Tokarc3abffb2021-02-10 13:05:19 -05001668#else
Nikolas Klauser9806f452022-10-12 15:45:09 +02001669 return ::roundl(__x);
Ilya Tokarc3abffb2021-02-10 13:05:19 -05001670#endif
1671}
Richard Smith081bb592015-10-08 20:40:34 +00001672
1673template <class _A1>
Nikolas Klauser4956e722022-10-12 15:41:22 +02001674inline _LIBCPP_HIDE_FROM_ABI
Richard Smith081bb592015-10-08 20:40:34 +00001675typename std::enable_if<std::is_integral<_A1>::value, double>::type
Nikolas Klauser9806f452022-10-12 15:45:09 +02001676round(_A1 __x) _NOEXCEPT
Ilya Tokarc3abffb2021-02-10 13:05:19 -05001677{
1678#if __has_builtin(__builtin_round)
Nikolas Klauser9806f452022-10-12 15:45:09 +02001679 return __builtin_round((double)__x);
Ilya Tokarc3abffb2021-02-10 13:05:19 -05001680#else
Nikolas Klauser9806f452022-10-12 15:45:09 +02001681 return ::round((double)__x);
Ilya Tokarc3abffb2021-02-10 13:05:19 -05001682#endif
1683}
Richard Smith081bb592015-10-08 20:40:34 +00001684
1685// scalbln
1686
Nikolas Klauser9806f452022-10-12 15:45:09 +02001687inline _LIBCPP_HIDE_FROM_ABI float scalbln(float __x, long __y) _NOEXCEPT {return ::scalblnf(__x, __y);}
1688inline _LIBCPP_HIDE_FROM_ABI long double scalbln(long double __x, long __y) _NOEXCEPT {return ::scalblnl(__x, __y);}
Richard Smith081bb592015-10-08 20:40:34 +00001689
1690template <class _A1>
Nikolas Klauser4956e722022-10-12 15:41:22 +02001691inline _LIBCPP_HIDE_FROM_ABI
Richard Smith081bb592015-10-08 20:40:34 +00001692typename std::enable_if<std::is_integral<_A1>::value, double>::type
Nikolas Klauser9806f452022-10-12 15:45:09 +02001693scalbln(_A1 __x, long __y) _NOEXCEPT {return ::scalbln((double)__x, __y);}
Richard Smith081bb592015-10-08 20:40:34 +00001694
1695// scalbn
1696
Nikolas Klauser9806f452022-10-12 15:45:09 +02001697inline _LIBCPP_HIDE_FROM_ABI float scalbn(float __x, int __y) _NOEXCEPT {return ::scalbnf(__x, __y);}
1698inline _LIBCPP_HIDE_FROM_ABI long double scalbn(long double __x, int __y) _NOEXCEPT {return ::scalbnl(__x, __y);}
Richard Smith081bb592015-10-08 20:40:34 +00001699
1700template <class _A1>
Nikolas Klauser4956e722022-10-12 15:41:22 +02001701inline _LIBCPP_HIDE_FROM_ABI
Richard Smith081bb592015-10-08 20:40:34 +00001702typename std::enable_if<std::is_integral<_A1>::value, double>::type
Nikolas Klauser9806f452022-10-12 15:45:09 +02001703scalbn(_A1 __x, int __y) _NOEXCEPT {return ::scalbn((double)__x, __y);}
Richard Smith081bb592015-10-08 20:40:34 +00001704
1705// tgamma
1706
Nikolas Klauser9806f452022-10-12 15:45:09 +02001707inline _LIBCPP_HIDE_FROM_ABI float tgamma(float __x) _NOEXCEPT {return ::tgammaf(__x);}
1708inline _LIBCPP_HIDE_FROM_ABI long double tgamma(long double __x) _NOEXCEPT {return ::tgammal(__x);}
Richard Smith081bb592015-10-08 20:40:34 +00001709
1710template <class _A1>
Nikolas Klauser4956e722022-10-12 15:41:22 +02001711inline _LIBCPP_HIDE_FROM_ABI
Richard Smith081bb592015-10-08 20:40:34 +00001712typename std::enable_if<std::is_integral<_A1>::value, double>::type
Nikolas Klauser9806f452022-10-12 15:45:09 +02001713tgamma(_A1 __x) _NOEXCEPT {return ::tgamma((double)__x);}
Richard Smith081bb592015-10-08 20:40:34 +00001714
1715// trunc
1716
Nikolas Klauser9806f452022-10-12 15:45:09 +02001717inline _LIBCPP_HIDE_FROM_ABI float trunc(float __x) _NOEXCEPT
Ilya Tokarc3abffb2021-02-10 13:05:19 -05001718{
1719#if __has_builtin(__builtin_trunc)
Nikolas Klauser9806f452022-10-12 15:45:09 +02001720 return __builtin_trunc(__x);
Ilya Tokarc3abffb2021-02-10 13:05:19 -05001721#else
Nikolas Klauser9806f452022-10-12 15:45:09 +02001722 return ::trunc(__x);
Ilya Tokarc3abffb2021-02-10 13:05:19 -05001723#endif
1724}
Nikolas Klauser9806f452022-10-12 15:45:09 +02001725inline _LIBCPP_HIDE_FROM_ABI long double trunc(long double __x) _NOEXCEPT
Ilya Tokarc3abffb2021-02-10 13:05:19 -05001726{
1727#if __has_builtin(__builtin_truncl)
Nikolas Klauser9806f452022-10-12 15:45:09 +02001728 return __builtin_truncl(__x);
Ilya Tokarc3abffb2021-02-10 13:05:19 -05001729#else
Nikolas Klauser9806f452022-10-12 15:45:09 +02001730 return ::truncl(__x);
Ilya Tokarc3abffb2021-02-10 13:05:19 -05001731#endif
1732}
Richard Smith081bb592015-10-08 20:40:34 +00001733
1734template <class _A1>
Nikolas Klauser4956e722022-10-12 15:41:22 +02001735inline _LIBCPP_HIDE_FROM_ABI
Richard Smith081bb592015-10-08 20:40:34 +00001736typename std::enable_if<std::is_integral<_A1>::value, double>::type
Nikolas Klauser9806f452022-10-12 15:45:09 +02001737trunc(_A1 __x) _NOEXCEPT
Ilya Tokarc3abffb2021-02-10 13:05:19 -05001738{
1739#if __has_builtin(__builtin_trunc)
Nikolas Klauser9806f452022-10-12 15:45:09 +02001740 return __builtin_trunc((double)__x);
Ilya Tokarc3abffb2021-02-10 13:05:19 -05001741#else
Nikolas Klauser9806f452022-10-12 15:45:09 +02001742 return ::trunc((double)__x);
Ilya Tokarc3abffb2021-02-10 13:05:19 -05001743#endif
1744}
Richard Smith081bb592015-10-08 20:40:34 +00001745
Richard Smith081bb592015-10-08 20:40:34 +00001746} // extern "C++"
1747
1748#endif // __cplusplus
1749
Mikhail Maltsev34b4f972018-02-22 09:34:08 +00001750#else // _LIBCPP_MATH_H
1751
1752// This include lives outside the header guard in order to support an MSVC
1753// extension which allows users to do:
1754//
1755// #define _USE_MATH_DEFINES
1756// #include <math.h>
1757//
1758// and receive the definitions of mathematical constants, even if <math.h>
1759// has previously been included.
1760#if defined(_LIBCPP_MSVCRT) && defined(_USE_MATH_DEFINES)
1761#include_next <math.h>
1762#endif
1763
Louis Dionne2b1ceaa2021-04-20 12:03:32 -04001764#endif // _LIBCPP_MATH_H