blob: 4ee8aebd920aa33bf2715d3ae4cafac073f39abc [file] [log] [blame]
Richard Smith081bb592015-10-08 20:40:34 +00001// -*- C++ -*-
2//===---------------------------- math.h ----------------------------------===//
3//
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)
297#pragma GCC system_header
298#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
Eric Fiselier6c9e1a72020-02-15 18:55:07 -0500308#include <stdlib.h>
Richard Smith081bb592015-10-08 20:40:34 +0000309#include <type_traits>
Duncan P. N. Exon Smith321d6bf2017-04-21 23:14:55 +0000310#include <limits>
Richard Smith081bb592015-10-08 20:40:34 +0000311
Richard Smith081bb592015-10-08 20:40:34 +0000312// signbit
313
314#ifdef signbit
315
316template <class _A1>
Louis Dionne16fe2952018-07-11 23:14:33 +0000317_LIBCPP_INLINE_VISIBILITY
Richard Smith081bb592015-10-08 20:40:34 +0000318bool
319__libcpp_signbit(_A1 __lcpp_x) _NOEXCEPT
320{
Ilya Tokarc3abffb2021-02-10 13:05:19 -0500321#if __has_builtin(__builtin_signbit)
322 return __builtin_signbit(__lcpp_x);
323#else
Richard Smith081bb592015-10-08 20:40:34 +0000324 return signbit(__lcpp_x);
Ilya Tokarc3abffb2021-02-10 13:05:19 -0500325#endif
Richard Smith081bb592015-10-08 20:40:34 +0000326}
327
328#undef signbit
329
330template <class _A1>
331inline _LIBCPP_INLINE_VISIBILITY
Duncan P. N. Exon Smith321d6bf2017-04-21 23:14:55 +0000332typename std::enable_if<std::is_floating_point<_A1>::value, bool>::type
Richard Smith081bb592015-10-08 20:40:34 +0000333signbit(_A1 __lcpp_x) _NOEXCEPT
334{
335 return __libcpp_signbit((typename std::__promote<_A1>::type)__lcpp_x);
336}
337
Duncan P. N. Exon Smith321d6bf2017-04-21 23:14:55 +0000338template <class _A1>
339inline _LIBCPP_INLINE_VISIBILITY
340typename std::enable_if<
341 std::is_integral<_A1>::value && std::is_signed<_A1>::value, bool>::type
342signbit(_A1 __lcpp_x) _NOEXCEPT
343{ return __lcpp_x < 0; }
344
345template <class _A1>
346inline _LIBCPP_INLINE_VISIBILITY
347typename std::enable_if<
348 std::is_integral<_A1>::value && !std::is_signed<_A1>::value, bool>::type
349signbit(_A1) _NOEXCEPT
350{ return false; }
351
Shoaib Meenai159375f2017-04-07 02:20:52 +0000352#elif defined(_LIBCPP_MSVCRT)
Saleem Abdulrasool257256b2017-02-18 19:28:38 +0000353
354template <typename _A1>
355inline _LIBCPP_INLINE_VISIBILITY
Duncan P. N. Exon Smith321d6bf2017-04-21 23:14:55 +0000356typename std::enable_if<std::is_floating_point<_A1>::value, bool>::type
Saleem Abdulrasool257256b2017-02-18 19:28:38 +0000357signbit(_A1 __lcpp_x) _NOEXCEPT
358{
359 return ::signbit(static_cast<typename std::__promote<_A1>::type>(__lcpp_x));
360}
361
Duncan P. N. Exon Smith321d6bf2017-04-21 23:14:55 +0000362template <class _A1>
363inline _LIBCPP_INLINE_VISIBILITY
364typename std::enable_if<
365 std::is_integral<_A1>::value && std::is_signed<_A1>::value, bool>::type
366signbit(_A1 __lcpp_x) _NOEXCEPT
367{ return __lcpp_x < 0; }
368
369template <class _A1>
370inline _LIBCPP_INLINE_VISIBILITY
371typename std::enable_if<
372 std::is_integral<_A1>::value && !std::is_signed<_A1>::value, bool>::type
373signbit(_A1) _NOEXCEPT
374{ return false; }
375
Louis Dionne2b1ceaa2021-04-20 12:03:32 -0400376#endif // signbit
Richard Smith081bb592015-10-08 20:40:34 +0000377
378// fpclassify
379
380#ifdef fpclassify
381
382template <class _A1>
Louis Dionne16fe2952018-07-11 23:14:33 +0000383_LIBCPP_INLINE_VISIBILITY
Richard Smith081bb592015-10-08 20:40:34 +0000384int
385__libcpp_fpclassify(_A1 __lcpp_x) _NOEXCEPT
386{
Ilya Tokarc3abffb2021-02-10 13:05:19 -0500387#if __has_builtin(__builtin_fpclassify)
388 return __builtin_fpclassify(FP_NAN, FP_INFINITE, FP_NORMAL, FP_SUBNORMAL,
389 FP_ZERO, __lcpp_x);
390#else
Richard Smith081bb592015-10-08 20:40:34 +0000391 return fpclassify(__lcpp_x);
Ilya Tokarc3abffb2021-02-10 13:05:19 -0500392#endif
Richard Smith081bb592015-10-08 20:40:34 +0000393}
394
395#undef fpclassify
396
397template <class _A1>
398inline _LIBCPP_INLINE_VISIBILITY
Duncan P. N. Exon Smith321d6bf2017-04-21 23:14:55 +0000399typename std::enable_if<std::is_floating_point<_A1>::value, int>::type
Richard Smith081bb592015-10-08 20:40:34 +0000400fpclassify(_A1 __lcpp_x) _NOEXCEPT
401{
402 return __libcpp_fpclassify((typename std::__promote<_A1>::type)__lcpp_x);
403}
404
Duncan P. N. Exon Smith321d6bf2017-04-21 23:14:55 +0000405template <class _A1>
406inline _LIBCPP_INLINE_VISIBILITY
407typename std::enable_if<std::is_integral<_A1>::value, int>::type
408fpclassify(_A1 __lcpp_x) _NOEXCEPT
409{ return __lcpp_x == 0 ? FP_ZERO : FP_NORMAL; }
410
Shoaib Meenai159375f2017-04-07 02:20:52 +0000411#elif defined(_LIBCPP_MSVCRT)
Saleem Abdulrasool257256b2017-02-18 19:28:38 +0000412
413template <typename _A1>
414inline _LIBCPP_INLINE_VISIBILITY
Duncan P. N. Exon Smith321d6bf2017-04-21 23:14:55 +0000415typename std::enable_if<std::is_floating_point<_A1>::value, bool>::type
Saleem Abdulrasool257256b2017-02-18 19:28:38 +0000416fpclassify(_A1 __lcpp_x) _NOEXCEPT
417{
418 return ::fpclassify(static_cast<typename std::__promote<_A1>::type>(__lcpp_x));
419}
420
Duncan P. N. Exon Smith321d6bf2017-04-21 23:14:55 +0000421template <class _A1>
422inline _LIBCPP_INLINE_VISIBILITY
423typename std::enable_if<std::is_integral<_A1>::value, int>::type
424fpclassify(_A1 __lcpp_x) _NOEXCEPT
425{ return __lcpp_x == 0 ? FP_ZERO : FP_NORMAL; }
426
Louis Dionne2b1ceaa2021-04-20 12:03:32 -0400427#endif // fpclassify
Richard Smith081bb592015-10-08 20:40:34 +0000428
429// isfinite
430
431#ifdef isfinite
432
433template <class _A1>
Louis Dionne16fe2952018-07-11 23:14:33 +0000434_LIBCPP_INLINE_VISIBILITY
Richard Smith081bb592015-10-08 20:40:34 +0000435bool
436__libcpp_isfinite(_A1 __lcpp_x) _NOEXCEPT
437{
Ilya Tokarc3abffb2021-02-10 13:05:19 -0500438#if __has_builtin(__builtin_isfinite)
439 return __builtin_isfinite(__lcpp_x);
440#else
Richard Smith081bb592015-10-08 20:40:34 +0000441 return isfinite(__lcpp_x);
Ilya Tokarc3abffb2021-02-10 13:05:19 -0500442#endif
Richard Smith081bb592015-10-08 20:40:34 +0000443}
444
445#undef isfinite
446
447template <class _A1>
448inline _LIBCPP_INLINE_VISIBILITY
Duncan P. N. Exon Smith321d6bf2017-04-21 23:14:55 +0000449typename std::enable_if<
450 std::is_arithmetic<_A1>::value && std::numeric_limits<_A1>::has_infinity,
451 bool>::type
Richard Smith081bb592015-10-08 20:40:34 +0000452isfinite(_A1 __lcpp_x) _NOEXCEPT
453{
454 return __libcpp_isfinite((typename std::__promote<_A1>::type)__lcpp_x);
455}
456
Duncan P. N. Exon Smith321d6bf2017-04-21 23:14:55 +0000457template <class _A1>
458inline _LIBCPP_INLINE_VISIBILITY
459typename std::enable_if<
460 std::is_arithmetic<_A1>::value && !std::numeric_limits<_A1>::has_infinity,
461 bool>::type
462isfinite(_A1) _NOEXCEPT
463{ return true; }
464
Louis Dionne2b1ceaa2021-04-20 12:03:32 -0400465#endif // isfinite
Richard Smith081bb592015-10-08 20:40:34 +0000466
467// isinf
468
469#ifdef isinf
470
471template <class _A1>
Louis Dionne16fe2952018-07-11 23:14:33 +0000472_LIBCPP_INLINE_VISIBILITY
Richard Smith081bb592015-10-08 20:40:34 +0000473bool
474__libcpp_isinf(_A1 __lcpp_x) _NOEXCEPT
475{
Ilya Tokarc3abffb2021-02-10 13:05:19 -0500476#if __has_builtin(__builtin_isinf)
477 return __builtin_isinf(__lcpp_x);
478#else
Richard Smith081bb592015-10-08 20:40:34 +0000479 return isinf(__lcpp_x);
Ilya Tokarc3abffb2021-02-10 13:05:19 -0500480#endif
Richard Smith081bb592015-10-08 20:40:34 +0000481}
482
483#undef isinf
484
485template <class _A1>
486inline _LIBCPP_INLINE_VISIBILITY
Duncan P. N. Exon Smith321d6bf2017-04-21 23:14:55 +0000487typename std::enable_if<
488 std::is_arithmetic<_A1>::value && std::numeric_limits<_A1>::has_infinity,
489 bool>::type
Richard Smith081bb592015-10-08 20:40:34 +0000490isinf(_A1 __lcpp_x) _NOEXCEPT
491{
492 return __libcpp_isinf((typename std::__promote<_A1>::type)__lcpp_x);
493}
494
Duncan P. N. Exon Smith321d6bf2017-04-21 23:14:55 +0000495template <class _A1>
496inline _LIBCPP_INLINE_VISIBILITY
497typename std::enable_if<
498 std::is_arithmetic<_A1>::value && !std::numeric_limits<_A1>::has_infinity,
499 bool>::type
500isinf(_A1) _NOEXCEPT
501{ return false; }
502
Richard Smithafccfd32018-05-01 03:05:40 +0000503#ifdef _LIBCPP_PREFERRED_OVERLOAD
504inline _LIBCPP_INLINE_VISIBILITY
505bool
506isinf(float __lcpp_x) _NOEXCEPT { return __libcpp_isinf(__lcpp_x); }
507
508inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_PREFERRED_OVERLOAD
509bool
510isinf(double __lcpp_x) _NOEXCEPT { return __libcpp_isinf(__lcpp_x); }
511
512inline _LIBCPP_INLINE_VISIBILITY
513bool
514isinf(long double __lcpp_x) _NOEXCEPT { return __libcpp_isinf(__lcpp_x); }
515#endif
516
Louis Dionne2b1ceaa2021-04-20 12:03:32 -0400517#endif // isinf
Richard Smith081bb592015-10-08 20:40:34 +0000518
519// isnan
520
521#ifdef isnan
522
523template <class _A1>
Louis Dionne16fe2952018-07-11 23:14:33 +0000524_LIBCPP_INLINE_VISIBILITY
Richard Smith081bb592015-10-08 20:40:34 +0000525bool
526__libcpp_isnan(_A1 __lcpp_x) _NOEXCEPT
527{
Ilya Tokar6caf83a2019-11-15 12:29:02 -0500528#if __has_builtin(__builtin_isnan)
529 return __builtin_isnan(__lcpp_x);
530#else
Richard Smith081bb592015-10-08 20:40:34 +0000531 return isnan(__lcpp_x);
Ilya Tokar6caf83a2019-11-15 12:29:02 -0500532#endif
Richard Smith081bb592015-10-08 20:40:34 +0000533}
534
535#undef isnan
536
537template <class _A1>
538inline _LIBCPP_INLINE_VISIBILITY
Duncan P. N. Exon Smith321d6bf2017-04-21 23:14:55 +0000539typename std::enable_if<std::is_floating_point<_A1>::value, bool>::type
Richard Smith081bb592015-10-08 20:40:34 +0000540isnan(_A1 __lcpp_x) _NOEXCEPT
541{
542 return __libcpp_isnan((typename std::__promote<_A1>::type)__lcpp_x);
543}
544
Duncan P. N. Exon Smith321d6bf2017-04-21 23:14:55 +0000545template <class _A1>
546inline _LIBCPP_INLINE_VISIBILITY
547typename std::enable_if<std::is_integral<_A1>::value, bool>::type
548isnan(_A1) _NOEXCEPT
549{ return false; }
550
Richard Smithafccfd32018-05-01 03:05:40 +0000551#ifdef _LIBCPP_PREFERRED_OVERLOAD
552inline _LIBCPP_INLINE_VISIBILITY
553bool
554isnan(float __lcpp_x) _NOEXCEPT { return __libcpp_isnan(__lcpp_x); }
555
556inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_PREFERRED_OVERLOAD
557bool
558isnan(double __lcpp_x) _NOEXCEPT { return __libcpp_isnan(__lcpp_x); }
559
560inline _LIBCPP_INLINE_VISIBILITY
561bool
562isnan(long double __lcpp_x) _NOEXCEPT { return __libcpp_isnan(__lcpp_x); }
563#endif
564
Louis Dionne2b1ceaa2021-04-20 12:03:32 -0400565#endif // isnan
Richard Smith081bb592015-10-08 20:40:34 +0000566
567// isnormal
568
569#ifdef isnormal
570
571template <class _A1>
Louis Dionne16fe2952018-07-11 23:14:33 +0000572_LIBCPP_INLINE_VISIBILITY
Richard Smith081bb592015-10-08 20:40:34 +0000573bool
574__libcpp_isnormal(_A1 __lcpp_x) _NOEXCEPT
575{
Ilya Tokarc3abffb2021-02-10 13:05:19 -0500576#if __has_builtin(__builtin_isnormal)
577 return __builtin_isnormal(__lcpp_x);
578#else
Richard Smith081bb592015-10-08 20:40:34 +0000579 return isnormal(__lcpp_x);
Ilya Tokarc3abffb2021-02-10 13:05:19 -0500580#endif
Richard Smith081bb592015-10-08 20:40:34 +0000581}
582
583#undef isnormal
584
585template <class _A1>
586inline _LIBCPP_INLINE_VISIBILITY
Duncan P. N. Exon Smith321d6bf2017-04-21 23:14:55 +0000587typename std::enable_if<std::is_floating_point<_A1>::value, bool>::type
Richard Smith081bb592015-10-08 20:40:34 +0000588isnormal(_A1 __lcpp_x) _NOEXCEPT
589{
590 return __libcpp_isnormal((typename std::__promote<_A1>::type)__lcpp_x);
591}
592
Duncan P. N. Exon Smith321d6bf2017-04-21 23:14:55 +0000593template <class _A1>
594inline _LIBCPP_INLINE_VISIBILITY
595typename std::enable_if<std::is_integral<_A1>::value, bool>::type
596isnormal(_A1 __lcpp_x) _NOEXCEPT
597{ return __lcpp_x != 0; }
598
Louis Dionne2b1ceaa2021-04-20 12:03:32 -0400599#endif // isnormal
Richard Smith081bb592015-10-08 20:40:34 +0000600
601// isgreater
602
603#ifdef isgreater
604
605template <class _A1, class _A2>
Louis Dionne16fe2952018-07-11 23:14:33 +0000606_LIBCPP_INLINE_VISIBILITY
Richard Smith081bb592015-10-08 20:40:34 +0000607bool
608__libcpp_isgreater(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
609{
610 return isgreater(__lcpp_x, __lcpp_y);
611}
612
613#undef isgreater
614
615template <class _A1, class _A2>
616inline _LIBCPP_INLINE_VISIBILITY
617typename std::enable_if
618<
619 std::is_arithmetic<_A1>::value &&
620 std::is_arithmetic<_A2>::value,
621 bool
622>::type
623isgreater(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
624{
625 typedef typename std::__promote<_A1, _A2>::type type;
626 return __libcpp_isgreater((type)__lcpp_x, (type)__lcpp_y);
627}
628
Louis Dionne2b1ceaa2021-04-20 12:03:32 -0400629#endif // isgreater
Richard Smith081bb592015-10-08 20:40:34 +0000630
631// isgreaterequal
632
633#ifdef isgreaterequal
634
635template <class _A1, class _A2>
Louis Dionne16fe2952018-07-11 23:14:33 +0000636_LIBCPP_INLINE_VISIBILITY
Richard Smith081bb592015-10-08 20:40:34 +0000637bool
638__libcpp_isgreaterequal(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
639{
640 return isgreaterequal(__lcpp_x, __lcpp_y);
641}
642
643#undef isgreaterequal
644
645template <class _A1, class _A2>
646inline _LIBCPP_INLINE_VISIBILITY
647typename std::enable_if
648<
649 std::is_arithmetic<_A1>::value &&
650 std::is_arithmetic<_A2>::value,
651 bool
652>::type
653isgreaterequal(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
654{
655 typedef typename std::__promote<_A1, _A2>::type type;
656 return __libcpp_isgreaterequal((type)__lcpp_x, (type)__lcpp_y);
657}
658
Louis Dionne2b1ceaa2021-04-20 12:03:32 -0400659#endif // isgreaterequal
Richard Smith081bb592015-10-08 20:40:34 +0000660
661// isless
662
663#ifdef isless
664
665template <class _A1, class _A2>
Louis Dionne16fe2952018-07-11 23:14:33 +0000666_LIBCPP_INLINE_VISIBILITY
Richard Smith081bb592015-10-08 20:40:34 +0000667bool
668__libcpp_isless(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
669{
670 return isless(__lcpp_x, __lcpp_y);
671}
672
673#undef isless
674
675template <class _A1, class _A2>
676inline _LIBCPP_INLINE_VISIBILITY
677typename std::enable_if
678<
679 std::is_arithmetic<_A1>::value &&
680 std::is_arithmetic<_A2>::value,
681 bool
682>::type
683isless(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
684{
685 typedef typename std::__promote<_A1, _A2>::type type;
686 return __libcpp_isless((type)__lcpp_x, (type)__lcpp_y);
687}
688
Louis Dionne2b1ceaa2021-04-20 12:03:32 -0400689#endif // isless
Richard Smith081bb592015-10-08 20:40:34 +0000690
691// islessequal
692
693#ifdef islessequal
694
695template <class _A1, class _A2>
Louis Dionne16fe2952018-07-11 23:14:33 +0000696_LIBCPP_INLINE_VISIBILITY
Richard Smith081bb592015-10-08 20:40:34 +0000697bool
698__libcpp_islessequal(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
699{
700 return islessequal(__lcpp_x, __lcpp_y);
701}
702
703#undef islessequal
704
705template <class _A1, class _A2>
706inline _LIBCPP_INLINE_VISIBILITY
707typename std::enable_if
708<
709 std::is_arithmetic<_A1>::value &&
710 std::is_arithmetic<_A2>::value,
711 bool
712>::type
713islessequal(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
714{
715 typedef typename std::__promote<_A1, _A2>::type type;
716 return __libcpp_islessequal((type)__lcpp_x, (type)__lcpp_y);
717}
718
Louis Dionne2b1ceaa2021-04-20 12:03:32 -0400719#endif // islessequal
Richard Smith081bb592015-10-08 20:40:34 +0000720
721// islessgreater
722
723#ifdef islessgreater
724
725template <class _A1, class _A2>
Louis Dionne16fe2952018-07-11 23:14:33 +0000726_LIBCPP_INLINE_VISIBILITY
Richard Smith081bb592015-10-08 20:40:34 +0000727bool
728__libcpp_islessgreater(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
729{
730 return islessgreater(__lcpp_x, __lcpp_y);
731}
732
733#undef islessgreater
734
735template <class _A1, class _A2>
736inline _LIBCPP_INLINE_VISIBILITY
737typename std::enable_if
738<
739 std::is_arithmetic<_A1>::value &&
740 std::is_arithmetic<_A2>::value,
741 bool
742>::type
743islessgreater(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
744{
745 typedef typename std::__promote<_A1, _A2>::type type;
746 return __libcpp_islessgreater((type)__lcpp_x, (type)__lcpp_y);
747}
748
Louis Dionne2b1ceaa2021-04-20 12:03:32 -0400749#endif // islessgreater
Richard Smith081bb592015-10-08 20:40:34 +0000750
751// isunordered
752
753#ifdef isunordered
754
755template <class _A1, class _A2>
Louis Dionne16fe2952018-07-11 23:14:33 +0000756_LIBCPP_INLINE_VISIBILITY
Richard Smith081bb592015-10-08 20:40:34 +0000757bool
758__libcpp_isunordered(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
759{
760 return isunordered(__lcpp_x, __lcpp_y);
761}
762
763#undef isunordered
764
765template <class _A1, class _A2>
766inline _LIBCPP_INLINE_VISIBILITY
767typename std::enable_if
768<
769 std::is_arithmetic<_A1>::value &&
770 std::is_arithmetic<_A2>::value,
771 bool
772>::type
773isunordered(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
774{
775 typedef typename std::__promote<_A1, _A2>::type type;
776 return __libcpp_isunordered((type)__lcpp_x, (type)__lcpp_y);
777}
778
Louis Dionne2b1ceaa2021-04-20 12:03:32 -0400779#endif // isunordered
Richard Smith081bb592015-10-08 20:40:34 +0000780
Richard Smith081bb592015-10-08 20:40:34 +0000781// abs
Eric Fiselier6c9e1a72020-02-15 18:55:07 -0500782//
783// handled in stdlib.h
Richard Smith081bb592015-10-08 20:40:34 +0000784
Eric Fiselier2b85c6e2019-04-23 18:01:58 +0000785// div
Eric Fiselier6c9e1a72020-02-15 18:55:07 -0500786//
787// handled in stdlib.h
Eric Fiselier2b85c6e2019-04-23 18:01:58 +0000788
Richard Smith081bb592015-10-08 20:40:34 +0000789// acos
790
Shoaib Meenai159375f2017-04-07 02:20:52 +0000791#if !(defined(_AIX) || defined(__sun__))
Mehdi Aminib3da6322017-02-10 02:44:23 +0000792inline _LIBCPP_INLINE_VISIBILITY float acos(float __lcpp_x) _NOEXCEPT {return ::acosf(__lcpp_x);}
793inline _LIBCPP_INLINE_VISIBILITY long double acos(long double __lcpp_x) _NOEXCEPT {return ::acosl(__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +0000794#endif
795
796template <class _A1>
797inline _LIBCPP_INLINE_VISIBILITY
798typename std::enable_if<std::is_integral<_A1>::value, double>::type
Mehdi Aminib3da6322017-02-10 02:44:23 +0000799acos(_A1 __lcpp_x) _NOEXCEPT {return ::acos((double)__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +0000800
801// asin
802
Shoaib Meenai159375f2017-04-07 02:20:52 +0000803#if !(defined(_AIX) || defined(__sun__))
Mehdi Aminib3da6322017-02-10 02:44:23 +0000804inline _LIBCPP_INLINE_VISIBILITY float asin(float __lcpp_x) _NOEXCEPT {return ::asinf(__lcpp_x);}
805inline _LIBCPP_INLINE_VISIBILITY long double asin(long double __lcpp_x) _NOEXCEPT {return ::asinl(__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +0000806#endif
807
808template <class _A1>
809inline _LIBCPP_INLINE_VISIBILITY
810typename std::enable_if<std::is_integral<_A1>::value, double>::type
Mehdi Aminib3da6322017-02-10 02:44:23 +0000811asin(_A1 __lcpp_x) _NOEXCEPT {return ::asin((double)__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +0000812
813// atan
814
Shoaib Meenai159375f2017-04-07 02:20:52 +0000815#if !(defined(_AIX) || defined(__sun__))
Mehdi Aminib3da6322017-02-10 02:44:23 +0000816inline _LIBCPP_INLINE_VISIBILITY float atan(float __lcpp_x) _NOEXCEPT {return ::atanf(__lcpp_x);}
817inline _LIBCPP_INLINE_VISIBILITY long double atan(long double __lcpp_x) _NOEXCEPT {return ::atanl(__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +0000818#endif
819
820template <class _A1>
821inline _LIBCPP_INLINE_VISIBILITY
822typename std::enable_if<std::is_integral<_A1>::value, double>::type
Mehdi Aminib3da6322017-02-10 02:44:23 +0000823atan(_A1 __lcpp_x) _NOEXCEPT {return ::atan((double)__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +0000824
825// atan2
826
Shoaib Meenai159375f2017-04-07 02:20:52 +0000827#if !(defined(_AIX) || defined(__sun__))
Mehdi Aminib3da6322017-02-10 02:44:23 +0000828inline _LIBCPP_INLINE_VISIBILITY float atan2(float __lcpp_y, float __lcpp_x) _NOEXCEPT {return ::atan2f(__lcpp_y, __lcpp_x);}
829inline _LIBCPP_INLINE_VISIBILITY long double atan2(long double __lcpp_y, long double __lcpp_x) _NOEXCEPT {return ::atan2l(__lcpp_y, __lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +0000830#endif
831
832template <class _A1, class _A2>
833inline _LIBCPP_INLINE_VISIBILITY
Eric Fiselier3906a132019-06-23 20:28:29 +0000834typename std::_EnableIf
Richard Smith081bb592015-10-08 20:40:34 +0000835<
836 std::is_arithmetic<_A1>::value &&
837 std::is_arithmetic<_A2>::value,
838 std::__promote<_A1, _A2>
839>::type
840atan2(_A1 __lcpp_y, _A2 __lcpp_x) _NOEXCEPT
841{
842 typedef typename std::__promote<_A1, _A2>::type __result_type;
Eric Fiselier3906a132019-06-23 20:28:29 +0000843 static_assert((!(std::_IsSame<_A1, __result_type>::value &&
844 std::_IsSame<_A2, __result_type>::value)), "");
Mehdi Aminib3da6322017-02-10 02:44:23 +0000845 return ::atan2((__result_type)__lcpp_y, (__result_type)__lcpp_x);
Richard Smith081bb592015-10-08 20:40:34 +0000846}
847
848// ceil
849
Shoaib Meenai159375f2017-04-07 02:20:52 +0000850#if !(defined(_AIX) || defined(__sun__))
Mehdi Aminib3da6322017-02-10 02:44:23 +0000851inline _LIBCPP_INLINE_VISIBILITY float ceil(float __lcpp_x) _NOEXCEPT {return ::ceilf(__lcpp_x);}
852inline _LIBCPP_INLINE_VISIBILITY long double ceil(long double __lcpp_x) _NOEXCEPT {return ::ceill(__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +0000853#endif
854
855template <class _A1>
856inline _LIBCPP_INLINE_VISIBILITY
857typename std::enable_if<std::is_integral<_A1>::value, double>::type
Mehdi Aminib3da6322017-02-10 02:44:23 +0000858ceil(_A1 __lcpp_x) _NOEXCEPT {return ::ceil((double)__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +0000859
860// cos
861
Shoaib Meenai159375f2017-04-07 02:20:52 +0000862#if !(defined(_AIX) || defined(__sun__))
Mehdi Aminib3da6322017-02-10 02:44:23 +0000863inline _LIBCPP_INLINE_VISIBILITY float cos(float __lcpp_x) _NOEXCEPT {return ::cosf(__lcpp_x);}
864inline _LIBCPP_INLINE_VISIBILITY long double cos(long double __lcpp_x) _NOEXCEPT {return ::cosl(__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +0000865#endif
866
867template <class _A1>
868inline _LIBCPP_INLINE_VISIBILITY
869typename std::enable_if<std::is_integral<_A1>::value, double>::type
Mehdi Aminib3da6322017-02-10 02:44:23 +0000870cos(_A1 __lcpp_x) _NOEXCEPT {return ::cos((double)__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +0000871
872// cosh
873
Shoaib Meenai159375f2017-04-07 02:20:52 +0000874#if !(defined(_AIX) || defined(__sun__))
Mehdi Aminib3da6322017-02-10 02:44:23 +0000875inline _LIBCPP_INLINE_VISIBILITY float cosh(float __lcpp_x) _NOEXCEPT {return ::coshf(__lcpp_x);}
876inline _LIBCPP_INLINE_VISIBILITY long double cosh(long double __lcpp_x) _NOEXCEPT {return ::coshl(__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +0000877#endif
878
879template <class _A1>
880inline _LIBCPP_INLINE_VISIBILITY
881typename std::enable_if<std::is_integral<_A1>::value, double>::type
Mehdi Aminib3da6322017-02-10 02:44:23 +0000882cosh(_A1 __lcpp_x) _NOEXCEPT {return ::cosh((double)__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +0000883
884// exp
885
Shoaib Meenai159375f2017-04-07 02:20:52 +0000886#if !(defined(_AIX) || defined(__sun__))
Mehdi Aminib3da6322017-02-10 02:44:23 +0000887inline _LIBCPP_INLINE_VISIBILITY float exp(float __lcpp_x) _NOEXCEPT {return ::expf(__lcpp_x);}
888inline _LIBCPP_INLINE_VISIBILITY long double exp(long double __lcpp_x) _NOEXCEPT {return ::expl(__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +0000889#endif
890
891template <class _A1>
892inline _LIBCPP_INLINE_VISIBILITY
893typename std::enable_if<std::is_integral<_A1>::value, double>::type
Mehdi Aminib3da6322017-02-10 02:44:23 +0000894exp(_A1 __lcpp_x) _NOEXCEPT {return ::exp((double)__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +0000895
896// fabs
897
Shoaib Meenai159375f2017-04-07 02:20:52 +0000898#if !(defined(_AIX) || defined(__sun__))
Mehdi Aminib3da6322017-02-10 02:44:23 +0000899inline _LIBCPP_INLINE_VISIBILITY float fabs(float __lcpp_x) _NOEXCEPT {return ::fabsf(__lcpp_x);}
900inline _LIBCPP_INLINE_VISIBILITY long double fabs(long double __lcpp_x) _NOEXCEPT {return ::fabsl(__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +0000901#endif
902
903template <class _A1>
904inline _LIBCPP_INLINE_VISIBILITY
905typename std::enable_if<std::is_integral<_A1>::value, double>::type
Mehdi Aminib3da6322017-02-10 02:44:23 +0000906fabs(_A1 __lcpp_x) _NOEXCEPT {return ::fabs((double)__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +0000907
908// floor
909
Shoaib Meenai159375f2017-04-07 02:20:52 +0000910#if !(defined(_AIX) || defined(__sun__))
Mehdi Aminib3da6322017-02-10 02:44:23 +0000911inline _LIBCPP_INLINE_VISIBILITY float floor(float __lcpp_x) _NOEXCEPT {return ::floorf(__lcpp_x);}
912inline _LIBCPP_INLINE_VISIBILITY long double floor(long double __lcpp_x) _NOEXCEPT {return ::floorl(__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +0000913#endif
914
915template <class _A1>
916inline _LIBCPP_INLINE_VISIBILITY
917typename std::enable_if<std::is_integral<_A1>::value, double>::type
Mehdi Aminib3da6322017-02-10 02:44:23 +0000918floor(_A1 __lcpp_x) _NOEXCEPT {return ::floor((double)__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +0000919
920// fmod
921
Shoaib Meenai159375f2017-04-07 02:20:52 +0000922#if !(defined(_AIX) || defined(__sun__))
Mehdi Aminib3da6322017-02-10 02:44:23 +0000923inline _LIBCPP_INLINE_VISIBILITY float fmod(float __lcpp_x, float __lcpp_y) _NOEXCEPT {return ::fmodf(__lcpp_x, __lcpp_y);}
924inline _LIBCPP_INLINE_VISIBILITY long double fmod(long double __lcpp_x, long double __lcpp_y) _NOEXCEPT {return ::fmodl(__lcpp_x, __lcpp_y);}
Richard Smith081bb592015-10-08 20:40:34 +0000925#endif
926
927template <class _A1, class _A2>
928inline _LIBCPP_INLINE_VISIBILITY
Eric Fiselier3906a132019-06-23 20:28:29 +0000929typename std::_EnableIf
Richard Smith081bb592015-10-08 20:40:34 +0000930<
931 std::is_arithmetic<_A1>::value &&
932 std::is_arithmetic<_A2>::value,
933 std::__promote<_A1, _A2>
934>::type
935fmod(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
936{
937 typedef typename std::__promote<_A1, _A2>::type __result_type;
Eric Fiselier3906a132019-06-23 20:28:29 +0000938 static_assert((!(std::_IsSame<_A1, __result_type>::value &&
939 std::_IsSame<_A2, __result_type>::value)), "");
Mehdi Aminib3da6322017-02-10 02:44:23 +0000940 return ::fmod((__result_type)__lcpp_x, (__result_type)__lcpp_y);
Richard Smith081bb592015-10-08 20:40:34 +0000941}
942
943// frexp
944
Shoaib Meenai159375f2017-04-07 02:20:52 +0000945#if !(defined(_AIX) || defined(__sun__))
Mehdi Aminib3da6322017-02-10 02:44:23 +0000946inline _LIBCPP_INLINE_VISIBILITY float frexp(float __lcpp_x, int* __lcpp_e) _NOEXCEPT {return ::frexpf(__lcpp_x, __lcpp_e);}
947inline _LIBCPP_INLINE_VISIBILITY long double frexp(long double __lcpp_x, int* __lcpp_e) _NOEXCEPT {return ::frexpl(__lcpp_x, __lcpp_e);}
Richard Smith081bb592015-10-08 20:40:34 +0000948#endif
949
950template <class _A1>
951inline _LIBCPP_INLINE_VISIBILITY
952typename std::enable_if<std::is_integral<_A1>::value, double>::type
Mehdi Aminib3da6322017-02-10 02:44:23 +0000953frexp(_A1 __lcpp_x, int* __lcpp_e) _NOEXCEPT {return ::frexp((double)__lcpp_x, __lcpp_e);}
Richard Smith081bb592015-10-08 20:40:34 +0000954
955// ldexp
956
Shoaib Meenai159375f2017-04-07 02:20:52 +0000957#if !(defined(_AIX) || defined(__sun__))
Mehdi Aminib3da6322017-02-10 02:44:23 +0000958inline _LIBCPP_INLINE_VISIBILITY float ldexp(float __lcpp_x, int __lcpp_e) _NOEXCEPT {return ::ldexpf(__lcpp_x, __lcpp_e);}
959inline _LIBCPP_INLINE_VISIBILITY long double ldexp(long double __lcpp_x, int __lcpp_e) _NOEXCEPT {return ::ldexpl(__lcpp_x, __lcpp_e);}
Richard Smith081bb592015-10-08 20:40:34 +0000960#endif
961
962template <class _A1>
963inline _LIBCPP_INLINE_VISIBILITY
964typename std::enable_if<std::is_integral<_A1>::value, double>::type
Mehdi Aminib3da6322017-02-10 02:44:23 +0000965ldexp(_A1 __lcpp_x, int __lcpp_e) _NOEXCEPT {return ::ldexp((double)__lcpp_x, __lcpp_e);}
Richard Smith081bb592015-10-08 20:40:34 +0000966
967// log
968
Shoaib Meenai159375f2017-04-07 02:20:52 +0000969#if !(defined(_AIX) || defined(__sun__))
Mehdi Aminib3da6322017-02-10 02:44:23 +0000970inline _LIBCPP_INLINE_VISIBILITY float log(float __lcpp_x) _NOEXCEPT {return ::logf(__lcpp_x);}
971inline _LIBCPP_INLINE_VISIBILITY long double log(long double __lcpp_x) _NOEXCEPT {return ::logl(__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +0000972#endif
973
974template <class _A1>
975inline _LIBCPP_INLINE_VISIBILITY
976typename std::enable_if<std::is_integral<_A1>::value, double>::type
Mehdi Aminib3da6322017-02-10 02:44:23 +0000977log(_A1 __lcpp_x) _NOEXCEPT {return ::log((double)__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +0000978
979// log10
980
Shoaib Meenai159375f2017-04-07 02:20:52 +0000981#if !(defined(_AIX) || defined(__sun__))
Mehdi Aminib3da6322017-02-10 02:44:23 +0000982inline _LIBCPP_INLINE_VISIBILITY float log10(float __lcpp_x) _NOEXCEPT {return ::log10f(__lcpp_x);}
983inline _LIBCPP_INLINE_VISIBILITY long double log10(long double __lcpp_x) _NOEXCEPT {return ::log10l(__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +0000984#endif
985
986template <class _A1>
987inline _LIBCPP_INLINE_VISIBILITY
988typename std::enable_if<std::is_integral<_A1>::value, double>::type
Mehdi Aminib3da6322017-02-10 02:44:23 +0000989log10(_A1 __lcpp_x) _NOEXCEPT {return ::log10((double)__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +0000990
991// modf
992
Shoaib Meenai159375f2017-04-07 02:20:52 +0000993#if !(defined(_AIX) || defined(__sun__))
Mehdi Aminib3da6322017-02-10 02:44:23 +0000994inline _LIBCPP_INLINE_VISIBILITY float modf(float __lcpp_x, float* __lcpp_y) _NOEXCEPT {return ::modff(__lcpp_x, __lcpp_y);}
995inline _LIBCPP_INLINE_VISIBILITY long double modf(long double __lcpp_x, long double* __lcpp_y) _NOEXCEPT {return ::modfl(__lcpp_x, __lcpp_y);}
Richard Smith081bb592015-10-08 20:40:34 +0000996#endif
997
998// pow
999
Shoaib Meenai159375f2017-04-07 02:20:52 +00001000#if !(defined(_AIX) || defined(__sun__))
Mehdi Aminib3da6322017-02-10 02:44:23 +00001001inline _LIBCPP_INLINE_VISIBILITY float pow(float __lcpp_x, float __lcpp_y) _NOEXCEPT {return ::powf(__lcpp_x, __lcpp_y);}
1002inline _LIBCPP_INLINE_VISIBILITY long double pow(long double __lcpp_x, long double __lcpp_y) _NOEXCEPT {return ::powl(__lcpp_x, __lcpp_y);}
Richard Smith081bb592015-10-08 20:40:34 +00001003#endif
1004
1005template <class _A1, class _A2>
1006inline _LIBCPP_INLINE_VISIBILITY
Eric Fiselier3906a132019-06-23 20:28:29 +00001007typename std::_EnableIf
Richard Smith081bb592015-10-08 20:40:34 +00001008<
1009 std::is_arithmetic<_A1>::value &&
1010 std::is_arithmetic<_A2>::value,
1011 std::__promote<_A1, _A2>
1012>::type
1013pow(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
1014{
1015 typedef typename std::__promote<_A1, _A2>::type __result_type;
Eric Fiselier3906a132019-06-23 20:28:29 +00001016 static_assert((!(std::_IsSame<_A1, __result_type>::value &&
1017 std::_IsSame<_A2, __result_type>::value)), "");
Mehdi Aminib3da6322017-02-10 02:44:23 +00001018 return ::pow((__result_type)__lcpp_x, (__result_type)__lcpp_y);
Richard Smith081bb592015-10-08 20:40:34 +00001019}
1020
1021// sin
1022
Shoaib Meenai159375f2017-04-07 02:20:52 +00001023#if !(defined(_AIX) || defined(__sun__))
Mehdi Aminib3da6322017-02-10 02:44:23 +00001024inline _LIBCPP_INLINE_VISIBILITY float sin(float __lcpp_x) _NOEXCEPT {return ::sinf(__lcpp_x);}
1025inline _LIBCPP_INLINE_VISIBILITY long double sin(long double __lcpp_x) _NOEXCEPT {return ::sinl(__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +00001026#endif
1027
1028template <class _A1>
1029inline _LIBCPP_INLINE_VISIBILITY
1030typename std::enable_if<std::is_integral<_A1>::value, double>::type
Mehdi Aminib3da6322017-02-10 02:44:23 +00001031sin(_A1 __lcpp_x) _NOEXCEPT {return ::sin((double)__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +00001032
1033// sinh
1034
Shoaib Meenai159375f2017-04-07 02:20:52 +00001035#if !(defined(_AIX) || defined(__sun__))
Mehdi Aminib3da6322017-02-10 02:44:23 +00001036inline _LIBCPP_INLINE_VISIBILITY float sinh(float __lcpp_x) _NOEXCEPT {return ::sinhf(__lcpp_x);}
1037inline _LIBCPP_INLINE_VISIBILITY long double sinh(long double __lcpp_x) _NOEXCEPT {return ::sinhl(__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +00001038#endif
1039
1040template <class _A1>
1041inline _LIBCPP_INLINE_VISIBILITY
1042typename std::enable_if<std::is_integral<_A1>::value, double>::type
Mehdi Aminib3da6322017-02-10 02:44:23 +00001043sinh(_A1 __lcpp_x) _NOEXCEPT {return ::sinh((double)__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +00001044
1045// sqrt
1046
Shoaib Meenai159375f2017-04-07 02:20:52 +00001047#if !(defined(_AIX) || defined(__sun__))
Mehdi Aminib3da6322017-02-10 02:44:23 +00001048inline _LIBCPP_INLINE_VISIBILITY float sqrt(float __lcpp_x) _NOEXCEPT {return ::sqrtf(__lcpp_x);}
1049inline _LIBCPP_INLINE_VISIBILITY long double sqrt(long double __lcpp_x) _NOEXCEPT {return ::sqrtl(__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +00001050#endif
1051
Richard Smith081bb592015-10-08 20:40:34 +00001052template <class _A1>
1053inline _LIBCPP_INLINE_VISIBILITY
1054typename std::enable_if<std::is_integral<_A1>::value, double>::type
Mehdi Aminib3da6322017-02-10 02:44:23 +00001055sqrt(_A1 __lcpp_x) _NOEXCEPT {return ::sqrt((double)__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +00001056
1057// tan
1058
Shoaib Meenai159375f2017-04-07 02:20:52 +00001059#if !(defined(_AIX) || defined(__sun__))
Mehdi Aminib3da6322017-02-10 02:44:23 +00001060inline _LIBCPP_INLINE_VISIBILITY float tan(float __lcpp_x) _NOEXCEPT {return ::tanf(__lcpp_x);}
1061inline _LIBCPP_INLINE_VISIBILITY long double tan(long double __lcpp_x) _NOEXCEPT {return ::tanl(__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +00001062#endif
1063
1064template <class _A1>
1065inline _LIBCPP_INLINE_VISIBILITY
1066typename std::enable_if<std::is_integral<_A1>::value, double>::type
Mehdi Aminib3da6322017-02-10 02:44:23 +00001067tan(_A1 __lcpp_x) _NOEXCEPT {return ::tan((double)__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +00001068
1069// tanh
1070
Shoaib Meenai159375f2017-04-07 02:20:52 +00001071#if !(defined(_AIX) || defined(__sun__))
Mehdi Aminib3da6322017-02-10 02:44:23 +00001072inline _LIBCPP_INLINE_VISIBILITY float tanh(float __lcpp_x) _NOEXCEPT {return ::tanhf(__lcpp_x);}
1073inline _LIBCPP_INLINE_VISIBILITY long double tanh(long double __lcpp_x) _NOEXCEPT {return ::tanhl(__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +00001074#endif
1075
1076template <class _A1>
1077inline _LIBCPP_INLINE_VISIBILITY
1078typename std::enable_if<std::is_integral<_A1>::value, double>::type
Mehdi Aminib3da6322017-02-10 02:44:23 +00001079tanh(_A1 __lcpp_x) _NOEXCEPT {return ::tanh((double)__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +00001080
1081// acosh
1082
Mehdi Aminib3da6322017-02-10 02:44:23 +00001083inline _LIBCPP_INLINE_VISIBILITY float acosh(float __lcpp_x) _NOEXCEPT {return ::acoshf(__lcpp_x);}
1084inline _LIBCPP_INLINE_VISIBILITY long double acosh(long double __lcpp_x) _NOEXCEPT {return ::acoshl(__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +00001085
1086template <class _A1>
1087inline _LIBCPP_INLINE_VISIBILITY
1088typename std::enable_if<std::is_integral<_A1>::value, double>::type
Mehdi Aminib3da6322017-02-10 02:44:23 +00001089acosh(_A1 __lcpp_x) _NOEXCEPT {return ::acosh((double)__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +00001090
1091// asinh
1092
Mehdi Aminib3da6322017-02-10 02:44:23 +00001093inline _LIBCPP_INLINE_VISIBILITY float asinh(float __lcpp_x) _NOEXCEPT {return ::asinhf(__lcpp_x);}
1094inline _LIBCPP_INLINE_VISIBILITY long double asinh(long double __lcpp_x) _NOEXCEPT {return ::asinhl(__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +00001095
1096template <class _A1>
1097inline _LIBCPP_INLINE_VISIBILITY
1098typename std::enable_if<std::is_integral<_A1>::value, double>::type
Mehdi Aminib3da6322017-02-10 02:44:23 +00001099asinh(_A1 __lcpp_x) _NOEXCEPT {return ::asinh((double)__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +00001100
1101// atanh
1102
Mehdi Aminib3da6322017-02-10 02:44:23 +00001103inline _LIBCPP_INLINE_VISIBILITY float atanh(float __lcpp_x) _NOEXCEPT {return ::atanhf(__lcpp_x);}
1104inline _LIBCPP_INLINE_VISIBILITY long double atanh(long double __lcpp_x) _NOEXCEPT {return ::atanhl(__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +00001105
1106template <class _A1>
1107inline _LIBCPP_INLINE_VISIBILITY
1108typename std::enable_if<std::is_integral<_A1>::value, double>::type
Mehdi Aminib3da6322017-02-10 02:44:23 +00001109atanh(_A1 __lcpp_x) _NOEXCEPT {return ::atanh((double)__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +00001110
1111// cbrt
1112
Mehdi Aminib3da6322017-02-10 02:44:23 +00001113inline _LIBCPP_INLINE_VISIBILITY float cbrt(float __lcpp_x) _NOEXCEPT {return ::cbrtf(__lcpp_x);}
1114inline _LIBCPP_INLINE_VISIBILITY long double cbrt(long double __lcpp_x) _NOEXCEPT {return ::cbrtl(__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +00001115
1116template <class _A1>
1117inline _LIBCPP_INLINE_VISIBILITY
1118typename std::enable_if<std::is_integral<_A1>::value, double>::type
Mehdi Aminib3da6322017-02-10 02:44:23 +00001119cbrt(_A1 __lcpp_x) _NOEXCEPT {return ::cbrt((double)__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +00001120
1121// copysign
1122
Richard Smith081bb592015-10-08 20:40:34 +00001123inline _LIBCPP_INLINE_VISIBILITY float copysign(float __lcpp_x,
1124 float __lcpp_y) _NOEXCEPT {
Ilya Tokarc3abffb2021-02-10 13:05:19 -05001125#if __has_builtin(__builtin_copysignf)
1126 return __builtin_copysignf(__lcpp_x, __lcpp_y);
1127#else
Mehdi Aminib3da6322017-02-10 02:44:23 +00001128 return ::copysignf(__lcpp_x, __lcpp_y);
Ilya Tokarc3abffb2021-02-10 13:05:19 -05001129#endif
Richard Smith081bb592015-10-08 20:40:34 +00001130}
1131inline _LIBCPP_INLINE_VISIBILITY long double
1132copysign(long double __lcpp_x, long double __lcpp_y) _NOEXCEPT {
Ilya Tokarc3abffb2021-02-10 13:05:19 -05001133#if __has_builtin(__builtin_copysignl)
1134 return __builtin_copysignl(__lcpp_x, __lcpp_y);
1135#else
Mehdi Aminib3da6322017-02-10 02:44:23 +00001136 return ::copysignl(__lcpp_x, __lcpp_y);
Ilya Tokarc3abffb2021-02-10 13:05:19 -05001137#endif
Richard Smith081bb592015-10-08 20:40:34 +00001138}
Richard Smith081bb592015-10-08 20:40:34 +00001139
1140template <class _A1, class _A2>
1141inline _LIBCPP_INLINE_VISIBILITY
Eric Fiselier3906a132019-06-23 20:28:29 +00001142typename std::_EnableIf
Richard Smith081bb592015-10-08 20:40:34 +00001143<
1144 std::is_arithmetic<_A1>::value &&
1145 std::is_arithmetic<_A2>::value,
1146 std::__promote<_A1, _A2>
1147>::type
1148copysign(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
1149{
1150 typedef typename std::__promote<_A1, _A2>::type __result_type;
Eric Fiselier3906a132019-06-23 20:28:29 +00001151 static_assert((!(std::_IsSame<_A1, __result_type>::value &&
1152 std::_IsSame<_A2, __result_type>::value)), "");
Ilya Tokarc3abffb2021-02-10 13:05:19 -05001153#if __has_builtin(__builtin_copysign)
1154 return __builtin_copysign((__result_type)__lcpp_x, (__result_type)__lcpp_y);
1155#else
Mehdi Aminib3da6322017-02-10 02:44:23 +00001156 return ::copysign((__result_type)__lcpp_x, (__result_type)__lcpp_y);
Ilya Tokarc3abffb2021-02-10 13:05:19 -05001157#endif
Richard Smith081bb592015-10-08 20:40:34 +00001158}
1159
Richard Smith081bb592015-10-08 20:40:34 +00001160// erf
1161
Mehdi Aminib3da6322017-02-10 02:44:23 +00001162inline _LIBCPP_INLINE_VISIBILITY float erf(float __lcpp_x) _NOEXCEPT {return ::erff(__lcpp_x);}
1163inline _LIBCPP_INLINE_VISIBILITY long double erf(long double __lcpp_x) _NOEXCEPT {return ::erfl(__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +00001164
1165template <class _A1>
1166inline _LIBCPP_INLINE_VISIBILITY
1167typename std::enable_if<std::is_integral<_A1>::value, double>::type
Mehdi Aminib3da6322017-02-10 02:44:23 +00001168erf(_A1 __lcpp_x) _NOEXCEPT {return ::erf((double)__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +00001169
1170// erfc
1171
Mehdi Aminib3da6322017-02-10 02:44:23 +00001172inline _LIBCPP_INLINE_VISIBILITY float erfc(float __lcpp_x) _NOEXCEPT {return ::erfcf(__lcpp_x);}
1173inline _LIBCPP_INLINE_VISIBILITY long double erfc(long double __lcpp_x) _NOEXCEPT {return ::erfcl(__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +00001174
1175template <class _A1>
1176inline _LIBCPP_INLINE_VISIBILITY
1177typename std::enable_if<std::is_integral<_A1>::value, double>::type
Mehdi Aminib3da6322017-02-10 02:44:23 +00001178erfc(_A1 __lcpp_x) _NOEXCEPT {return ::erfc((double)__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +00001179
1180// exp2
1181
Mehdi Aminib3da6322017-02-10 02:44:23 +00001182inline _LIBCPP_INLINE_VISIBILITY float exp2(float __lcpp_x) _NOEXCEPT {return ::exp2f(__lcpp_x);}
1183inline _LIBCPP_INLINE_VISIBILITY long double exp2(long double __lcpp_x) _NOEXCEPT {return ::exp2l(__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +00001184
1185template <class _A1>
1186inline _LIBCPP_INLINE_VISIBILITY
1187typename std::enable_if<std::is_integral<_A1>::value, double>::type
Mehdi Aminib3da6322017-02-10 02:44:23 +00001188exp2(_A1 __lcpp_x) _NOEXCEPT {return ::exp2((double)__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +00001189
1190// expm1
1191
Mehdi Aminib3da6322017-02-10 02:44:23 +00001192inline _LIBCPP_INLINE_VISIBILITY float expm1(float __lcpp_x) _NOEXCEPT {return ::expm1f(__lcpp_x);}
1193inline _LIBCPP_INLINE_VISIBILITY long double expm1(long double __lcpp_x) _NOEXCEPT {return ::expm1l(__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +00001194
1195template <class _A1>
1196inline _LIBCPP_INLINE_VISIBILITY
1197typename std::enable_if<std::is_integral<_A1>::value, double>::type
Mehdi Aminib3da6322017-02-10 02:44:23 +00001198expm1(_A1 __lcpp_x) _NOEXCEPT {return ::expm1((double)__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +00001199
1200// fdim
1201
Mehdi Aminib3da6322017-02-10 02:44:23 +00001202inline _LIBCPP_INLINE_VISIBILITY float fdim(float __lcpp_x, float __lcpp_y) _NOEXCEPT {return ::fdimf(__lcpp_x, __lcpp_y);}
1203inline _LIBCPP_INLINE_VISIBILITY long double fdim(long double __lcpp_x, long double __lcpp_y) _NOEXCEPT {return ::fdiml(__lcpp_x, __lcpp_y);}
Richard Smith081bb592015-10-08 20:40:34 +00001204
1205template <class _A1, class _A2>
1206inline _LIBCPP_INLINE_VISIBILITY
Eric Fiselier3906a132019-06-23 20:28:29 +00001207typename std::_EnableIf
Richard Smith081bb592015-10-08 20:40:34 +00001208<
1209 std::is_arithmetic<_A1>::value &&
1210 std::is_arithmetic<_A2>::value,
1211 std::__promote<_A1, _A2>
1212>::type
1213fdim(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
1214{
1215 typedef typename std::__promote<_A1, _A2>::type __result_type;
Eric Fiselier3906a132019-06-23 20:28:29 +00001216 static_assert((!(std::_IsSame<_A1, __result_type>::value &&
1217 std::_IsSame<_A2, __result_type>::value)), "");
Mehdi Aminib3da6322017-02-10 02:44:23 +00001218 return ::fdim((__result_type)__lcpp_x, (__result_type)__lcpp_y);
Richard Smith081bb592015-10-08 20:40:34 +00001219}
1220
1221// fma
1222
Ilya Tokarc3abffb2021-02-10 13:05:19 -05001223inline _LIBCPP_INLINE_VISIBILITY float fma(float __lcpp_x, float __lcpp_y, float __lcpp_z) _NOEXCEPT
1224{
1225#if __has_builtin(__builtin_fmaf)
1226 return __builtin_fmaf(__lcpp_x, __lcpp_y, __lcpp_z);
1227#else
1228 return ::fmaf(__lcpp_x, __lcpp_y, __lcpp_z);
1229#endif
1230}
1231inline _LIBCPP_INLINE_VISIBILITY long double fma(long double __lcpp_x, long double __lcpp_y, long double __lcpp_z) _NOEXCEPT
1232{
1233#if __has_builtin(__builtin_fmal)
1234 return __builtin_fmal(__lcpp_x, __lcpp_y, __lcpp_z);
1235#else
1236 return ::fmal(__lcpp_x, __lcpp_y, __lcpp_z);
1237#endif
1238}
Richard Smith081bb592015-10-08 20:40:34 +00001239
1240template <class _A1, class _A2, class _A3>
1241inline _LIBCPP_INLINE_VISIBILITY
Eric Fiselier3906a132019-06-23 20:28:29 +00001242typename std::_EnableIf
Richard Smith081bb592015-10-08 20:40:34 +00001243<
1244 std::is_arithmetic<_A1>::value &&
1245 std::is_arithmetic<_A2>::value &&
1246 std::is_arithmetic<_A3>::value,
1247 std::__promote<_A1, _A2, _A3>
1248>::type
1249fma(_A1 __lcpp_x, _A2 __lcpp_y, _A3 __lcpp_z) _NOEXCEPT
1250{
1251 typedef typename std::__promote<_A1, _A2, _A3>::type __result_type;
Eric Fiselier3906a132019-06-23 20:28:29 +00001252 static_assert((!(std::_IsSame<_A1, __result_type>::value &&
1253 std::_IsSame<_A2, __result_type>::value &&
1254 std::_IsSame<_A3, __result_type>::value)), "");
Ilya Tokarc3abffb2021-02-10 13:05:19 -05001255#if __has_builtin(__builtin_fma)
1256 return __builtin_fma((__result_type)__lcpp_x, (__result_type)__lcpp_y, (__result_type)__lcpp_z);
1257#else
Mehdi Aminib3da6322017-02-10 02:44:23 +00001258 return ::fma((__result_type)__lcpp_x, (__result_type)__lcpp_y, (__result_type)__lcpp_z);
Ilya Tokarc3abffb2021-02-10 13:05:19 -05001259#endif
Richard Smith081bb592015-10-08 20:40:34 +00001260}
1261
1262// fmax
1263
Mehdi Aminib3da6322017-02-10 02:44:23 +00001264inline _LIBCPP_INLINE_VISIBILITY float fmax(float __lcpp_x, float __lcpp_y) _NOEXCEPT {return ::fmaxf(__lcpp_x, __lcpp_y);}
1265inline _LIBCPP_INLINE_VISIBILITY long double fmax(long double __lcpp_x, long double __lcpp_y) _NOEXCEPT {return ::fmaxl(__lcpp_x, __lcpp_y);}
Richard Smith081bb592015-10-08 20:40:34 +00001266
1267template <class _A1, class _A2>
1268inline _LIBCPP_INLINE_VISIBILITY
Eric Fiselier3906a132019-06-23 20:28:29 +00001269typename std::_EnableIf
Richard Smith081bb592015-10-08 20:40:34 +00001270<
1271 std::is_arithmetic<_A1>::value &&
1272 std::is_arithmetic<_A2>::value,
1273 std::__promote<_A1, _A2>
1274>::type
1275fmax(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
1276{
1277 typedef typename std::__promote<_A1, _A2>::type __result_type;
Eric Fiselier3906a132019-06-23 20:28:29 +00001278 static_assert((!(std::_IsSame<_A1, __result_type>::value &&
1279 std::_IsSame<_A2, __result_type>::value)), "");
Mehdi Aminib3da6322017-02-10 02:44:23 +00001280 return ::fmax((__result_type)__lcpp_x, (__result_type)__lcpp_y);
Richard Smith081bb592015-10-08 20:40:34 +00001281}
1282
1283// fmin
1284
Mehdi Aminib3da6322017-02-10 02:44:23 +00001285inline _LIBCPP_INLINE_VISIBILITY float fmin(float __lcpp_x, float __lcpp_y) _NOEXCEPT {return ::fminf(__lcpp_x, __lcpp_y);}
1286inline _LIBCPP_INLINE_VISIBILITY long double fmin(long double __lcpp_x, long double __lcpp_y) _NOEXCEPT {return ::fminl(__lcpp_x, __lcpp_y);}
Richard Smith081bb592015-10-08 20:40:34 +00001287
1288template <class _A1, class _A2>
1289inline _LIBCPP_INLINE_VISIBILITY
Eric Fiselier3906a132019-06-23 20:28:29 +00001290typename std::_EnableIf
Richard Smith081bb592015-10-08 20:40:34 +00001291<
1292 std::is_arithmetic<_A1>::value &&
1293 std::is_arithmetic<_A2>::value,
1294 std::__promote<_A1, _A2>
1295>::type
1296fmin(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
1297{
1298 typedef typename std::__promote<_A1, _A2>::type __result_type;
Eric Fiselier3906a132019-06-23 20:28:29 +00001299 static_assert((!(std::_IsSame<_A1, __result_type>::value &&
1300 std::_IsSame<_A2, __result_type>::value)), "");
Mehdi Aminib3da6322017-02-10 02:44:23 +00001301 return ::fmin((__result_type)__lcpp_x, (__result_type)__lcpp_y);
Richard Smith081bb592015-10-08 20:40:34 +00001302}
1303
1304// hypot
1305
Mehdi Aminib3da6322017-02-10 02:44:23 +00001306inline _LIBCPP_INLINE_VISIBILITY float hypot(float __lcpp_x, float __lcpp_y) _NOEXCEPT {return ::hypotf(__lcpp_x, __lcpp_y);}
1307inline _LIBCPP_INLINE_VISIBILITY long double hypot(long double __lcpp_x, long double __lcpp_y) _NOEXCEPT {return ::hypotl(__lcpp_x, __lcpp_y);}
Richard Smith081bb592015-10-08 20:40:34 +00001308
1309template <class _A1, class _A2>
1310inline _LIBCPP_INLINE_VISIBILITY
Eric Fiselier3906a132019-06-23 20:28:29 +00001311typename std::_EnableIf
Richard Smith081bb592015-10-08 20:40:34 +00001312<
1313 std::is_arithmetic<_A1>::value &&
1314 std::is_arithmetic<_A2>::value,
1315 std::__promote<_A1, _A2>
1316>::type
1317hypot(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
1318{
1319 typedef typename std::__promote<_A1, _A2>::type __result_type;
Eric Fiselier3906a132019-06-23 20:28:29 +00001320 static_assert((!(std::_IsSame<_A1, __result_type>::value &&
1321 std::_IsSame<_A2, __result_type>::value)), "");
Mehdi Aminib3da6322017-02-10 02:44:23 +00001322 return ::hypot((__result_type)__lcpp_x, (__result_type)__lcpp_y);
Richard Smith081bb592015-10-08 20:40:34 +00001323}
1324
1325// ilogb
1326
Mehdi Aminib3da6322017-02-10 02:44:23 +00001327inline _LIBCPP_INLINE_VISIBILITY int ilogb(float __lcpp_x) _NOEXCEPT {return ::ilogbf(__lcpp_x);}
1328inline _LIBCPP_INLINE_VISIBILITY int ilogb(long double __lcpp_x) _NOEXCEPT {return ::ilogbl(__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +00001329
1330template <class _A1>
1331inline _LIBCPP_INLINE_VISIBILITY
1332typename std::enable_if<std::is_integral<_A1>::value, int>::type
Mehdi Aminib3da6322017-02-10 02:44:23 +00001333ilogb(_A1 __lcpp_x) _NOEXCEPT {return ::ilogb((double)__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +00001334
1335// lgamma
1336
Mehdi Aminib3da6322017-02-10 02:44:23 +00001337inline _LIBCPP_INLINE_VISIBILITY float lgamma(float __lcpp_x) _NOEXCEPT {return ::lgammaf(__lcpp_x);}
1338inline _LIBCPP_INLINE_VISIBILITY long double lgamma(long double __lcpp_x) _NOEXCEPT {return ::lgammal(__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +00001339
1340template <class _A1>
1341inline _LIBCPP_INLINE_VISIBILITY
1342typename std::enable_if<std::is_integral<_A1>::value, double>::type
Mehdi Aminib3da6322017-02-10 02:44:23 +00001343lgamma(_A1 __lcpp_x) _NOEXCEPT {return ::lgamma((double)__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +00001344
1345// llrint
1346
Ilya Tokarc3abffb2021-02-10 13:05:19 -05001347inline _LIBCPP_INLINE_VISIBILITY long long llrint(float __lcpp_x) _NOEXCEPT
1348{
1349#if __has_builtin(__builtin_llrintf)
1350 return __builtin_llrintf(__lcpp_x);
1351#else
1352 return ::llrintf(__lcpp_x);
1353#endif
1354}
1355inline _LIBCPP_INLINE_VISIBILITY long long llrint(long double __lcpp_x) _NOEXCEPT
1356{
1357#if __has_builtin(__builtin_llrintl)
1358 return __builtin_llrintl(__lcpp_x);
1359#else
1360 return ::llrintl(__lcpp_x);
1361#endif
1362}
Richard Smith081bb592015-10-08 20:40:34 +00001363
1364template <class _A1>
1365inline _LIBCPP_INLINE_VISIBILITY
1366typename std::enable_if<std::is_integral<_A1>::value, long long>::type
Ilya Tokarc3abffb2021-02-10 13:05:19 -05001367llrint(_A1 __lcpp_x) _NOEXCEPT
1368{
1369#if __has_builtin(__builtin_llrint)
1370 return __builtin_llrint((double)__lcpp_x);
1371#else
1372 return ::llrint((double)__lcpp_x);
1373#endif
1374}
Richard Smith081bb592015-10-08 20:40:34 +00001375
1376// llround
1377
Ilya Tokarc3abffb2021-02-10 13:05:19 -05001378inline _LIBCPP_INLINE_VISIBILITY long long llround(float __lcpp_x) _NOEXCEPT
1379{
1380#if __has_builtin(__builtin_llroundf)
1381 return __builtin_llroundf(__lcpp_x);
1382#else
1383 return ::llroundf(__lcpp_x);
1384#endif
1385}
1386inline _LIBCPP_INLINE_VISIBILITY long long llround(long double __lcpp_x) _NOEXCEPT
1387{
1388#if __has_builtin(__builtin_llroundl)
1389 return __builtin_llroundl(__lcpp_x);
1390#else
1391 return ::llroundl(__lcpp_x);
1392#endif
1393}
Richard Smith081bb592015-10-08 20:40:34 +00001394
1395template <class _A1>
1396inline _LIBCPP_INLINE_VISIBILITY
1397typename std::enable_if<std::is_integral<_A1>::value, long long>::type
Ilya Tokarc3abffb2021-02-10 13:05:19 -05001398llround(_A1 __lcpp_x) _NOEXCEPT
1399{
1400#if __has_builtin(__builtin_llround)
1401 return __builtin_llround((double)__lcpp_x);
1402#else
1403 return ::llround((double)__lcpp_x);
1404#endif
1405}
Richard Smith081bb592015-10-08 20:40:34 +00001406
1407// log1p
1408
Mehdi Aminib3da6322017-02-10 02:44:23 +00001409inline _LIBCPP_INLINE_VISIBILITY float log1p(float __lcpp_x) _NOEXCEPT {return ::log1pf(__lcpp_x);}
1410inline _LIBCPP_INLINE_VISIBILITY long double log1p(long double __lcpp_x) _NOEXCEPT {return ::log1pl(__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +00001411
1412template <class _A1>
1413inline _LIBCPP_INLINE_VISIBILITY
1414typename std::enable_if<std::is_integral<_A1>::value, double>::type
Mehdi Aminib3da6322017-02-10 02:44:23 +00001415log1p(_A1 __lcpp_x) _NOEXCEPT {return ::log1p((double)__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +00001416
1417// log2
1418
Mehdi Aminib3da6322017-02-10 02:44:23 +00001419inline _LIBCPP_INLINE_VISIBILITY float log2(float __lcpp_x) _NOEXCEPT {return ::log2f(__lcpp_x);}
1420inline _LIBCPP_INLINE_VISIBILITY long double log2(long double __lcpp_x) _NOEXCEPT {return ::log2l(__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +00001421
1422template <class _A1>
1423inline _LIBCPP_INLINE_VISIBILITY
1424typename std::enable_if<std::is_integral<_A1>::value, double>::type
Mehdi Aminib3da6322017-02-10 02:44:23 +00001425log2(_A1 __lcpp_x) _NOEXCEPT {return ::log2((double)__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +00001426
1427// logb
1428
Mehdi Aminib3da6322017-02-10 02:44:23 +00001429inline _LIBCPP_INLINE_VISIBILITY float logb(float __lcpp_x) _NOEXCEPT {return ::logbf(__lcpp_x);}
1430inline _LIBCPP_INLINE_VISIBILITY long double logb(long double __lcpp_x) _NOEXCEPT {return ::logbl(__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +00001431
1432template <class _A1>
1433inline _LIBCPP_INLINE_VISIBILITY
1434typename std::enable_if<std::is_integral<_A1>::value, double>::type
Mehdi Aminib3da6322017-02-10 02:44:23 +00001435logb(_A1 __lcpp_x) _NOEXCEPT {return ::logb((double)__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +00001436
1437// lrint
1438
Ilya Tokarc3abffb2021-02-10 13:05:19 -05001439inline _LIBCPP_INLINE_VISIBILITY long lrint(float __lcpp_x) _NOEXCEPT
1440{
1441#if __has_builtin(__builtin_lrintf)
1442 return __builtin_lrintf(__lcpp_x);
1443#else
1444 return ::lrintf(__lcpp_x);
1445#endif
1446}
1447inline _LIBCPP_INLINE_VISIBILITY long lrint(long double __lcpp_x) _NOEXCEPT
1448{
1449#if __has_builtin(__builtin_lrintl)
1450 return __builtin_lrintl(__lcpp_x);
1451#else
1452 return ::lrintl(__lcpp_x);
1453#endif
1454}
Richard Smith081bb592015-10-08 20:40:34 +00001455
1456template <class _A1>
1457inline _LIBCPP_INLINE_VISIBILITY
1458typename std::enable_if<std::is_integral<_A1>::value, long>::type
Ilya Tokarc3abffb2021-02-10 13:05:19 -05001459lrint(_A1 __lcpp_x) _NOEXCEPT
1460{
1461#if __has_builtin(__builtin_lrint)
1462 return __builtin_lrint((double)__lcpp_x);
1463#else
1464 return ::lrint((double)__lcpp_x);
1465#endif
1466}
Richard Smith081bb592015-10-08 20:40:34 +00001467
1468// lround
1469
Ilya Tokarc3abffb2021-02-10 13:05:19 -05001470inline _LIBCPP_INLINE_VISIBILITY long lround(float __lcpp_x) _NOEXCEPT
1471{
1472#if __has_builtin(__builtin_lroundf)
1473 return __builtin_lroundf(__lcpp_x);
1474#else
1475 return ::lroundf(__lcpp_x);
1476#endif
1477}
1478inline _LIBCPP_INLINE_VISIBILITY long lround(long double __lcpp_x) _NOEXCEPT
1479{
1480#if __has_builtin(__builtin_lroundl)
1481 return __builtin_lroundl(__lcpp_x);
1482#else
1483 return ::lroundl(__lcpp_x);
1484#endif
1485}
Richard Smith081bb592015-10-08 20:40:34 +00001486
1487template <class _A1>
1488inline _LIBCPP_INLINE_VISIBILITY
1489typename std::enable_if<std::is_integral<_A1>::value, long>::type
Ilya Tokarc3abffb2021-02-10 13:05:19 -05001490lround(_A1 __lcpp_x) _NOEXCEPT
1491{
1492#if __has_builtin(__builtin_lround)
1493 return __builtin_lround((double)__lcpp_x);
1494#else
1495 return ::lround((double)__lcpp_x);
1496#endif
1497}
Richard Smith081bb592015-10-08 20:40:34 +00001498
1499// nan
1500
1501// nearbyint
1502
Mehdi Aminib3da6322017-02-10 02:44:23 +00001503inline _LIBCPP_INLINE_VISIBILITY float nearbyint(float __lcpp_x) _NOEXCEPT {return ::nearbyintf(__lcpp_x);}
1504inline _LIBCPP_INLINE_VISIBILITY long double nearbyint(long double __lcpp_x) _NOEXCEPT {return ::nearbyintl(__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +00001505
1506template <class _A1>
1507inline _LIBCPP_INLINE_VISIBILITY
1508typename std::enable_if<std::is_integral<_A1>::value, double>::type
Mehdi Aminib3da6322017-02-10 02:44:23 +00001509nearbyint(_A1 __lcpp_x) _NOEXCEPT {return ::nearbyint((double)__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +00001510
1511// nextafter
1512
Mehdi Aminib3da6322017-02-10 02:44:23 +00001513inline _LIBCPP_INLINE_VISIBILITY float nextafter(float __lcpp_x, float __lcpp_y) _NOEXCEPT {return ::nextafterf(__lcpp_x, __lcpp_y);}
1514inline _LIBCPP_INLINE_VISIBILITY long double nextafter(long double __lcpp_x, long double __lcpp_y) _NOEXCEPT {return ::nextafterl(__lcpp_x, __lcpp_y);}
Richard Smith081bb592015-10-08 20:40:34 +00001515
1516template <class _A1, class _A2>
1517inline _LIBCPP_INLINE_VISIBILITY
Eric Fiselier3906a132019-06-23 20:28:29 +00001518typename std::_EnableIf
Richard Smith081bb592015-10-08 20:40:34 +00001519<
1520 std::is_arithmetic<_A1>::value &&
1521 std::is_arithmetic<_A2>::value,
1522 std::__promote<_A1, _A2>
1523>::type
1524nextafter(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
1525{
1526 typedef typename std::__promote<_A1, _A2>::type __result_type;
Eric Fiselier3906a132019-06-23 20:28:29 +00001527 static_assert((!(std::_IsSame<_A1, __result_type>::value &&
1528 std::_IsSame<_A2, __result_type>::value)), "");
Mehdi Aminib3da6322017-02-10 02:44:23 +00001529 return ::nextafter((__result_type)__lcpp_x, (__result_type)__lcpp_y);
Richard Smith081bb592015-10-08 20:40:34 +00001530}
1531
1532// nexttoward
1533
Mehdi Aminib3da6322017-02-10 02:44:23 +00001534inline _LIBCPP_INLINE_VISIBILITY float nexttoward(float __lcpp_x, long double __lcpp_y) _NOEXCEPT {return ::nexttowardf(__lcpp_x, __lcpp_y);}
1535inline _LIBCPP_INLINE_VISIBILITY long double nexttoward(long double __lcpp_x, long double __lcpp_y) _NOEXCEPT {return ::nexttowardl(__lcpp_x, __lcpp_y);}
Richard Smith081bb592015-10-08 20:40:34 +00001536
1537template <class _A1>
1538inline _LIBCPP_INLINE_VISIBILITY
1539typename std::enable_if<std::is_integral<_A1>::value, double>::type
Mehdi Aminib3da6322017-02-10 02:44:23 +00001540nexttoward(_A1 __lcpp_x, long double __lcpp_y) _NOEXCEPT {return ::nexttoward((double)__lcpp_x, __lcpp_y);}
Richard Smith081bb592015-10-08 20:40:34 +00001541
1542// remainder
1543
Mehdi Aminib3da6322017-02-10 02:44:23 +00001544inline _LIBCPP_INLINE_VISIBILITY float remainder(float __lcpp_x, float __lcpp_y) _NOEXCEPT {return ::remainderf(__lcpp_x, __lcpp_y);}
1545inline _LIBCPP_INLINE_VISIBILITY long double remainder(long double __lcpp_x, long double __lcpp_y) _NOEXCEPT {return ::remainderl(__lcpp_x, __lcpp_y);}
Richard Smith081bb592015-10-08 20:40:34 +00001546
1547template <class _A1, class _A2>
1548inline _LIBCPP_INLINE_VISIBILITY
Eric Fiselier3906a132019-06-23 20:28:29 +00001549typename std::_EnableIf
Richard Smith081bb592015-10-08 20:40:34 +00001550<
1551 std::is_arithmetic<_A1>::value &&
1552 std::is_arithmetic<_A2>::value,
1553 std::__promote<_A1, _A2>
1554>::type
1555remainder(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
1556{
1557 typedef typename std::__promote<_A1, _A2>::type __result_type;
Eric Fiselier3906a132019-06-23 20:28:29 +00001558 static_assert((!(std::_IsSame<_A1, __result_type>::value &&
1559 std::_IsSame<_A2, __result_type>::value)), "");
Mehdi Aminib3da6322017-02-10 02:44:23 +00001560 return ::remainder((__result_type)__lcpp_x, (__result_type)__lcpp_y);
Richard Smith081bb592015-10-08 20:40:34 +00001561}
1562
1563// remquo
1564
Mehdi Aminib3da6322017-02-10 02:44:23 +00001565inline _LIBCPP_INLINE_VISIBILITY float remquo(float __lcpp_x, float __lcpp_y, int* __lcpp_z) _NOEXCEPT {return ::remquof(__lcpp_x, __lcpp_y, __lcpp_z);}
1566inline _LIBCPP_INLINE_VISIBILITY long double remquo(long double __lcpp_x, long double __lcpp_y, int* __lcpp_z) _NOEXCEPT {return ::remquol(__lcpp_x, __lcpp_y, __lcpp_z);}
Richard Smith081bb592015-10-08 20:40:34 +00001567
1568template <class _A1, class _A2>
1569inline _LIBCPP_INLINE_VISIBILITY
Eric Fiselier3906a132019-06-23 20:28:29 +00001570typename std::_EnableIf
Richard Smith081bb592015-10-08 20:40:34 +00001571<
1572 std::is_arithmetic<_A1>::value &&
1573 std::is_arithmetic<_A2>::value,
1574 std::__promote<_A1, _A2>
1575>::type
1576remquo(_A1 __lcpp_x, _A2 __lcpp_y, int* __lcpp_z) _NOEXCEPT
1577{
1578 typedef typename std::__promote<_A1, _A2>::type __result_type;
Eric Fiselier3906a132019-06-23 20:28:29 +00001579 static_assert((!(std::_IsSame<_A1, __result_type>::value &&
1580 std::_IsSame<_A2, __result_type>::value)), "");
Mehdi Aminib3da6322017-02-10 02:44:23 +00001581 return ::remquo((__result_type)__lcpp_x, (__result_type)__lcpp_y, __lcpp_z);
Richard Smith081bb592015-10-08 20:40:34 +00001582}
1583
1584// rint
1585
Ilya Tokarc3abffb2021-02-10 13:05:19 -05001586inline _LIBCPP_INLINE_VISIBILITY float rint(float __lcpp_x) _NOEXCEPT
1587{
1588#if __has_builtin(__builtin_rintf)
1589 return __builtin_rintf(__lcpp_x);
1590#else
1591 return ::rintf(__lcpp_x);
1592#endif
1593}
1594inline _LIBCPP_INLINE_VISIBILITY long double rint(long double __lcpp_x) _NOEXCEPT
1595{
1596#if __has_builtin(__builtin_rintl)
1597 return __builtin_rintl(__lcpp_x);
1598#else
1599 return ::rintl(__lcpp_x);
1600#endif
1601}
Richard Smith081bb592015-10-08 20:40:34 +00001602
1603template <class _A1>
1604inline _LIBCPP_INLINE_VISIBILITY
1605typename std::enable_if<std::is_integral<_A1>::value, double>::type
Ilya Tokarc3abffb2021-02-10 13:05:19 -05001606rint(_A1 __lcpp_x) _NOEXCEPT
1607{
1608#if __has_builtin(__builtin_rint)
1609 return __builtin_rint((double)__lcpp_x);
1610#else
1611 return ::rint((double)__lcpp_x);
1612#endif
1613}
Richard Smith081bb592015-10-08 20:40:34 +00001614
1615// round
1616
Ilya Tokarc3abffb2021-02-10 13:05:19 -05001617inline _LIBCPP_INLINE_VISIBILITY float round(float __lcpp_x) _NOEXCEPT
1618{
1619#if __has_builtin(__builtin_round)
1620 return __builtin_round(__lcpp_x);
1621#else
1622 return ::round(__lcpp_x);
1623#endif
1624}
1625inline _LIBCPP_INLINE_VISIBILITY long double round(long double __lcpp_x) _NOEXCEPT
1626{
1627#if __has_builtin(__builtin_roundl)
1628 return __builtin_roundl(__lcpp_x);
1629#else
1630 return ::roundl(__lcpp_x);
1631#endif
1632}
Richard Smith081bb592015-10-08 20:40:34 +00001633
1634template <class _A1>
1635inline _LIBCPP_INLINE_VISIBILITY
1636typename std::enable_if<std::is_integral<_A1>::value, double>::type
Ilya Tokarc3abffb2021-02-10 13:05:19 -05001637round(_A1 __lcpp_x) _NOEXCEPT
1638{
1639#if __has_builtin(__builtin_round)
1640 return __builtin_round((double)__lcpp_x);
1641#else
1642 return ::round((double)__lcpp_x);
1643#endif
1644}
Richard Smith081bb592015-10-08 20:40:34 +00001645
1646// scalbln
1647
Mehdi Aminib3da6322017-02-10 02:44:23 +00001648inline _LIBCPP_INLINE_VISIBILITY float scalbln(float __lcpp_x, long __lcpp_y) _NOEXCEPT {return ::scalblnf(__lcpp_x, __lcpp_y);}
1649inline _LIBCPP_INLINE_VISIBILITY long double scalbln(long double __lcpp_x, long __lcpp_y) _NOEXCEPT {return ::scalblnl(__lcpp_x, __lcpp_y);}
Richard Smith081bb592015-10-08 20:40:34 +00001650
1651template <class _A1>
1652inline _LIBCPP_INLINE_VISIBILITY
1653typename std::enable_if<std::is_integral<_A1>::value, double>::type
Mehdi Aminib3da6322017-02-10 02:44:23 +00001654scalbln(_A1 __lcpp_x, long __lcpp_y) _NOEXCEPT {return ::scalbln((double)__lcpp_x, __lcpp_y);}
Richard Smith081bb592015-10-08 20:40:34 +00001655
1656// scalbn
1657
Mehdi Aminib3da6322017-02-10 02:44:23 +00001658inline _LIBCPP_INLINE_VISIBILITY float scalbn(float __lcpp_x, int __lcpp_y) _NOEXCEPT {return ::scalbnf(__lcpp_x, __lcpp_y);}
1659inline _LIBCPP_INLINE_VISIBILITY long double scalbn(long double __lcpp_x, int __lcpp_y) _NOEXCEPT {return ::scalbnl(__lcpp_x, __lcpp_y);}
Richard Smith081bb592015-10-08 20:40:34 +00001660
1661template <class _A1>
1662inline _LIBCPP_INLINE_VISIBILITY
1663typename std::enable_if<std::is_integral<_A1>::value, double>::type
Mehdi Aminib3da6322017-02-10 02:44:23 +00001664scalbn(_A1 __lcpp_x, int __lcpp_y) _NOEXCEPT {return ::scalbn((double)__lcpp_x, __lcpp_y);}
Richard Smith081bb592015-10-08 20:40:34 +00001665
1666// tgamma
1667
Mehdi Aminib3da6322017-02-10 02:44:23 +00001668inline _LIBCPP_INLINE_VISIBILITY float tgamma(float __lcpp_x) _NOEXCEPT {return ::tgammaf(__lcpp_x);}
1669inline _LIBCPP_INLINE_VISIBILITY long double tgamma(long double __lcpp_x) _NOEXCEPT {return ::tgammal(__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +00001670
1671template <class _A1>
1672inline _LIBCPP_INLINE_VISIBILITY
1673typename std::enable_if<std::is_integral<_A1>::value, double>::type
Mehdi Aminib3da6322017-02-10 02:44:23 +00001674tgamma(_A1 __lcpp_x) _NOEXCEPT {return ::tgamma((double)__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +00001675
1676// trunc
1677
Ilya Tokarc3abffb2021-02-10 13:05:19 -05001678inline _LIBCPP_INLINE_VISIBILITY float trunc(float __lcpp_x) _NOEXCEPT
1679{
1680#if __has_builtin(__builtin_trunc)
1681 return __builtin_trunc(__lcpp_x);
1682#else
1683 return ::trunc(__lcpp_x);
1684#endif
1685}
1686inline _LIBCPP_INLINE_VISIBILITY long double trunc(long double __lcpp_x) _NOEXCEPT
1687{
1688#if __has_builtin(__builtin_truncl)
1689 return __builtin_truncl(__lcpp_x);
1690#else
1691 return ::truncl(__lcpp_x);
1692#endif
1693}
Richard Smith081bb592015-10-08 20:40:34 +00001694
1695template <class _A1>
1696inline _LIBCPP_INLINE_VISIBILITY
1697typename std::enable_if<std::is_integral<_A1>::value, double>::type
Ilya Tokarc3abffb2021-02-10 13:05:19 -05001698trunc(_A1 __lcpp_x) _NOEXCEPT
1699{
1700#if __has_builtin(__builtin_trunc)
1701 return __builtin_trunc((double)__lcpp_x);
1702#else
1703 return ::trunc((double)__lcpp_x);
1704#endif
1705}
Richard Smith081bb592015-10-08 20:40:34 +00001706
Richard Smith081bb592015-10-08 20:40:34 +00001707} // extern "C++"
1708
1709#endif // __cplusplus
1710
Mikhail Maltsev34b4f972018-02-22 09:34:08 +00001711#else // _LIBCPP_MATH_H
1712
1713// This include lives outside the header guard in order to support an MSVC
1714// extension which allows users to do:
1715//
1716// #define _USE_MATH_DEFINES
1717// #include <math.h>
1718//
1719// and receive the definitions of mathematical constants, even if <math.h>
1720// has previously been included.
1721#if defined(_LIBCPP_MSVCRT) && defined(_USE_MATH_DEFINES)
1722#include_next <math.h>
1723#endif
1724
Louis Dionne2b1ceaa2021-04-20 12:03:32 -04001725#endif // _LIBCPP_MATH_H