blob: 6f9a76ba9a981f74f0693fa6893b2dae202f8abb [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
308#include <type_traits>
Duncan P. N. Exon Smith321d6bf2017-04-21 23:14:55 +0000309#include <limits>
Richard Smith081bb592015-10-08 20:40:34 +0000310
Richard Smith081bb592015-10-08 20:40:34 +0000311// signbit
312
313#ifdef signbit
314
315template <class _A1>
Louis Dionne16fe2952018-07-11 23:14:33 +0000316_LIBCPP_INLINE_VISIBILITY
Richard Smith081bb592015-10-08 20:40:34 +0000317bool
318__libcpp_signbit(_A1 __lcpp_x) _NOEXCEPT
319{
320 return signbit(__lcpp_x);
321}
322
323#undef signbit
324
325template <class _A1>
326inline _LIBCPP_INLINE_VISIBILITY
Duncan P. N. Exon Smith321d6bf2017-04-21 23:14:55 +0000327typename std::enable_if<std::is_floating_point<_A1>::value, bool>::type
Richard Smith081bb592015-10-08 20:40:34 +0000328signbit(_A1 __lcpp_x) _NOEXCEPT
329{
330 return __libcpp_signbit((typename std::__promote<_A1>::type)__lcpp_x);
331}
332
Duncan P. N. Exon Smith321d6bf2017-04-21 23:14:55 +0000333template <class _A1>
334inline _LIBCPP_INLINE_VISIBILITY
335typename std::enable_if<
336 std::is_integral<_A1>::value && std::is_signed<_A1>::value, bool>::type
337signbit(_A1 __lcpp_x) _NOEXCEPT
338{ return __lcpp_x < 0; }
339
340template <class _A1>
341inline _LIBCPP_INLINE_VISIBILITY
342typename std::enable_if<
343 std::is_integral<_A1>::value && !std::is_signed<_A1>::value, bool>::type
344signbit(_A1) _NOEXCEPT
345{ return false; }
346
Shoaib Meenai159375f2017-04-07 02:20:52 +0000347#elif defined(_LIBCPP_MSVCRT)
Saleem Abdulrasool257256b2017-02-18 19:28:38 +0000348
349template <typename _A1>
350inline _LIBCPP_INLINE_VISIBILITY
Duncan P. N. Exon Smith321d6bf2017-04-21 23:14:55 +0000351typename std::enable_if<std::is_floating_point<_A1>::value, bool>::type
Saleem Abdulrasool257256b2017-02-18 19:28:38 +0000352signbit(_A1 __lcpp_x) _NOEXCEPT
353{
354 return ::signbit(static_cast<typename std::__promote<_A1>::type>(__lcpp_x));
355}
356
Duncan P. N. Exon Smith321d6bf2017-04-21 23:14:55 +0000357template <class _A1>
358inline _LIBCPP_INLINE_VISIBILITY
359typename std::enable_if<
360 std::is_integral<_A1>::value && std::is_signed<_A1>::value, bool>::type
361signbit(_A1 __lcpp_x) _NOEXCEPT
362{ return __lcpp_x < 0; }
363
364template <class _A1>
365inline _LIBCPP_INLINE_VISIBILITY
366typename std::enable_if<
367 std::is_integral<_A1>::value && !std::is_signed<_A1>::value, bool>::type
368signbit(_A1) _NOEXCEPT
369{ return false; }
370
Richard Smith081bb592015-10-08 20:40:34 +0000371#endif // signbit
372
373// fpclassify
374
375#ifdef fpclassify
376
377template <class _A1>
Louis Dionne16fe2952018-07-11 23:14:33 +0000378_LIBCPP_INLINE_VISIBILITY
Richard Smith081bb592015-10-08 20:40:34 +0000379int
380__libcpp_fpclassify(_A1 __lcpp_x) _NOEXCEPT
381{
382 return fpclassify(__lcpp_x);
383}
384
385#undef fpclassify
386
387template <class _A1>
388inline _LIBCPP_INLINE_VISIBILITY
Duncan P. N. Exon Smith321d6bf2017-04-21 23:14:55 +0000389typename std::enable_if<std::is_floating_point<_A1>::value, int>::type
Richard Smith081bb592015-10-08 20:40:34 +0000390fpclassify(_A1 __lcpp_x) _NOEXCEPT
391{
392 return __libcpp_fpclassify((typename std::__promote<_A1>::type)__lcpp_x);
393}
394
Duncan P. N. Exon Smith321d6bf2017-04-21 23:14:55 +0000395template <class _A1>
396inline _LIBCPP_INLINE_VISIBILITY
397typename std::enable_if<std::is_integral<_A1>::value, int>::type
398fpclassify(_A1 __lcpp_x) _NOEXCEPT
399{ return __lcpp_x == 0 ? FP_ZERO : FP_NORMAL; }
400
Shoaib Meenai159375f2017-04-07 02:20:52 +0000401#elif defined(_LIBCPP_MSVCRT)
Saleem Abdulrasool257256b2017-02-18 19:28:38 +0000402
403template <typename _A1>
404inline _LIBCPP_INLINE_VISIBILITY
Duncan P. N. Exon Smith321d6bf2017-04-21 23:14:55 +0000405typename std::enable_if<std::is_floating_point<_A1>::value, bool>::type
Saleem Abdulrasool257256b2017-02-18 19:28:38 +0000406fpclassify(_A1 __lcpp_x) _NOEXCEPT
407{
408 return ::fpclassify(static_cast<typename std::__promote<_A1>::type>(__lcpp_x));
409}
410
Duncan P. N. Exon Smith321d6bf2017-04-21 23:14:55 +0000411template <class _A1>
412inline _LIBCPP_INLINE_VISIBILITY
413typename std::enable_if<std::is_integral<_A1>::value, int>::type
414fpclassify(_A1 __lcpp_x) _NOEXCEPT
415{ return __lcpp_x == 0 ? FP_ZERO : FP_NORMAL; }
416
Richard Smith081bb592015-10-08 20:40:34 +0000417#endif // fpclassify
418
419// isfinite
420
421#ifdef isfinite
422
423template <class _A1>
Louis Dionne16fe2952018-07-11 23:14:33 +0000424_LIBCPP_INLINE_VISIBILITY
Richard Smith081bb592015-10-08 20:40:34 +0000425bool
426__libcpp_isfinite(_A1 __lcpp_x) _NOEXCEPT
427{
428 return isfinite(__lcpp_x);
429}
430
431#undef isfinite
432
433template <class _A1>
434inline _LIBCPP_INLINE_VISIBILITY
Duncan P. N. Exon Smith321d6bf2017-04-21 23:14:55 +0000435typename std::enable_if<
436 std::is_arithmetic<_A1>::value && std::numeric_limits<_A1>::has_infinity,
437 bool>::type
Richard Smith081bb592015-10-08 20:40:34 +0000438isfinite(_A1 __lcpp_x) _NOEXCEPT
439{
440 return __libcpp_isfinite((typename std::__promote<_A1>::type)__lcpp_x);
441}
442
Duncan P. N. Exon Smith321d6bf2017-04-21 23:14:55 +0000443template <class _A1>
444inline _LIBCPP_INLINE_VISIBILITY
445typename std::enable_if<
446 std::is_arithmetic<_A1>::value && !std::numeric_limits<_A1>::has_infinity,
447 bool>::type
448isfinite(_A1) _NOEXCEPT
449{ return true; }
450
Richard Smith081bb592015-10-08 20:40:34 +0000451#endif // isfinite
452
453// isinf
454
455#ifdef isinf
456
457template <class _A1>
Louis Dionne16fe2952018-07-11 23:14:33 +0000458_LIBCPP_INLINE_VISIBILITY
Richard Smith081bb592015-10-08 20:40:34 +0000459bool
460__libcpp_isinf(_A1 __lcpp_x) _NOEXCEPT
461{
462 return isinf(__lcpp_x);
463}
464
465#undef isinf
466
467template <class _A1>
468inline _LIBCPP_INLINE_VISIBILITY
Duncan P. N. Exon Smith321d6bf2017-04-21 23:14:55 +0000469typename std::enable_if<
470 std::is_arithmetic<_A1>::value && std::numeric_limits<_A1>::has_infinity,
471 bool>::type
Richard Smith081bb592015-10-08 20:40:34 +0000472isinf(_A1 __lcpp_x) _NOEXCEPT
473{
474 return __libcpp_isinf((typename std::__promote<_A1>::type)__lcpp_x);
475}
476
Duncan P. N. Exon Smith321d6bf2017-04-21 23:14:55 +0000477template <class _A1>
478inline _LIBCPP_INLINE_VISIBILITY
479typename std::enable_if<
480 std::is_arithmetic<_A1>::value && !std::numeric_limits<_A1>::has_infinity,
481 bool>::type
482isinf(_A1) _NOEXCEPT
483{ return false; }
484
Richard Smithafccfd32018-05-01 03:05:40 +0000485#ifdef _LIBCPP_PREFERRED_OVERLOAD
486inline _LIBCPP_INLINE_VISIBILITY
487bool
488isinf(float __lcpp_x) _NOEXCEPT { return __libcpp_isinf(__lcpp_x); }
489
490inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_PREFERRED_OVERLOAD
491bool
492isinf(double __lcpp_x) _NOEXCEPT { return __libcpp_isinf(__lcpp_x); }
493
494inline _LIBCPP_INLINE_VISIBILITY
495bool
496isinf(long double __lcpp_x) _NOEXCEPT { return __libcpp_isinf(__lcpp_x); }
497#endif
498
Richard Smith081bb592015-10-08 20:40:34 +0000499#endif // isinf
500
501// isnan
502
503#ifdef isnan
504
505template <class _A1>
Louis Dionne16fe2952018-07-11 23:14:33 +0000506_LIBCPP_INLINE_VISIBILITY
Richard Smith081bb592015-10-08 20:40:34 +0000507bool
508__libcpp_isnan(_A1 __lcpp_x) _NOEXCEPT
509{
510 return isnan(__lcpp_x);
511}
512
513#undef isnan
514
515template <class _A1>
516inline _LIBCPP_INLINE_VISIBILITY
Duncan P. N. Exon Smith321d6bf2017-04-21 23:14:55 +0000517typename std::enable_if<std::is_floating_point<_A1>::value, bool>::type
Richard Smith081bb592015-10-08 20:40:34 +0000518isnan(_A1 __lcpp_x) _NOEXCEPT
519{
520 return __libcpp_isnan((typename std::__promote<_A1>::type)__lcpp_x);
521}
522
Duncan P. N. Exon Smith321d6bf2017-04-21 23:14:55 +0000523template <class _A1>
524inline _LIBCPP_INLINE_VISIBILITY
525typename std::enable_if<std::is_integral<_A1>::value, bool>::type
526isnan(_A1) _NOEXCEPT
527{ return false; }
528
Richard Smithafccfd32018-05-01 03:05:40 +0000529#ifdef _LIBCPP_PREFERRED_OVERLOAD
530inline _LIBCPP_INLINE_VISIBILITY
531bool
532isnan(float __lcpp_x) _NOEXCEPT { return __libcpp_isnan(__lcpp_x); }
533
534inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_PREFERRED_OVERLOAD
535bool
536isnan(double __lcpp_x) _NOEXCEPT { return __libcpp_isnan(__lcpp_x); }
537
538inline _LIBCPP_INLINE_VISIBILITY
539bool
540isnan(long double __lcpp_x) _NOEXCEPT { return __libcpp_isnan(__lcpp_x); }
541#endif
542
Richard Smith081bb592015-10-08 20:40:34 +0000543#endif // isnan
544
545// isnormal
546
547#ifdef isnormal
548
549template <class _A1>
Louis Dionne16fe2952018-07-11 23:14:33 +0000550_LIBCPP_INLINE_VISIBILITY
Richard Smith081bb592015-10-08 20:40:34 +0000551bool
552__libcpp_isnormal(_A1 __lcpp_x) _NOEXCEPT
553{
554 return isnormal(__lcpp_x);
555}
556
557#undef isnormal
558
559template <class _A1>
560inline _LIBCPP_INLINE_VISIBILITY
Duncan P. N. Exon Smith321d6bf2017-04-21 23:14:55 +0000561typename std::enable_if<std::is_floating_point<_A1>::value, bool>::type
Richard Smith081bb592015-10-08 20:40:34 +0000562isnormal(_A1 __lcpp_x) _NOEXCEPT
563{
564 return __libcpp_isnormal((typename std::__promote<_A1>::type)__lcpp_x);
565}
566
Duncan P. N. Exon Smith321d6bf2017-04-21 23:14:55 +0000567template <class _A1>
568inline _LIBCPP_INLINE_VISIBILITY
569typename std::enable_if<std::is_integral<_A1>::value, bool>::type
570isnormal(_A1 __lcpp_x) _NOEXCEPT
571{ return __lcpp_x != 0; }
572
Richard Smith081bb592015-10-08 20:40:34 +0000573#endif // isnormal
574
575// isgreater
576
577#ifdef isgreater
578
579template <class _A1, class _A2>
Louis Dionne16fe2952018-07-11 23:14:33 +0000580_LIBCPP_INLINE_VISIBILITY
Richard Smith081bb592015-10-08 20:40:34 +0000581bool
582__libcpp_isgreater(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
583{
584 return isgreater(__lcpp_x, __lcpp_y);
585}
586
587#undef isgreater
588
589template <class _A1, class _A2>
590inline _LIBCPP_INLINE_VISIBILITY
591typename std::enable_if
592<
593 std::is_arithmetic<_A1>::value &&
594 std::is_arithmetic<_A2>::value,
595 bool
596>::type
597isgreater(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
598{
599 typedef typename std::__promote<_A1, _A2>::type type;
600 return __libcpp_isgreater((type)__lcpp_x, (type)__lcpp_y);
601}
602
603#endif // isgreater
604
605// isgreaterequal
606
607#ifdef isgreaterequal
608
609template <class _A1, class _A2>
Louis Dionne16fe2952018-07-11 23:14:33 +0000610_LIBCPP_INLINE_VISIBILITY
Richard Smith081bb592015-10-08 20:40:34 +0000611bool
612__libcpp_isgreaterequal(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
613{
614 return isgreaterequal(__lcpp_x, __lcpp_y);
615}
616
617#undef isgreaterequal
618
619template <class _A1, class _A2>
620inline _LIBCPP_INLINE_VISIBILITY
621typename std::enable_if
622<
623 std::is_arithmetic<_A1>::value &&
624 std::is_arithmetic<_A2>::value,
625 bool
626>::type
627isgreaterequal(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
628{
629 typedef typename std::__promote<_A1, _A2>::type type;
630 return __libcpp_isgreaterequal((type)__lcpp_x, (type)__lcpp_y);
631}
632
633#endif // isgreaterequal
634
635// isless
636
637#ifdef isless
638
639template <class _A1, class _A2>
Louis Dionne16fe2952018-07-11 23:14:33 +0000640_LIBCPP_INLINE_VISIBILITY
Richard Smith081bb592015-10-08 20:40:34 +0000641bool
642__libcpp_isless(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
643{
644 return isless(__lcpp_x, __lcpp_y);
645}
646
647#undef isless
648
649template <class _A1, class _A2>
650inline _LIBCPP_INLINE_VISIBILITY
651typename std::enable_if
652<
653 std::is_arithmetic<_A1>::value &&
654 std::is_arithmetic<_A2>::value,
655 bool
656>::type
657isless(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
658{
659 typedef typename std::__promote<_A1, _A2>::type type;
660 return __libcpp_isless((type)__lcpp_x, (type)__lcpp_y);
661}
662
663#endif // isless
664
665// islessequal
666
667#ifdef islessequal
668
669template <class _A1, class _A2>
Louis Dionne16fe2952018-07-11 23:14:33 +0000670_LIBCPP_INLINE_VISIBILITY
Richard Smith081bb592015-10-08 20:40:34 +0000671bool
672__libcpp_islessequal(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
673{
674 return islessequal(__lcpp_x, __lcpp_y);
675}
676
677#undef islessequal
678
679template <class _A1, class _A2>
680inline _LIBCPP_INLINE_VISIBILITY
681typename std::enable_if
682<
683 std::is_arithmetic<_A1>::value &&
684 std::is_arithmetic<_A2>::value,
685 bool
686>::type
687islessequal(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
688{
689 typedef typename std::__promote<_A1, _A2>::type type;
690 return __libcpp_islessequal((type)__lcpp_x, (type)__lcpp_y);
691}
692
693#endif // islessequal
694
695// islessgreater
696
697#ifdef islessgreater
698
699template <class _A1, class _A2>
Louis Dionne16fe2952018-07-11 23:14:33 +0000700_LIBCPP_INLINE_VISIBILITY
Richard Smith081bb592015-10-08 20:40:34 +0000701bool
702__libcpp_islessgreater(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
703{
704 return islessgreater(__lcpp_x, __lcpp_y);
705}
706
707#undef islessgreater
708
709template <class _A1, class _A2>
710inline _LIBCPP_INLINE_VISIBILITY
711typename std::enable_if
712<
713 std::is_arithmetic<_A1>::value &&
714 std::is_arithmetic<_A2>::value,
715 bool
716>::type
717islessgreater(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
718{
719 typedef typename std::__promote<_A1, _A2>::type type;
720 return __libcpp_islessgreater((type)__lcpp_x, (type)__lcpp_y);
721}
722
723#endif // islessgreater
724
725// isunordered
726
727#ifdef isunordered
728
729template <class _A1, class _A2>
Louis Dionne16fe2952018-07-11 23:14:33 +0000730_LIBCPP_INLINE_VISIBILITY
Richard Smith081bb592015-10-08 20:40:34 +0000731bool
732__libcpp_isunordered(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
733{
734 return isunordered(__lcpp_x, __lcpp_y);
735}
736
737#undef isunordered
738
739template <class _A1, class _A2>
740inline _LIBCPP_INLINE_VISIBILITY
741typename std::enable_if
742<
743 std::is_arithmetic<_A1>::value &&
744 std::is_arithmetic<_A2>::value,
745 bool
746>::type
747isunordered(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
748{
749 typedef typename std::__promote<_A1, _A2>::type type;
750 return __libcpp_isunordered((type)__lcpp_x, (type)__lcpp_y);
751}
752
753#endif // isunordered
754
Richard Smith081bb592015-10-08 20:40:34 +0000755// abs
756
Eric Fiselier7d1aac92016-08-15 18:58:57 +0000757#if !(defined(_AIX) || defined(__sun__))
Richard Smith081bb592015-10-08 20:40:34 +0000758inline _LIBCPP_INLINE_VISIBILITY
759float
Mehdi Aminib3da6322017-02-10 02:44:23 +0000760abs(float __lcpp_x) _NOEXCEPT {return ::fabsf(__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +0000761
762inline _LIBCPP_INLINE_VISIBILITY
763double
Mehdi Aminib3da6322017-02-10 02:44:23 +0000764abs(double __lcpp_x) _NOEXCEPT {return ::fabs(__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +0000765
766inline _LIBCPP_INLINE_VISIBILITY
767long double
Mehdi Aminib3da6322017-02-10 02:44:23 +0000768abs(long double __lcpp_x) _NOEXCEPT {return ::fabsl(__lcpp_x);}
Eric Fiselier7d1aac92016-08-15 18:58:57 +0000769#endif // !(defined(_AIX) || defined(__sun__))
Richard Smith081bb592015-10-08 20:40:34 +0000770
771// acos
772
Shoaib Meenai159375f2017-04-07 02:20:52 +0000773#if !(defined(_AIX) || defined(__sun__))
Mehdi Aminib3da6322017-02-10 02:44:23 +0000774inline _LIBCPP_INLINE_VISIBILITY float acos(float __lcpp_x) _NOEXCEPT {return ::acosf(__lcpp_x);}
775inline _LIBCPP_INLINE_VISIBILITY long double acos(long double __lcpp_x) _NOEXCEPT {return ::acosl(__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +0000776#endif
777
778template <class _A1>
779inline _LIBCPP_INLINE_VISIBILITY
780typename std::enable_if<std::is_integral<_A1>::value, double>::type
Mehdi Aminib3da6322017-02-10 02:44:23 +0000781acos(_A1 __lcpp_x) _NOEXCEPT {return ::acos((double)__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +0000782
783// asin
784
Shoaib Meenai159375f2017-04-07 02:20:52 +0000785#if !(defined(_AIX) || defined(__sun__))
Mehdi Aminib3da6322017-02-10 02:44:23 +0000786inline _LIBCPP_INLINE_VISIBILITY float asin(float __lcpp_x) _NOEXCEPT {return ::asinf(__lcpp_x);}
787inline _LIBCPP_INLINE_VISIBILITY long double asin(long double __lcpp_x) _NOEXCEPT {return ::asinl(__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +0000788#endif
789
790template <class _A1>
791inline _LIBCPP_INLINE_VISIBILITY
792typename std::enable_if<std::is_integral<_A1>::value, double>::type
Mehdi Aminib3da6322017-02-10 02:44:23 +0000793asin(_A1 __lcpp_x) _NOEXCEPT {return ::asin((double)__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +0000794
795// atan
796
Shoaib Meenai159375f2017-04-07 02:20:52 +0000797#if !(defined(_AIX) || defined(__sun__))
Mehdi Aminib3da6322017-02-10 02:44:23 +0000798inline _LIBCPP_INLINE_VISIBILITY float atan(float __lcpp_x) _NOEXCEPT {return ::atanf(__lcpp_x);}
799inline _LIBCPP_INLINE_VISIBILITY long double atan(long double __lcpp_x) _NOEXCEPT {return ::atanl(__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +0000800#endif
801
802template <class _A1>
803inline _LIBCPP_INLINE_VISIBILITY
804typename std::enable_if<std::is_integral<_A1>::value, double>::type
Mehdi Aminib3da6322017-02-10 02:44:23 +0000805atan(_A1 __lcpp_x) _NOEXCEPT {return ::atan((double)__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +0000806
807// atan2
808
Shoaib Meenai159375f2017-04-07 02:20:52 +0000809#if !(defined(_AIX) || defined(__sun__))
Mehdi Aminib3da6322017-02-10 02:44:23 +0000810inline _LIBCPP_INLINE_VISIBILITY float atan2(float __lcpp_y, float __lcpp_x) _NOEXCEPT {return ::atan2f(__lcpp_y, __lcpp_x);}
811inline _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 +0000812#endif
813
814template <class _A1, class _A2>
815inline _LIBCPP_INLINE_VISIBILITY
816typename std::__lazy_enable_if
817<
818 std::is_arithmetic<_A1>::value &&
819 std::is_arithmetic<_A2>::value,
820 std::__promote<_A1, _A2>
821>::type
822atan2(_A1 __lcpp_y, _A2 __lcpp_x) _NOEXCEPT
823{
824 typedef typename std::__promote<_A1, _A2>::type __result_type;
825 static_assert((!(std::is_same<_A1, __result_type>::value &&
826 std::is_same<_A2, __result_type>::value)), "");
Mehdi Aminib3da6322017-02-10 02:44:23 +0000827 return ::atan2((__result_type)__lcpp_y, (__result_type)__lcpp_x);
Richard Smith081bb592015-10-08 20:40:34 +0000828}
829
830// ceil
831
Shoaib Meenai159375f2017-04-07 02:20:52 +0000832#if !(defined(_AIX) || defined(__sun__))
Mehdi Aminib3da6322017-02-10 02:44:23 +0000833inline _LIBCPP_INLINE_VISIBILITY float ceil(float __lcpp_x) _NOEXCEPT {return ::ceilf(__lcpp_x);}
834inline _LIBCPP_INLINE_VISIBILITY long double ceil(long double __lcpp_x) _NOEXCEPT {return ::ceill(__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +0000835#endif
836
837template <class _A1>
838inline _LIBCPP_INLINE_VISIBILITY
839typename std::enable_if<std::is_integral<_A1>::value, double>::type
Mehdi Aminib3da6322017-02-10 02:44:23 +0000840ceil(_A1 __lcpp_x) _NOEXCEPT {return ::ceil((double)__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +0000841
842// cos
843
Shoaib Meenai159375f2017-04-07 02:20:52 +0000844#if !(defined(_AIX) || defined(__sun__))
Mehdi Aminib3da6322017-02-10 02:44:23 +0000845inline _LIBCPP_INLINE_VISIBILITY float cos(float __lcpp_x) _NOEXCEPT {return ::cosf(__lcpp_x);}
846inline _LIBCPP_INLINE_VISIBILITY long double cos(long double __lcpp_x) _NOEXCEPT {return ::cosl(__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +0000847#endif
848
849template <class _A1>
850inline _LIBCPP_INLINE_VISIBILITY
851typename std::enable_if<std::is_integral<_A1>::value, double>::type
Mehdi Aminib3da6322017-02-10 02:44:23 +0000852cos(_A1 __lcpp_x) _NOEXCEPT {return ::cos((double)__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +0000853
854// cosh
855
Shoaib Meenai159375f2017-04-07 02:20:52 +0000856#if !(defined(_AIX) || defined(__sun__))
Mehdi Aminib3da6322017-02-10 02:44:23 +0000857inline _LIBCPP_INLINE_VISIBILITY float cosh(float __lcpp_x) _NOEXCEPT {return ::coshf(__lcpp_x);}
858inline _LIBCPP_INLINE_VISIBILITY long double cosh(long double __lcpp_x) _NOEXCEPT {return ::coshl(__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +0000859#endif
860
861template <class _A1>
862inline _LIBCPP_INLINE_VISIBILITY
863typename std::enable_if<std::is_integral<_A1>::value, double>::type
Mehdi Aminib3da6322017-02-10 02:44:23 +0000864cosh(_A1 __lcpp_x) _NOEXCEPT {return ::cosh((double)__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +0000865
866// exp
867
Shoaib Meenai159375f2017-04-07 02:20:52 +0000868#if !(defined(_AIX) || defined(__sun__))
Mehdi Aminib3da6322017-02-10 02:44:23 +0000869inline _LIBCPP_INLINE_VISIBILITY float exp(float __lcpp_x) _NOEXCEPT {return ::expf(__lcpp_x);}
870inline _LIBCPP_INLINE_VISIBILITY long double exp(long double __lcpp_x) _NOEXCEPT {return ::expl(__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +0000871#endif
872
873template <class _A1>
874inline _LIBCPP_INLINE_VISIBILITY
875typename std::enable_if<std::is_integral<_A1>::value, double>::type
Mehdi Aminib3da6322017-02-10 02:44:23 +0000876exp(_A1 __lcpp_x) _NOEXCEPT {return ::exp((double)__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +0000877
878// fabs
879
Shoaib Meenai159375f2017-04-07 02:20:52 +0000880#if !(defined(_AIX) || defined(__sun__))
Mehdi Aminib3da6322017-02-10 02:44:23 +0000881inline _LIBCPP_INLINE_VISIBILITY float fabs(float __lcpp_x) _NOEXCEPT {return ::fabsf(__lcpp_x);}
882inline _LIBCPP_INLINE_VISIBILITY long double fabs(long double __lcpp_x) _NOEXCEPT {return ::fabsl(__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +0000883#endif
884
885template <class _A1>
886inline _LIBCPP_INLINE_VISIBILITY
887typename std::enable_if<std::is_integral<_A1>::value, double>::type
Mehdi Aminib3da6322017-02-10 02:44:23 +0000888fabs(_A1 __lcpp_x) _NOEXCEPT {return ::fabs((double)__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +0000889
890// floor
891
Shoaib Meenai159375f2017-04-07 02:20:52 +0000892#if !(defined(_AIX) || defined(__sun__))
Mehdi Aminib3da6322017-02-10 02:44:23 +0000893inline _LIBCPP_INLINE_VISIBILITY float floor(float __lcpp_x) _NOEXCEPT {return ::floorf(__lcpp_x);}
894inline _LIBCPP_INLINE_VISIBILITY long double floor(long double __lcpp_x) _NOEXCEPT {return ::floorl(__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +0000895#endif
896
897template <class _A1>
898inline _LIBCPP_INLINE_VISIBILITY
899typename std::enable_if<std::is_integral<_A1>::value, double>::type
Mehdi Aminib3da6322017-02-10 02:44:23 +0000900floor(_A1 __lcpp_x) _NOEXCEPT {return ::floor((double)__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +0000901
902// fmod
903
Shoaib Meenai159375f2017-04-07 02:20:52 +0000904#if !(defined(_AIX) || defined(__sun__))
Mehdi Aminib3da6322017-02-10 02:44:23 +0000905inline _LIBCPP_INLINE_VISIBILITY float fmod(float __lcpp_x, float __lcpp_y) _NOEXCEPT {return ::fmodf(__lcpp_x, __lcpp_y);}
906inline _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 +0000907#endif
908
909template <class _A1, class _A2>
910inline _LIBCPP_INLINE_VISIBILITY
911typename std::__lazy_enable_if
912<
913 std::is_arithmetic<_A1>::value &&
914 std::is_arithmetic<_A2>::value,
915 std::__promote<_A1, _A2>
916>::type
917fmod(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
918{
919 typedef typename std::__promote<_A1, _A2>::type __result_type;
920 static_assert((!(std::is_same<_A1, __result_type>::value &&
921 std::is_same<_A2, __result_type>::value)), "");
Mehdi Aminib3da6322017-02-10 02:44:23 +0000922 return ::fmod((__result_type)__lcpp_x, (__result_type)__lcpp_y);
Richard Smith081bb592015-10-08 20:40:34 +0000923}
924
925// frexp
926
Shoaib Meenai159375f2017-04-07 02:20:52 +0000927#if !(defined(_AIX) || defined(__sun__))
Mehdi Aminib3da6322017-02-10 02:44:23 +0000928inline _LIBCPP_INLINE_VISIBILITY float frexp(float __lcpp_x, int* __lcpp_e) _NOEXCEPT {return ::frexpf(__lcpp_x, __lcpp_e);}
929inline _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 +0000930#endif
931
932template <class _A1>
933inline _LIBCPP_INLINE_VISIBILITY
934typename std::enable_if<std::is_integral<_A1>::value, double>::type
Mehdi Aminib3da6322017-02-10 02:44:23 +0000935frexp(_A1 __lcpp_x, int* __lcpp_e) _NOEXCEPT {return ::frexp((double)__lcpp_x, __lcpp_e);}
Richard Smith081bb592015-10-08 20:40:34 +0000936
937// ldexp
938
Shoaib Meenai159375f2017-04-07 02:20:52 +0000939#if !(defined(_AIX) || defined(__sun__))
Mehdi Aminib3da6322017-02-10 02:44:23 +0000940inline _LIBCPP_INLINE_VISIBILITY float ldexp(float __lcpp_x, int __lcpp_e) _NOEXCEPT {return ::ldexpf(__lcpp_x, __lcpp_e);}
941inline _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 +0000942#endif
943
944template <class _A1>
945inline _LIBCPP_INLINE_VISIBILITY
946typename std::enable_if<std::is_integral<_A1>::value, double>::type
Mehdi Aminib3da6322017-02-10 02:44:23 +0000947ldexp(_A1 __lcpp_x, int __lcpp_e) _NOEXCEPT {return ::ldexp((double)__lcpp_x, __lcpp_e);}
Richard Smith081bb592015-10-08 20:40:34 +0000948
949// log
950
Shoaib Meenai159375f2017-04-07 02:20:52 +0000951#if !(defined(_AIX) || defined(__sun__))
Mehdi Aminib3da6322017-02-10 02:44:23 +0000952inline _LIBCPP_INLINE_VISIBILITY float log(float __lcpp_x) _NOEXCEPT {return ::logf(__lcpp_x);}
953inline _LIBCPP_INLINE_VISIBILITY long double log(long double __lcpp_x) _NOEXCEPT {return ::logl(__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +0000954#endif
955
956template <class _A1>
957inline _LIBCPP_INLINE_VISIBILITY
958typename std::enable_if<std::is_integral<_A1>::value, double>::type
Mehdi Aminib3da6322017-02-10 02:44:23 +0000959log(_A1 __lcpp_x) _NOEXCEPT {return ::log((double)__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +0000960
961// log10
962
Shoaib Meenai159375f2017-04-07 02:20:52 +0000963#if !(defined(_AIX) || defined(__sun__))
Mehdi Aminib3da6322017-02-10 02:44:23 +0000964inline _LIBCPP_INLINE_VISIBILITY float log10(float __lcpp_x) _NOEXCEPT {return ::log10f(__lcpp_x);}
965inline _LIBCPP_INLINE_VISIBILITY long double log10(long double __lcpp_x) _NOEXCEPT {return ::log10l(__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +0000966#endif
967
968template <class _A1>
969inline _LIBCPP_INLINE_VISIBILITY
970typename std::enable_if<std::is_integral<_A1>::value, double>::type
Mehdi Aminib3da6322017-02-10 02:44:23 +0000971log10(_A1 __lcpp_x) _NOEXCEPT {return ::log10((double)__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +0000972
973// modf
974
Shoaib Meenai159375f2017-04-07 02:20:52 +0000975#if !(defined(_AIX) || defined(__sun__))
Mehdi Aminib3da6322017-02-10 02:44:23 +0000976inline _LIBCPP_INLINE_VISIBILITY float modf(float __lcpp_x, float* __lcpp_y) _NOEXCEPT {return ::modff(__lcpp_x, __lcpp_y);}
977inline _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 +0000978#endif
979
980// pow
981
Shoaib Meenai159375f2017-04-07 02:20:52 +0000982#if !(defined(_AIX) || defined(__sun__))
Mehdi Aminib3da6322017-02-10 02:44:23 +0000983inline _LIBCPP_INLINE_VISIBILITY float pow(float __lcpp_x, float __lcpp_y) _NOEXCEPT {return ::powf(__lcpp_x, __lcpp_y);}
984inline _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 +0000985#endif
986
987template <class _A1, class _A2>
988inline _LIBCPP_INLINE_VISIBILITY
989typename std::__lazy_enable_if
990<
991 std::is_arithmetic<_A1>::value &&
992 std::is_arithmetic<_A2>::value,
993 std::__promote<_A1, _A2>
994>::type
995pow(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
996{
997 typedef typename std::__promote<_A1, _A2>::type __result_type;
998 static_assert((!(std::is_same<_A1, __result_type>::value &&
999 std::is_same<_A2, __result_type>::value)), "");
Mehdi Aminib3da6322017-02-10 02:44:23 +00001000 return ::pow((__result_type)__lcpp_x, (__result_type)__lcpp_y);
Richard Smith081bb592015-10-08 20:40:34 +00001001}
1002
1003// sin
1004
Shoaib Meenai159375f2017-04-07 02:20:52 +00001005#if !(defined(_AIX) || defined(__sun__))
Mehdi Aminib3da6322017-02-10 02:44:23 +00001006inline _LIBCPP_INLINE_VISIBILITY float sin(float __lcpp_x) _NOEXCEPT {return ::sinf(__lcpp_x);}
1007inline _LIBCPP_INLINE_VISIBILITY long double sin(long double __lcpp_x) _NOEXCEPT {return ::sinl(__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +00001008#endif
1009
1010template <class _A1>
1011inline _LIBCPP_INLINE_VISIBILITY
1012typename std::enable_if<std::is_integral<_A1>::value, double>::type
Mehdi Aminib3da6322017-02-10 02:44:23 +00001013sin(_A1 __lcpp_x) _NOEXCEPT {return ::sin((double)__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +00001014
1015// sinh
1016
Shoaib Meenai159375f2017-04-07 02:20:52 +00001017#if !(defined(_AIX) || defined(__sun__))
Mehdi Aminib3da6322017-02-10 02:44:23 +00001018inline _LIBCPP_INLINE_VISIBILITY float sinh(float __lcpp_x) _NOEXCEPT {return ::sinhf(__lcpp_x);}
1019inline _LIBCPP_INLINE_VISIBILITY long double sinh(long double __lcpp_x) _NOEXCEPT {return ::sinhl(__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +00001020#endif
1021
1022template <class _A1>
1023inline _LIBCPP_INLINE_VISIBILITY
1024typename std::enable_if<std::is_integral<_A1>::value, double>::type
Mehdi Aminib3da6322017-02-10 02:44:23 +00001025sinh(_A1 __lcpp_x) _NOEXCEPT {return ::sinh((double)__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +00001026
1027// sqrt
1028
Shoaib Meenai159375f2017-04-07 02:20:52 +00001029#if !(defined(_AIX) || defined(__sun__))
Mehdi Aminib3da6322017-02-10 02:44:23 +00001030inline _LIBCPP_INLINE_VISIBILITY float sqrt(float __lcpp_x) _NOEXCEPT {return ::sqrtf(__lcpp_x);}
1031inline _LIBCPP_INLINE_VISIBILITY long double sqrt(long double __lcpp_x) _NOEXCEPT {return ::sqrtl(__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +00001032#endif
1033
Richard Smith081bb592015-10-08 20:40:34 +00001034template <class _A1>
1035inline _LIBCPP_INLINE_VISIBILITY
1036typename std::enable_if<std::is_integral<_A1>::value, double>::type
Mehdi Aminib3da6322017-02-10 02:44:23 +00001037sqrt(_A1 __lcpp_x) _NOEXCEPT {return ::sqrt((double)__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +00001038
1039// tan
1040
Shoaib Meenai159375f2017-04-07 02:20:52 +00001041#if !(defined(_AIX) || defined(__sun__))
Mehdi Aminib3da6322017-02-10 02:44:23 +00001042inline _LIBCPP_INLINE_VISIBILITY float tan(float __lcpp_x) _NOEXCEPT {return ::tanf(__lcpp_x);}
1043inline _LIBCPP_INLINE_VISIBILITY long double tan(long double __lcpp_x) _NOEXCEPT {return ::tanl(__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +00001044#endif
1045
1046template <class _A1>
1047inline _LIBCPP_INLINE_VISIBILITY
1048typename std::enable_if<std::is_integral<_A1>::value, double>::type
Mehdi Aminib3da6322017-02-10 02:44:23 +00001049tan(_A1 __lcpp_x) _NOEXCEPT {return ::tan((double)__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +00001050
1051// tanh
1052
Shoaib Meenai159375f2017-04-07 02:20:52 +00001053#if !(defined(_AIX) || defined(__sun__))
Mehdi Aminib3da6322017-02-10 02:44:23 +00001054inline _LIBCPP_INLINE_VISIBILITY float tanh(float __lcpp_x) _NOEXCEPT {return ::tanhf(__lcpp_x);}
1055inline _LIBCPP_INLINE_VISIBILITY long double tanh(long double __lcpp_x) _NOEXCEPT {return ::tanhl(__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +00001056#endif
1057
1058template <class _A1>
1059inline _LIBCPP_INLINE_VISIBILITY
1060typename std::enable_if<std::is_integral<_A1>::value, double>::type
Mehdi Aminib3da6322017-02-10 02:44:23 +00001061tanh(_A1 __lcpp_x) _NOEXCEPT {return ::tanh((double)__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +00001062
1063// acosh
1064
Mehdi Aminib3da6322017-02-10 02:44:23 +00001065inline _LIBCPP_INLINE_VISIBILITY float acosh(float __lcpp_x) _NOEXCEPT {return ::acoshf(__lcpp_x);}
1066inline _LIBCPP_INLINE_VISIBILITY long double acosh(long double __lcpp_x) _NOEXCEPT {return ::acoshl(__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +00001067
1068template <class _A1>
1069inline _LIBCPP_INLINE_VISIBILITY
1070typename std::enable_if<std::is_integral<_A1>::value, double>::type
Mehdi Aminib3da6322017-02-10 02:44:23 +00001071acosh(_A1 __lcpp_x) _NOEXCEPT {return ::acosh((double)__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +00001072
1073// asinh
1074
Mehdi Aminib3da6322017-02-10 02:44:23 +00001075inline _LIBCPP_INLINE_VISIBILITY float asinh(float __lcpp_x) _NOEXCEPT {return ::asinhf(__lcpp_x);}
1076inline _LIBCPP_INLINE_VISIBILITY long double asinh(long double __lcpp_x) _NOEXCEPT {return ::asinhl(__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +00001077
1078template <class _A1>
1079inline _LIBCPP_INLINE_VISIBILITY
1080typename std::enable_if<std::is_integral<_A1>::value, double>::type
Mehdi Aminib3da6322017-02-10 02:44:23 +00001081asinh(_A1 __lcpp_x) _NOEXCEPT {return ::asinh((double)__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +00001082
1083// atanh
1084
Mehdi Aminib3da6322017-02-10 02:44:23 +00001085inline _LIBCPP_INLINE_VISIBILITY float atanh(float __lcpp_x) _NOEXCEPT {return ::atanhf(__lcpp_x);}
1086inline _LIBCPP_INLINE_VISIBILITY long double atanh(long double __lcpp_x) _NOEXCEPT {return ::atanhl(__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +00001087
1088template <class _A1>
1089inline _LIBCPP_INLINE_VISIBILITY
1090typename std::enable_if<std::is_integral<_A1>::value, double>::type
Mehdi Aminib3da6322017-02-10 02:44:23 +00001091atanh(_A1 __lcpp_x) _NOEXCEPT {return ::atanh((double)__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +00001092
1093// cbrt
1094
Mehdi Aminib3da6322017-02-10 02:44:23 +00001095inline _LIBCPP_INLINE_VISIBILITY float cbrt(float __lcpp_x) _NOEXCEPT {return ::cbrtf(__lcpp_x);}
1096inline _LIBCPP_INLINE_VISIBILITY long double cbrt(long double __lcpp_x) _NOEXCEPT {return ::cbrtl(__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +00001097
1098template <class _A1>
1099inline _LIBCPP_INLINE_VISIBILITY
1100typename std::enable_if<std::is_integral<_A1>::value, double>::type
Mehdi Aminib3da6322017-02-10 02:44:23 +00001101cbrt(_A1 __lcpp_x) _NOEXCEPT {return ::cbrt((double)__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +00001102
1103// copysign
1104
Richard Smith081bb592015-10-08 20:40:34 +00001105inline _LIBCPP_INLINE_VISIBILITY float copysign(float __lcpp_x,
1106 float __lcpp_y) _NOEXCEPT {
Mehdi Aminib3da6322017-02-10 02:44:23 +00001107 return ::copysignf(__lcpp_x, __lcpp_y);
Richard Smith081bb592015-10-08 20:40:34 +00001108}
1109inline _LIBCPP_INLINE_VISIBILITY long double
1110copysign(long double __lcpp_x, long double __lcpp_y) _NOEXCEPT {
Mehdi Aminib3da6322017-02-10 02:44:23 +00001111 return ::copysignl(__lcpp_x, __lcpp_y);
Richard Smith081bb592015-10-08 20:40:34 +00001112}
Richard Smith081bb592015-10-08 20:40:34 +00001113
1114template <class _A1, class _A2>
1115inline _LIBCPP_INLINE_VISIBILITY
1116typename std::__lazy_enable_if
1117<
1118 std::is_arithmetic<_A1>::value &&
1119 std::is_arithmetic<_A2>::value,
1120 std::__promote<_A1, _A2>
1121>::type
1122copysign(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
1123{
1124 typedef typename std::__promote<_A1, _A2>::type __result_type;
1125 static_assert((!(std::is_same<_A1, __result_type>::value &&
1126 std::is_same<_A2, __result_type>::value)), "");
Mehdi Aminib3da6322017-02-10 02:44:23 +00001127 return ::copysign((__result_type)__lcpp_x, (__result_type)__lcpp_y);
Richard Smith081bb592015-10-08 20:40:34 +00001128}
1129
Richard Smith081bb592015-10-08 20:40:34 +00001130// erf
1131
Mehdi Aminib3da6322017-02-10 02:44:23 +00001132inline _LIBCPP_INLINE_VISIBILITY float erf(float __lcpp_x) _NOEXCEPT {return ::erff(__lcpp_x);}
1133inline _LIBCPP_INLINE_VISIBILITY long double erf(long double __lcpp_x) _NOEXCEPT {return ::erfl(__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +00001134
1135template <class _A1>
1136inline _LIBCPP_INLINE_VISIBILITY
1137typename std::enable_if<std::is_integral<_A1>::value, double>::type
Mehdi Aminib3da6322017-02-10 02:44:23 +00001138erf(_A1 __lcpp_x) _NOEXCEPT {return ::erf((double)__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +00001139
1140// erfc
1141
Mehdi Aminib3da6322017-02-10 02:44:23 +00001142inline _LIBCPP_INLINE_VISIBILITY float erfc(float __lcpp_x) _NOEXCEPT {return ::erfcf(__lcpp_x);}
1143inline _LIBCPP_INLINE_VISIBILITY long double erfc(long double __lcpp_x) _NOEXCEPT {return ::erfcl(__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +00001144
1145template <class _A1>
1146inline _LIBCPP_INLINE_VISIBILITY
1147typename std::enable_if<std::is_integral<_A1>::value, double>::type
Mehdi Aminib3da6322017-02-10 02:44:23 +00001148erfc(_A1 __lcpp_x) _NOEXCEPT {return ::erfc((double)__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +00001149
1150// exp2
1151
Mehdi Aminib3da6322017-02-10 02:44:23 +00001152inline _LIBCPP_INLINE_VISIBILITY float exp2(float __lcpp_x) _NOEXCEPT {return ::exp2f(__lcpp_x);}
1153inline _LIBCPP_INLINE_VISIBILITY long double exp2(long double __lcpp_x) _NOEXCEPT {return ::exp2l(__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +00001154
1155template <class _A1>
1156inline _LIBCPP_INLINE_VISIBILITY
1157typename std::enable_if<std::is_integral<_A1>::value, double>::type
Mehdi Aminib3da6322017-02-10 02:44:23 +00001158exp2(_A1 __lcpp_x) _NOEXCEPT {return ::exp2((double)__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +00001159
1160// expm1
1161
Mehdi Aminib3da6322017-02-10 02:44:23 +00001162inline _LIBCPP_INLINE_VISIBILITY float expm1(float __lcpp_x) _NOEXCEPT {return ::expm1f(__lcpp_x);}
1163inline _LIBCPP_INLINE_VISIBILITY long double expm1(long double __lcpp_x) _NOEXCEPT {return ::expm1l(__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 +00001168expm1(_A1 __lcpp_x) _NOEXCEPT {return ::expm1((double)__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +00001169
1170// fdim
1171
Mehdi Aminib3da6322017-02-10 02:44:23 +00001172inline _LIBCPP_INLINE_VISIBILITY float fdim(float __lcpp_x, float __lcpp_y) _NOEXCEPT {return ::fdimf(__lcpp_x, __lcpp_y);}
1173inline _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 +00001174
1175template <class _A1, class _A2>
1176inline _LIBCPP_INLINE_VISIBILITY
1177typename std::__lazy_enable_if
1178<
1179 std::is_arithmetic<_A1>::value &&
1180 std::is_arithmetic<_A2>::value,
1181 std::__promote<_A1, _A2>
1182>::type
1183fdim(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
1184{
1185 typedef typename std::__promote<_A1, _A2>::type __result_type;
1186 static_assert((!(std::is_same<_A1, __result_type>::value &&
1187 std::is_same<_A2, __result_type>::value)), "");
Mehdi Aminib3da6322017-02-10 02:44:23 +00001188 return ::fdim((__result_type)__lcpp_x, (__result_type)__lcpp_y);
Richard Smith081bb592015-10-08 20:40:34 +00001189}
1190
1191// fma
1192
Mehdi Aminib3da6322017-02-10 02:44:23 +00001193inline _LIBCPP_INLINE_VISIBILITY float fma(float __lcpp_x, float __lcpp_y, float __lcpp_z) _NOEXCEPT {return ::fmaf(__lcpp_x, __lcpp_y, __lcpp_z);}
1194inline _LIBCPP_INLINE_VISIBILITY long double fma(long double __lcpp_x, long double __lcpp_y, long double __lcpp_z) _NOEXCEPT {return ::fmal(__lcpp_x, __lcpp_y, __lcpp_z);}
Richard Smith081bb592015-10-08 20:40:34 +00001195
1196template <class _A1, class _A2, class _A3>
1197inline _LIBCPP_INLINE_VISIBILITY
1198typename std::__lazy_enable_if
1199<
1200 std::is_arithmetic<_A1>::value &&
1201 std::is_arithmetic<_A2>::value &&
1202 std::is_arithmetic<_A3>::value,
1203 std::__promote<_A1, _A2, _A3>
1204>::type
1205fma(_A1 __lcpp_x, _A2 __lcpp_y, _A3 __lcpp_z) _NOEXCEPT
1206{
1207 typedef typename std::__promote<_A1, _A2, _A3>::type __result_type;
1208 static_assert((!(std::is_same<_A1, __result_type>::value &&
1209 std::is_same<_A2, __result_type>::value &&
1210 std::is_same<_A3, __result_type>::value)), "");
Mehdi Aminib3da6322017-02-10 02:44:23 +00001211 return ::fma((__result_type)__lcpp_x, (__result_type)__lcpp_y, (__result_type)__lcpp_z);
Richard Smith081bb592015-10-08 20:40:34 +00001212}
1213
1214// fmax
1215
Mehdi Aminib3da6322017-02-10 02:44:23 +00001216inline _LIBCPP_INLINE_VISIBILITY float fmax(float __lcpp_x, float __lcpp_y) _NOEXCEPT {return ::fmaxf(__lcpp_x, __lcpp_y);}
1217inline _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 +00001218
1219template <class _A1, class _A2>
1220inline _LIBCPP_INLINE_VISIBILITY
1221typename std::__lazy_enable_if
1222<
1223 std::is_arithmetic<_A1>::value &&
1224 std::is_arithmetic<_A2>::value,
1225 std::__promote<_A1, _A2>
1226>::type
1227fmax(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
1228{
1229 typedef typename std::__promote<_A1, _A2>::type __result_type;
1230 static_assert((!(std::is_same<_A1, __result_type>::value &&
1231 std::is_same<_A2, __result_type>::value)), "");
Mehdi Aminib3da6322017-02-10 02:44:23 +00001232 return ::fmax((__result_type)__lcpp_x, (__result_type)__lcpp_y);
Richard Smith081bb592015-10-08 20:40:34 +00001233}
1234
1235// fmin
1236
Mehdi Aminib3da6322017-02-10 02:44:23 +00001237inline _LIBCPP_INLINE_VISIBILITY float fmin(float __lcpp_x, float __lcpp_y) _NOEXCEPT {return ::fminf(__lcpp_x, __lcpp_y);}
1238inline _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 +00001239
1240template <class _A1, class _A2>
1241inline _LIBCPP_INLINE_VISIBILITY
1242typename std::__lazy_enable_if
1243<
1244 std::is_arithmetic<_A1>::value &&
1245 std::is_arithmetic<_A2>::value,
1246 std::__promote<_A1, _A2>
1247>::type
1248fmin(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
1249{
1250 typedef typename std::__promote<_A1, _A2>::type __result_type;
1251 static_assert((!(std::is_same<_A1, __result_type>::value &&
1252 std::is_same<_A2, __result_type>::value)), "");
Mehdi Aminib3da6322017-02-10 02:44:23 +00001253 return ::fmin((__result_type)__lcpp_x, (__result_type)__lcpp_y);
Richard Smith081bb592015-10-08 20:40:34 +00001254}
1255
1256// hypot
1257
Mehdi Aminib3da6322017-02-10 02:44:23 +00001258inline _LIBCPP_INLINE_VISIBILITY float hypot(float __lcpp_x, float __lcpp_y) _NOEXCEPT {return ::hypotf(__lcpp_x, __lcpp_y);}
1259inline _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 +00001260
1261template <class _A1, class _A2>
1262inline _LIBCPP_INLINE_VISIBILITY
1263typename std::__lazy_enable_if
1264<
1265 std::is_arithmetic<_A1>::value &&
1266 std::is_arithmetic<_A2>::value,
1267 std::__promote<_A1, _A2>
1268>::type
1269hypot(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
1270{
1271 typedef typename std::__promote<_A1, _A2>::type __result_type;
1272 static_assert((!(std::is_same<_A1, __result_type>::value &&
1273 std::is_same<_A2, __result_type>::value)), "");
Mehdi Aminib3da6322017-02-10 02:44:23 +00001274 return ::hypot((__result_type)__lcpp_x, (__result_type)__lcpp_y);
Richard Smith081bb592015-10-08 20:40:34 +00001275}
1276
1277// ilogb
1278
Mehdi Aminib3da6322017-02-10 02:44:23 +00001279inline _LIBCPP_INLINE_VISIBILITY int ilogb(float __lcpp_x) _NOEXCEPT {return ::ilogbf(__lcpp_x);}
1280inline _LIBCPP_INLINE_VISIBILITY int ilogb(long double __lcpp_x) _NOEXCEPT {return ::ilogbl(__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +00001281
1282template <class _A1>
1283inline _LIBCPP_INLINE_VISIBILITY
1284typename std::enable_if<std::is_integral<_A1>::value, int>::type
Mehdi Aminib3da6322017-02-10 02:44:23 +00001285ilogb(_A1 __lcpp_x) _NOEXCEPT {return ::ilogb((double)__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +00001286
1287// lgamma
1288
Mehdi Aminib3da6322017-02-10 02:44:23 +00001289inline _LIBCPP_INLINE_VISIBILITY float lgamma(float __lcpp_x) _NOEXCEPT {return ::lgammaf(__lcpp_x);}
1290inline _LIBCPP_INLINE_VISIBILITY long double lgamma(long double __lcpp_x) _NOEXCEPT {return ::lgammal(__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +00001291
1292template <class _A1>
1293inline _LIBCPP_INLINE_VISIBILITY
1294typename std::enable_if<std::is_integral<_A1>::value, double>::type
Mehdi Aminib3da6322017-02-10 02:44:23 +00001295lgamma(_A1 __lcpp_x) _NOEXCEPT {return ::lgamma((double)__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +00001296
1297// llrint
1298
Mehdi Aminib3da6322017-02-10 02:44:23 +00001299inline _LIBCPP_INLINE_VISIBILITY long long llrint(float __lcpp_x) _NOEXCEPT {return ::llrintf(__lcpp_x);}
1300inline _LIBCPP_INLINE_VISIBILITY long long llrint(long double __lcpp_x) _NOEXCEPT {return ::llrintl(__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +00001301
1302template <class _A1>
1303inline _LIBCPP_INLINE_VISIBILITY
1304typename std::enable_if<std::is_integral<_A1>::value, long long>::type
Mehdi Aminib3da6322017-02-10 02:44:23 +00001305llrint(_A1 __lcpp_x) _NOEXCEPT {return ::llrint((double)__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +00001306
1307// llround
1308
Mehdi Aminib3da6322017-02-10 02:44:23 +00001309inline _LIBCPP_INLINE_VISIBILITY long long llround(float __lcpp_x) _NOEXCEPT {return ::llroundf(__lcpp_x);}
1310inline _LIBCPP_INLINE_VISIBILITY long long llround(long double __lcpp_x) _NOEXCEPT {return ::llroundl(__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +00001311
1312template <class _A1>
1313inline _LIBCPP_INLINE_VISIBILITY
1314typename std::enable_if<std::is_integral<_A1>::value, long long>::type
Mehdi Aminib3da6322017-02-10 02:44:23 +00001315llround(_A1 __lcpp_x) _NOEXCEPT {return ::llround((double)__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +00001316
1317// log1p
1318
Mehdi Aminib3da6322017-02-10 02:44:23 +00001319inline _LIBCPP_INLINE_VISIBILITY float log1p(float __lcpp_x) _NOEXCEPT {return ::log1pf(__lcpp_x);}
1320inline _LIBCPP_INLINE_VISIBILITY long double log1p(long double __lcpp_x) _NOEXCEPT {return ::log1pl(__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +00001321
1322template <class _A1>
1323inline _LIBCPP_INLINE_VISIBILITY
1324typename std::enable_if<std::is_integral<_A1>::value, double>::type
Mehdi Aminib3da6322017-02-10 02:44:23 +00001325log1p(_A1 __lcpp_x) _NOEXCEPT {return ::log1p((double)__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +00001326
1327// log2
1328
Mehdi Aminib3da6322017-02-10 02:44:23 +00001329inline _LIBCPP_INLINE_VISIBILITY float log2(float __lcpp_x) _NOEXCEPT {return ::log2f(__lcpp_x);}
1330inline _LIBCPP_INLINE_VISIBILITY long double log2(long double __lcpp_x) _NOEXCEPT {return ::log2l(__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +00001331
1332template <class _A1>
1333inline _LIBCPP_INLINE_VISIBILITY
1334typename std::enable_if<std::is_integral<_A1>::value, double>::type
Mehdi Aminib3da6322017-02-10 02:44:23 +00001335log2(_A1 __lcpp_x) _NOEXCEPT {return ::log2((double)__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +00001336
1337// logb
1338
Mehdi Aminib3da6322017-02-10 02:44:23 +00001339inline _LIBCPP_INLINE_VISIBILITY float logb(float __lcpp_x) _NOEXCEPT {return ::logbf(__lcpp_x);}
1340inline _LIBCPP_INLINE_VISIBILITY long double logb(long double __lcpp_x) _NOEXCEPT {return ::logbl(__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +00001341
1342template <class _A1>
1343inline _LIBCPP_INLINE_VISIBILITY
1344typename std::enable_if<std::is_integral<_A1>::value, double>::type
Mehdi Aminib3da6322017-02-10 02:44:23 +00001345logb(_A1 __lcpp_x) _NOEXCEPT {return ::logb((double)__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +00001346
1347// lrint
1348
Mehdi Aminib3da6322017-02-10 02:44:23 +00001349inline _LIBCPP_INLINE_VISIBILITY long lrint(float __lcpp_x) _NOEXCEPT {return ::lrintf(__lcpp_x);}
1350inline _LIBCPP_INLINE_VISIBILITY long lrint(long double __lcpp_x) _NOEXCEPT {return ::lrintl(__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +00001351
1352template <class _A1>
1353inline _LIBCPP_INLINE_VISIBILITY
1354typename std::enable_if<std::is_integral<_A1>::value, long>::type
Mehdi Aminib3da6322017-02-10 02:44:23 +00001355lrint(_A1 __lcpp_x) _NOEXCEPT {return ::lrint((double)__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +00001356
1357// lround
1358
Mehdi Aminib3da6322017-02-10 02:44:23 +00001359inline _LIBCPP_INLINE_VISIBILITY long lround(float __lcpp_x) _NOEXCEPT {return ::lroundf(__lcpp_x);}
1360inline _LIBCPP_INLINE_VISIBILITY long lround(long double __lcpp_x) _NOEXCEPT {return ::lroundl(__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +00001361
1362template <class _A1>
1363inline _LIBCPP_INLINE_VISIBILITY
1364typename std::enable_if<std::is_integral<_A1>::value, long>::type
Mehdi Aminib3da6322017-02-10 02:44:23 +00001365lround(_A1 __lcpp_x) _NOEXCEPT {return ::lround((double)__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +00001366
1367// nan
1368
1369// nearbyint
1370
Mehdi Aminib3da6322017-02-10 02:44:23 +00001371inline _LIBCPP_INLINE_VISIBILITY float nearbyint(float __lcpp_x) _NOEXCEPT {return ::nearbyintf(__lcpp_x);}
1372inline _LIBCPP_INLINE_VISIBILITY long double nearbyint(long double __lcpp_x) _NOEXCEPT {return ::nearbyintl(__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +00001373
1374template <class _A1>
1375inline _LIBCPP_INLINE_VISIBILITY
1376typename std::enable_if<std::is_integral<_A1>::value, double>::type
Mehdi Aminib3da6322017-02-10 02:44:23 +00001377nearbyint(_A1 __lcpp_x) _NOEXCEPT {return ::nearbyint((double)__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +00001378
1379// nextafter
1380
Mehdi Aminib3da6322017-02-10 02:44:23 +00001381inline _LIBCPP_INLINE_VISIBILITY float nextafter(float __lcpp_x, float __lcpp_y) _NOEXCEPT {return ::nextafterf(__lcpp_x, __lcpp_y);}
1382inline _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 +00001383
1384template <class _A1, class _A2>
1385inline _LIBCPP_INLINE_VISIBILITY
1386typename std::__lazy_enable_if
1387<
1388 std::is_arithmetic<_A1>::value &&
1389 std::is_arithmetic<_A2>::value,
1390 std::__promote<_A1, _A2>
1391>::type
1392nextafter(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
1393{
1394 typedef typename std::__promote<_A1, _A2>::type __result_type;
1395 static_assert((!(std::is_same<_A1, __result_type>::value &&
1396 std::is_same<_A2, __result_type>::value)), "");
Mehdi Aminib3da6322017-02-10 02:44:23 +00001397 return ::nextafter((__result_type)__lcpp_x, (__result_type)__lcpp_y);
Richard Smith081bb592015-10-08 20:40:34 +00001398}
1399
1400// nexttoward
1401
Mehdi Aminib3da6322017-02-10 02:44:23 +00001402inline _LIBCPP_INLINE_VISIBILITY float nexttoward(float __lcpp_x, long double __lcpp_y) _NOEXCEPT {return ::nexttowardf(__lcpp_x, __lcpp_y);}
1403inline _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 +00001404
1405template <class _A1>
1406inline _LIBCPP_INLINE_VISIBILITY
1407typename std::enable_if<std::is_integral<_A1>::value, double>::type
Mehdi Aminib3da6322017-02-10 02:44:23 +00001408nexttoward(_A1 __lcpp_x, long double __lcpp_y) _NOEXCEPT {return ::nexttoward((double)__lcpp_x, __lcpp_y);}
Richard Smith081bb592015-10-08 20:40:34 +00001409
1410// remainder
1411
Mehdi Aminib3da6322017-02-10 02:44:23 +00001412inline _LIBCPP_INLINE_VISIBILITY float remainder(float __lcpp_x, float __lcpp_y) _NOEXCEPT {return ::remainderf(__lcpp_x, __lcpp_y);}
1413inline _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 +00001414
1415template <class _A1, class _A2>
1416inline _LIBCPP_INLINE_VISIBILITY
1417typename std::__lazy_enable_if
1418<
1419 std::is_arithmetic<_A1>::value &&
1420 std::is_arithmetic<_A2>::value,
1421 std::__promote<_A1, _A2>
1422>::type
1423remainder(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
1424{
1425 typedef typename std::__promote<_A1, _A2>::type __result_type;
1426 static_assert((!(std::is_same<_A1, __result_type>::value &&
1427 std::is_same<_A2, __result_type>::value)), "");
Mehdi Aminib3da6322017-02-10 02:44:23 +00001428 return ::remainder((__result_type)__lcpp_x, (__result_type)__lcpp_y);
Richard Smith081bb592015-10-08 20:40:34 +00001429}
1430
1431// remquo
1432
Mehdi Aminib3da6322017-02-10 02:44:23 +00001433inline _LIBCPP_INLINE_VISIBILITY float remquo(float __lcpp_x, float __lcpp_y, int* __lcpp_z) _NOEXCEPT {return ::remquof(__lcpp_x, __lcpp_y, __lcpp_z);}
1434inline _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 +00001435
1436template <class _A1, class _A2>
1437inline _LIBCPP_INLINE_VISIBILITY
1438typename std::__lazy_enable_if
1439<
1440 std::is_arithmetic<_A1>::value &&
1441 std::is_arithmetic<_A2>::value,
1442 std::__promote<_A1, _A2>
1443>::type
1444remquo(_A1 __lcpp_x, _A2 __lcpp_y, int* __lcpp_z) _NOEXCEPT
1445{
1446 typedef typename std::__promote<_A1, _A2>::type __result_type;
1447 static_assert((!(std::is_same<_A1, __result_type>::value &&
1448 std::is_same<_A2, __result_type>::value)), "");
Mehdi Aminib3da6322017-02-10 02:44:23 +00001449 return ::remquo((__result_type)__lcpp_x, (__result_type)__lcpp_y, __lcpp_z);
Richard Smith081bb592015-10-08 20:40:34 +00001450}
1451
1452// rint
1453
Mehdi Aminib3da6322017-02-10 02:44:23 +00001454inline _LIBCPP_INLINE_VISIBILITY float rint(float __lcpp_x) _NOEXCEPT {return ::rintf(__lcpp_x);}
1455inline _LIBCPP_INLINE_VISIBILITY long double rint(long double __lcpp_x) _NOEXCEPT {return ::rintl(__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +00001456
1457template <class _A1>
1458inline _LIBCPP_INLINE_VISIBILITY
1459typename std::enable_if<std::is_integral<_A1>::value, double>::type
Mehdi Aminib3da6322017-02-10 02:44:23 +00001460rint(_A1 __lcpp_x) _NOEXCEPT {return ::rint((double)__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +00001461
1462// round
1463
Mehdi Aminib3da6322017-02-10 02:44:23 +00001464inline _LIBCPP_INLINE_VISIBILITY float round(float __lcpp_x) _NOEXCEPT {return ::roundf(__lcpp_x);}
1465inline _LIBCPP_INLINE_VISIBILITY long double round(long double __lcpp_x) _NOEXCEPT {return ::roundl(__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +00001466
1467template <class _A1>
1468inline _LIBCPP_INLINE_VISIBILITY
1469typename std::enable_if<std::is_integral<_A1>::value, double>::type
Mehdi Aminib3da6322017-02-10 02:44:23 +00001470round(_A1 __lcpp_x) _NOEXCEPT {return ::round((double)__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +00001471
1472// scalbln
1473
Mehdi Aminib3da6322017-02-10 02:44:23 +00001474inline _LIBCPP_INLINE_VISIBILITY float scalbln(float __lcpp_x, long __lcpp_y) _NOEXCEPT {return ::scalblnf(__lcpp_x, __lcpp_y);}
1475inline _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 +00001476
1477template <class _A1>
1478inline _LIBCPP_INLINE_VISIBILITY
1479typename std::enable_if<std::is_integral<_A1>::value, double>::type
Mehdi Aminib3da6322017-02-10 02:44:23 +00001480scalbln(_A1 __lcpp_x, long __lcpp_y) _NOEXCEPT {return ::scalbln((double)__lcpp_x, __lcpp_y);}
Richard Smith081bb592015-10-08 20:40:34 +00001481
1482// scalbn
1483
Mehdi Aminib3da6322017-02-10 02:44:23 +00001484inline _LIBCPP_INLINE_VISIBILITY float scalbn(float __lcpp_x, int __lcpp_y) _NOEXCEPT {return ::scalbnf(__lcpp_x, __lcpp_y);}
1485inline _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 +00001486
1487template <class _A1>
1488inline _LIBCPP_INLINE_VISIBILITY
1489typename std::enable_if<std::is_integral<_A1>::value, double>::type
Mehdi Aminib3da6322017-02-10 02:44:23 +00001490scalbn(_A1 __lcpp_x, int __lcpp_y) _NOEXCEPT {return ::scalbn((double)__lcpp_x, __lcpp_y);}
Richard Smith081bb592015-10-08 20:40:34 +00001491
1492// tgamma
1493
Mehdi Aminib3da6322017-02-10 02:44:23 +00001494inline _LIBCPP_INLINE_VISIBILITY float tgamma(float __lcpp_x) _NOEXCEPT {return ::tgammaf(__lcpp_x);}
1495inline _LIBCPP_INLINE_VISIBILITY long double tgamma(long double __lcpp_x) _NOEXCEPT {return ::tgammal(__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +00001496
1497template <class _A1>
1498inline _LIBCPP_INLINE_VISIBILITY
1499typename std::enable_if<std::is_integral<_A1>::value, double>::type
Mehdi Aminib3da6322017-02-10 02:44:23 +00001500tgamma(_A1 __lcpp_x) _NOEXCEPT {return ::tgamma((double)__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +00001501
1502// trunc
1503
Mehdi Aminib3da6322017-02-10 02:44:23 +00001504inline _LIBCPP_INLINE_VISIBILITY float trunc(float __lcpp_x) _NOEXCEPT {return ::truncf(__lcpp_x);}
1505inline _LIBCPP_INLINE_VISIBILITY long double trunc(long double __lcpp_x) _NOEXCEPT {return ::truncl(__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +00001506
1507template <class _A1>
1508inline _LIBCPP_INLINE_VISIBILITY
1509typename std::enable_if<std::is_integral<_A1>::value, double>::type
Mehdi Aminib3da6322017-02-10 02:44:23 +00001510trunc(_A1 __lcpp_x) _NOEXCEPT {return ::trunc((double)__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +00001511
Richard Smith081bb592015-10-08 20:40:34 +00001512} // extern "C++"
1513
1514#endif // __cplusplus
1515
Mikhail Maltsev34b4f972018-02-22 09:34:08 +00001516#else // _LIBCPP_MATH_H
1517
1518// This include lives outside the header guard in order to support an MSVC
1519// extension which allows users to do:
1520//
1521// #define _USE_MATH_DEFINES
1522// #include <math.h>
1523//
1524// and receive the definitions of mathematical constants, even if <math.h>
1525// has previously been included.
1526#if defined(_LIBCPP_MSVCRT) && defined(_USE_MATH_DEFINES)
1527#include_next <math.h>
1528#endif
1529
Richard Smith081bb592015-10-08 20:40:34 +00001530#endif // _LIBCPP_MATH_H