blob: 658ba93be01e543f2a5b1332fc1df32214a81cc8 [file] [log] [blame]
Richard Smith081bb592015-10-08 20:40:34 +00001// -*- C++ -*-
2//===---------------------------- math.h ----------------------------------===//
3//
4// The LLVM Compiler Infrastructure
5//
6// This file is dual licensed under the MIT and the University of Illinois Open
7// Source Licenses. See LICENSE.TXT for details.
8//
9//===----------------------------------------------------------------------===//
10
11#ifndef _LIBCPP_MATH_H
12#define _LIBCPP_MATH_H
13
14/*
15 math.h synopsis
16
17Macros:
18
19 HUGE_VAL
20 HUGE_VALF // C99
21 HUGE_VALL // C99
22 INFINITY // C99
23 NAN // C99
24 FP_INFINITE // C99
25 FP_NAN // C99
26 FP_NORMAL // C99
27 FP_SUBNORMAL // C99
28 FP_ZERO // C99
29 FP_FAST_FMA // C99
30 FP_FAST_FMAF // C99
31 FP_FAST_FMAL // C99
32 FP_ILOGB0 // C99
33 FP_ILOGBNAN // C99
34 MATH_ERRNO // C99
35 MATH_ERREXCEPT // C99
36 math_errhandling // C99
37
38Types:
39
40 float_t // C99
41 double_t // C99
42
43// C90
44
45floating_point abs(floating_point x);
46
47floating_point acos (arithmetic x);
48float acosf(float x);
49long double acosl(long double x);
50
51floating_point asin (arithmetic x);
52float asinf(float x);
53long double asinl(long double x);
54
55floating_point atan (arithmetic x);
56float atanf(float x);
57long double atanl(long double x);
58
59floating_point atan2 (arithmetic y, arithmetic x);
60float atan2f(float y, float x);
61long double atan2l(long double y, long double x);
62
63floating_point ceil (arithmetic x);
64float ceilf(float x);
65long double ceill(long double x);
66
67floating_point cos (arithmetic x);
68float cosf(float x);
69long double cosl(long double x);
70
71floating_point cosh (arithmetic x);
72float coshf(float x);
73long double coshl(long double x);
74
75floating_point exp (arithmetic x);
76float expf(float x);
77long double expl(long double x);
78
79floating_point fabs (arithmetic x);
80float fabsf(float x);
81long double fabsl(long double x);
82
83floating_point floor (arithmetic x);
84float floorf(float x);
85long double floorl(long double x);
86
87floating_point fmod (arithmetic x, arithmetic y);
88float fmodf(float x, float y);
89long double fmodl(long double x, long double y);
90
91floating_point frexp (arithmetic value, int* exp);
92float frexpf(float value, int* exp);
93long double frexpl(long double value, int* exp);
94
95floating_point ldexp (arithmetic value, int exp);
96float ldexpf(float value, int exp);
97long double ldexpl(long double value, int exp);
98
99floating_point log (arithmetic x);
100float logf(float x);
101long double logl(long double x);
102
103floating_point log10 (arithmetic x);
104float log10f(float x);
105long double log10l(long double x);
106
107floating_point modf (floating_point value, floating_point* iptr);
108float modff(float value, float* iptr);
109long double modfl(long double value, long double* iptr);
110
111floating_point pow (arithmetic x, arithmetic y);
112float powf(float x, float y);
113long double powl(long double x, long double y);
114
115floating_point sin (arithmetic x);
116float sinf(float x);
117long double sinl(long double x);
118
119floating_point sinh (arithmetic x);
120float sinhf(float x);
121long double sinhl(long double x);
122
123floating_point sqrt (arithmetic x);
124float sqrtf(float x);
125long double sqrtl(long double x);
126
127floating_point tan (arithmetic x);
128float tanf(float x);
129long double tanl(long double x);
130
131floating_point tanh (arithmetic x);
132float tanhf(float x);
133long double tanhl(long double x);
134
135// C99
136
137bool signbit(arithmetic x);
138
139int fpclassify(arithmetic x);
140
141bool isfinite(arithmetic x);
142bool isinf(arithmetic x);
143bool isnan(arithmetic x);
144bool isnormal(arithmetic x);
145
146bool isgreater(arithmetic x, arithmetic y);
147bool isgreaterequal(arithmetic x, arithmetic y);
148bool isless(arithmetic x, arithmetic y);
149bool islessequal(arithmetic x, arithmetic y);
150bool islessgreater(arithmetic x, arithmetic y);
151bool isunordered(arithmetic x, arithmetic y);
152
153floating_point acosh (arithmetic x);
154float acoshf(float x);
155long double acoshl(long double x);
156
157floating_point asinh (arithmetic x);
158float asinhf(float x);
159long double asinhl(long double x);
160
161floating_point atanh (arithmetic x);
162float atanhf(float x);
163long double atanhl(long double x);
164
165floating_point cbrt (arithmetic x);
166float cbrtf(float x);
167long double cbrtl(long double x);
168
169floating_point copysign (arithmetic x, arithmetic y);
170float copysignf(float x, float y);
171long double copysignl(long double x, long double y);
172
173floating_point erf (arithmetic x);
174float erff(float x);
175long double erfl(long double x);
176
177floating_point erfc (arithmetic x);
178float erfcf(float x);
179long double erfcl(long double x);
180
181floating_point exp2 (arithmetic x);
182float exp2f(float x);
183long double exp2l(long double x);
184
185floating_point expm1 (arithmetic x);
186float expm1f(float x);
187long double expm1l(long double x);
188
189floating_point fdim (arithmetic x, arithmetic y);
190float fdimf(float x, float y);
191long double fdiml(long double x, long double y);
192
193floating_point fma (arithmetic x, arithmetic y, arithmetic z);
194float fmaf(float x, float y, float z);
195long double fmal(long double x, long double y, long double z);
196
197floating_point fmax (arithmetic x, arithmetic y);
198float fmaxf(float x, float y);
199long double fmaxl(long double x, long double y);
200
201floating_point fmin (arithmetic x, arithmetic y);
202float fminf(float x, float y);
203long double fminl(long double x, long double y);
204
205floating_point hypot (arithmetic x, arithmetic y);
206float hypotf(float x, float y);
207long double hypotl(long double x, long double y);
208
209int ilogb (arithmetic x);
210int ilogbf(float x);
211int ilogbl(long double x);
212
213floating_point lgamma (arithmetic x);
214float lgammaf(float x);
215long double lgammal(long double x);
216
217long long llrint (arithmetic x);
218long long llrintf(float x);
219long long llrintl(long double x);
220
221long long llround (arithmetic x);
222long long llroundf(float x);
223long long llroundl(long double x);
224
225floating_point log1p (arithmetic x);
226float log1pf(float x);
227long double log1pl(long double x);
228
229floating_point log2 (arithmetic x);
230float log2f(float x);
231long double log2l(long double x);
232
233floating_point logb (arithmetic x);
234float logbf(float x);
235long double logbl(long double x);
236
237long lrint (arithmetic x);
238long lrintf(float x);
239long lrintl(long double x);
240
241long lround (arithmetic x);
242long lroundf(float x);
243long lroundl(long double x);
244
245double nan (const char* str);
246float nanf(const char* str);
247long double nanl(const char* str);
248
249floating_point nearbyint (arithmetic x);
250float nearbyintf(float x);
251long double nearbyintl(long double x);
252
253floating_point nextafter (arithmetic x, arithmetic y);
254float nextafterf(float x, float y);
255long double nextafterl(long double x, long double y);
256
257floating_point nexttoward (arithmetic x, long double y);
258float nexttowardf(float x, long double y);
259long double nexttowardl(long double x, long double y);
260
261floating_point remainder (arithmetic x, arithmetic y);
262float remainderf(float x, float y);
263long double remainderl(long double x, long double y);
264
265floating_point remquo (arithmetic x, arithmetic y, int* pquo);
266float remquof(float x, float y, int* pquo);
267long double remquol(long double x, long double y, int* pquo);
268
269floating_point rint (arithmetic x);
270float rintf(float x);
271long double rintl(long double x);
272
273floating_point round (arithmetic x);
274float roundf(float x);
275long double roundl(long double x);
276
277floating_point scalbln (arithmetic x, long ex);
278float scalblnf(float x, long ex);
279long double scalblnl(long double x, long ex);
280
281floating_point scalbn (arithmetic x, int ex);
282float scalbnf(float x, int ex);
283long double scalbnl(long double x, int ex);
284
285floating_point tgamma (arithmetic x);
286float tgammaf(float x);
287long double tgammal(long double x);
288
289floating_point trunc (arithmetic x);
290float truncf(float x);
291long double truncl(long double x);
292
293*/
294
295#include <__config>
Richard Smith081bb592015-10-08 20:40:34 +0000296
297#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
298#pragma GCC system_header
299#endif
300
Mikhail Maltsev34b4f972018-02-22 09:34:08 +0000301#include_next <math.h>
302
Richard Smith081bb592015-10-08 20:40:34 +0000303#ifdef __cplusplus
304
305// We support including .h headers inside 'extern "C"' contexts, so switch
306// back to C++ linkage before including these C++ headers.
307extern "C++" {
308
309#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 Dionneadff4822018-07-05 18:41:50 +0000317_LIBCPP_ALWAYS_INLINE
Richard Smith081bb592015-10-08 20:40:34 +0000318bool
319__libcpp_signbit(_A1 __lcpp_x) _NOEXCEPT
320{
321 return signbit(__lcpp_x);
322}
323
324#undef signbit
325
326template <class _A1>
327inline _LIBCPP_INLINE_VISIBILITY
Duncan P. N. Exon Smith321d6bf2017-04-21 23:14:55 +0000328typename std::enable_if<std::is_floating_point<_A1>::value, bool>::type
Richard Smith081bb592015-10-08 20:40:34 +0000329signbit(_A1 __lcpp_x) _NOEXCEPT
330{
331 return __libcpp_signbit((typename std::__promote<_A1>::type)__lcpp_x);
332}
333
Duncan P. N. Exon Smith321d6bf2017-04-21 23:14:55 +0000334template <class _A1>
335inline _LIBCPP_INLINE_VISIBILITY
336typename std::enable_if<
337 std::is_integral<_A1>::value && std::is_signed<_A1>::value, bool>::type
338signbit(_A1 __lcpp_x) _NOEXCEPT
339{ return __lcpp_x < 0; }
340
341template <class _A1>
342inline _LIBCPP_INLINE_VISIBILITY
343typename std::enable_if<
344 std::is_integral<_A1>::value && !std::is_signed<_A1>::value, bool>::type
345signbit(_A1) _NOEXCEPT
346{ return false; }
347
Shoaib Meenai159375f2017-04-07 02:20:52 +0000348#elif defined(_LIBCPP_MSVCRT)
Saleem Abdulrasool257256b2017-02-18 19:28:38 +0000349
350template <typename _A1>
351inline _LIBCPP_INLINE_VISIBILITY
Duncan P. N. Exon Smith321d6bf2017-04-21 23:14:55 +0000352typename std::enable_if<std::is_floating_point<_A1>::value, bool>::type
Saleem Abdulrasool257256b2017-02-18 19:28:38 +0000353signbit(_A1 __lcpp_x) _NOEXCEPT
354{
355 return ::signbit(static_cast<typename std::__promote<_A1>::type>(__lcpp_x));
356}
357
Duncan P. N. Exon Smith321d6bf2017-04-21 23:14:55 +0000358template <class _A1>
359inline _LIBCPP_INLINE_VISIBILITY
360typename std::enable_if<
361 std::is_integral<_A1>::value && std::is_signed<_A1>::value, bool>::type
362signbit(_A1 __lcpp_x) _NOEXCEPT
363{ return __lcpp_x < 0; }
364
365template <class _A1>
366inline _LIBCPP_INLINE_VISIBILITY
367typename std::enable_if<
368 std::is_integral<_A1>::value && !std::is_signed<_A1>::value, bool>::type
369signbit(_A1) _NOEXCEPT
370{ return false; }
371
Richard Smith081bb592015-10-08 20:40:34 +0000372#endif // signbit
373
374// fpclassify
375
376#ifdef fpclassify
377
378template <class _A1>
Louis Dionneadff4822018-07-05 18:41:50 +0000379_LIBCPP_ALWAYS_INLINE
Richard Smith081bb592015-10-08 20:40:34 +0000380int
381__libcpp_fpclassify(_A1 __lcpp_x) _NOEXCEPT
382{
383 return fpclassify(__lcpp_x);
384}
385
386#undef fpclassify
387
388template <class _A1>
389inline _LIBCPP_INLINE_VISIBILITY
Duncan P. N. Exon Smith321d6bf2017-04-21 23:14:55 +0000390typename std::enable_if<std::is_floating_point<_A1>::value, int>::type
Richard Smith081bb592015-10-08 20:40:34 +0000391fpclassify(_A1 __lcpp_x) _NOEXCEPT
392{
393 return __libcpp_fpclassify((typename std::__promote<_A1>::type)__lcpp_x);
394}
395
Duncan P. N. Exon Smith321d6bf2017-04-21 23:14:55 +0000396template <class _A1>
397inline _LIBCPP_INLINE_VISIBILITY
398typename std::enable_if<std::is_integral<_A1>::value, int>::type
399fpclassify(_A1 __lcpp_x) _NOEXCEPT
400{ return __lcpp_x == 0 ? FP_ZERO : FP_NORMAL; }
401
Shoaib Meenai159375f2017-04-07 02:20:52 +0000402#elif defined(_LIBCPP_MSVCRT)
Saleem Abdulrasool257256b2017-02-18 19:28:38 +0000403
404template <typename _A1>
405inline _LIBCPP_INLINE_VISIBILITY
Duncan P. N. Exon Smith321d6bf2017-04-21 23:14:55 +0000406typename std::enable_if<std::is_floating_point<_A1>::value, bool>::type
Saleem Abdulrasool257256b2017-02-18 19:28:38 +0000407fpclassify(_A1 __lcpp_x) _NOEXCEPT
408{
409 return ::fpclassify(static_cast<typename std::__promote<_A1>::type>(__lcpp_x));
410}
411
Duncan P. N. Exon Smith321d6bf2017-04-21 23:14:55 +0000412template <class _A1>
413inline _LIBCPP_INLINE_VISIBILITY
414typename std::enable_if<std::is_integral<_A1>::value, int>::type
415fpclassify(_A1 __lcpp_x) _NOEXCEPT
416{ return __lcpp_x == 0 ? FP_ZERO : FP_NORMAL; }
417
Richard Smith081bb592015-10-08 20:40:34 +0000418#endif // fpclassify
419
420// isfinite
421
422#ifdef isfinite
423
424template <class _A1>
Louis Dionneadff4822018-07-05 18:41:50 +0000425_LIBCPP_ALWAYS_INLINE
Richard Smith081bb592015-10-08 20:40:34 +0000426bool
427__libcpp_isfinite(_A1 __lcpp_x) _NOEXCEPT
428{
429 return isfinite(__lcpp_x);
430}
431
432#undef isfinite
433
434template <class _A1>
435inline _LIBCPP_INLINE_VISIBILITY
Duncan P. N. Exon Smith321d6bf2017-04-21 23:14:55 +0000436typename std::enable_if<
437 std::is_arithmetic<_A1>::value && std::numeric_limits<_A1>::has_infinity,
438 bool>::type
Richard Smith081bb592015-10-08 20:40:34 +0000439isfinite(_A1 __lcpp_x) _NOEXCEPT
440{
441 return __libcpp_isfinite((typename std::__promote<_A1>::type)__lcpp_x);
442}
443
Duncan P. N. Exon Smith321d6bf2017-04-21 23:14:55 +0000444template <class _A1>
445inline _LIBCPP_INLINE_VISIBILITY
446typename std::enable_if<
447 std::is_arithmetic<_A1>::value && !std::numeric_limits<_A1>::has_infinity,
448 bool>::type
449isfinite(_A1) _NOEXCEPT
450{ return true; }
451
Richard Smith081bb592015-10-08 20:40:34 +0000452#endif // isfinite
453
454// isinf
455
456#ifdef isinf
457
458template <class _A1>
Louis Dionneadff4822018-07-05 18:41:50 +0000459_LIBCPP_ALWAYS_INLINE
Richard Smith081bb592015-10-08 20:40:34 +0000460bool
461__libcpp_isinf(_A1 __lcpp_x) _NOEXCEPT
462{
463 return isinf(__lcpp_x);
464}
465
466#undef isinf
467
468template <class _A1>
469inline _LIBCPP_INLINE_VISIBILITY
Duncan P. N. Exon Smith321d6bf2017-04-21 23:14:55 +0000470typename std::enable_if<
471 std::is_arithmetic<_A1>::value && std::numeric_limits<_A1>::has_infinity,
472 bool>::type
Richard Smith081bb592015-10-08 20:40:34 +0000473isinf(_A1 __lcpp_x) _NOEXCEPT
474{
475 return __libcpp_isinf((typename std::__promote<_A1>::type)__lcpp_x);
476}
477
Duncan P. N. Exon Smith321d6bf2017-04-21 23:14:55 +0000478template <class _A1>
479inline _LIBCPP_INLINE_VISIBILITY
480typename std::enable_if<
481 std::is_arithmetic<_A1>::value && !std::numeric_limits<_A1>::has_infinity,
482 bool>::type
483isinf(_A1) _NOEXCEPT
484{ return false; }
485
Richard Smithafccfd32018-05-01 03:05:40 +0000486#ifdef _LIBCPP_PREFERRED_OVERLOAD
487inline _LIBCPP_INLINE_VISIBILITY
488bool
489isinf(float __lcpp_x) _NOEXCEPT { return __libcpp_isinf(__lcpp_x); }
490
491inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_PREFERRED_OVERLOAD
492bool
493isinf(double __lcpp_x) _NOEXCEPT { return __libcpp_isinf(__lcpp_x); }
494
495inline _LIBCPP_INLINE_VISIBILITY
496bool
497isinf(long double __lcpp_x) _NOEXCEPT { return __libcpp_isinf(__lcpp_x); }
498#endif
499
Richard Smith081bb592015-10-08 20:40:34 +0000500#endif // isinf
501
502// isnan
503
504#ifdef isnan
505
506template <class _A1>
Louis Dionneadff4822018-07-05 18:41:50 +0000507_LIBCPP_ALWAYS_INLINE
Richard Smith081bb592015-10-08 20:40:34 +0000508bool
509__libcpp_isnan(_A1 __lcpp_x) _NOEXCEPT
510{
511 return isnan(__lcpp_x);
512}
513
514#undef isnan
515
516template <class _A1>
517inline _LIBCPP_INLINE_VISIBILITY
Duncan P. N. Exon Smith321d6bf2017-04-21 23:14:55 +0000518typename std::enable_if<std::is_floating_point<_A1>::value, bool>::type
Richard Smith081bb592015-10-08 20:40:34 +0000519isnan(_A1 __lcpp_x) _NOEXCEPT
520{
521 return __libcpp_isnan((typename std::__promote<_A1>::type)__lcpp_x);
522}
523
Duncan P. N. Exon Smith321d6bf2017-04-21 23:14:55 +0000524template <class _A1>
525inline _LIBCPP_INLINE_VISIBILITY
526typename std::enable_if<std::is_integral<_A1>::value, bool>::type
527isnan(_A1) _NOEXCEPT
528{ return false; }
529
Richard Smithafccfd32018-05-01 03:05:40 +0000530#ifdef _LIBCPP_PREFERRED_OVERLOAD
531inline _LIBCPP_INLINE_VISIBILITY
532bool
533isnan(float __lcpp_x) _NOEXCEPT { return __libcpp_isnan(__lcpp_x); }
534
535inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_PREFERRED_OVERLOAD
536bool
537isnan(double __lcpp_x) _NOEXCEPT { return __libcpp_isnan(__lcpp_x); }
538
539inline _LIBCPP_INLINE_VISIBILITY
540bool
541isnan(long double __lcpp_x) _NOEXCEPT { return __libcpp_isnan(__lcpp_x); }
542#endif
543
Richard Smith081bb592015-10-08 20:40:34 +0000544#endif // isnan
545
546// isnormal
547
548#ifdef isnormal
549
550template <class _A1>
Louis Dionneadff4822018-07-05 18:41:50 +0000551_LIBCPP_ALWAYS_INLINE
Richard Smith081bb592015-10-08 20:40:34 +0000552bool
553__libcpp_isnormal(_A1 __lcpp_x) _NOEXCEPT
554{
555 return isnormal(__lcpp_x);
556}
557
558#undef isnormal
559
560template <class _A1>
561inline _LIBCPP_INLINE_VISIBILITY
Duncan P. N. Exon Smith321d6bf2017-04-21 23:14:55 +0000562typename std::enable_if<std::is_floating_point<_A1>::value, bool>::type
Richard Smith081bb592015-10-08 20:40:34 +0000563isnormal(_A1 __lcpp_x) _NOEXCEPT
564{
565 return __libcpp_isnormal((typename std::__promote<_A1>::type)__lcpp_x);
566}
567
Duncan P. N. Exon Smith321d6bf2017-04-21 23:14:55 +0000568template <class _A1>
569inline _LIBCPP_INLINE_VISIBILITY
570typename std::enable_if<std::is_integral<_A1>::value, bool>::type
571isnormal(_A1 __lcpp_x) _NOEXCEPT
572{ return __lcpp_x != 0; }
573
Richard Smith081bb592015-10-08 20:40:34 +0000574#endif // isnormal
575
576// isgreater
577
578#ifdef isgreater
579
580template <class _A1, class _A2>
Louis Dionneadff4822018-07-05 18:41:50 +0000581_LIBCPP_ALWAYS_INLINE
Richard Smith081bb592015-10-08 20:40:34 +0000582bool
583__libcpp_isgreater(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
584{
585 return isgreater(__lcpp_x, __lcpp_y);
586}
587
588#undef isgreater
589
590template <class _A1, class _A2>
591inline _LIBCPP_INLINE_VISIBILITY
592typename std::enable_if
593<
594 std::is_arithmetic<_A1>::value &&
595 std::is_arithmetic<_A2>::value,
596 bool
597>::type
598isgreater(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
599{
600 typedef typename std::__promote<_A1, _A2>::type type;
601 return __libcpp_isgreater((type)__lcpp_x, (type)__lcpp_y);
602}
603
604#endif // isgreater
605
606// isgreaterequal
607
608#ifdef isgreaterequal
609
610template <class _A1, class _A2>
Louis Dionneadff4822018-07-05 18:41:50 +0000611_LIBCPP_ALWAYS_INLINE
Richard Smith081bb592015-10-08 20:40:34 +0000612bool
613__libcpp_isgreaterequal(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
614{
615 return isgreaterequal(__lcpp_x, __lcpp_y);
616}
617
618#undef isgreaterequal
619
620template <class _A1, class _A2>
621inline _LIBCPP_INLINE_VISIBILITY
622typename std::enable_if
623<
624 std::is_arithmetic<_A1>::value &&
625 std::is_arithmetic<_A2>::value,
626 bool
627>::type
628isgreaterequal(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
629{
630 typedef typename std::__promote<_A1, _A2>::type type;
631 return __libcpp_isgreaterequal((type)__lcpp_x, (type)__lcpp_y);
632}
633
634#endif // isgreaterequal
635
636// isless
637
638#ifdef isless
639
640template <class _A1, class _A2>
Louis Dionneadff4822018-07-05 18:41:50 +0000641_LIBCPP_ALWAYS_INLINE
Richard Smith081bb592015-10-08 20:40:34 +0000642bool
643__libcpp_isless(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
644{
645 return isless(__lcpp_x, __lcpp_y);
646}
647
648#undef isless
649
650template <class _A1, class _A2>
651inline _LIBCPP_INLINE_VISIBILITY
652typename std::enable_if
653<
654 std::is_arithmetic<_A1>::value &&
655 std::is_arithmetic<_A2>::value,
656 bool
657>::type
658isless(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
659{
660 typedef typename std::__promote<_A1, _A2>::type type;
661 return __libcpp_isless((type)__lcpp_x, (type)__lcpp_y);
662}
663
664#endif // isless
665
666// islessequal
667
668#ifdef islessequal
669
670template <class _A1, class _A2>
Louis Dionneadff4822018-07-05 18:41:50 +0000671_LIBCPP_ALWAYS_INLINE
Richard Smith081bb592015-10-08 20:40:34 +0000672bool
673__libcpp_islessequal(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
674{
675 return islessequal(__lcpp_x, __lcpp_y);
676}
677
678#undef islessequal
679
680template <class _A1, class _A2>
681inline _LIBCPP_INLINE_VISIBILITY
682typename std::enable_if
683<
684 std::is_arithmetic<_A1>::value &&
685 std::is_arithmetic<_A2>::value,
686 bool
687>::type
688islessequal(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
689{
690 typedef typename std::__promote<_A1, _A2>::type type;
691 return __libcpp_islessequal((type)__lcpp_x, (type)__lcpp_y);
692}
693
694#endif // islessequal
695
696// islessgreater
697
698#ifdef islessgreater
699
700template <class _A1, class _A2>
Louis Dionneadff4822018-07-05 18:41:50 +0000701_LIBCPP_ALWAYS_INLINE
Richard Smith081bb592015-10-08 20:40:34 +0000702bool
703__libcpp_islessgreater(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
704{
705 return islessgreater(__lcpp_x, __lcpp_y);
706}
707
708#undef islessgreater
709
710template <class _A1, class _A2>
711inline _LIBCPP_INLINE_VISIBILITY
712typename std::enable_if
713<
714 std::is_arithmetic<_A1>::value &&
715 std::is_arithmetic<_A2>::value,
716 bool
717>::type
718islessgreater(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
719{
720 typedef typename std::__promote<_A1, _A2>::type type;
721 return __libcpp_islessgreater((type)__lcpp_x, (type)__lcpp_y);
722}
723
724#endif // islessgreater
725
726// isunordered
727
728#ifdef isunordered
729
730template <class _A1, class _A2>
Louis Dionneadff4822018-07-05 18:41:50 +0000731_LIBCPP_ALWAYS_INLINE
Richard Smith081bb592015-10-08 20:40:34 +0000732bool
733__libcpp_isunordered(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
734{
735 return isunordered(__lcpp_x, __lcpp_y);
736}
737
738#undef isunordered
739
740template <class _A1, class _A2>
741inline _LIBCPP_INLINE_VISIBILITY
742typename std::enable_if
743<
744 std::is_arithmetic<_A1>::value &&
745 std::is_arithmetic<_A2>::value,
746 bool
747>::type
748isunordered(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
749{
750 typedef typename std::__promote<_A1, _A2>::type type;
751 return __libcpp_isunordered((type)__lcpp_x, (type)__lcpp_y);
752}
753
754#endif // isunordered
755
Richard Smith081bb592015-10-08 20:40:34 +0000756// abs
757
Eric Fiselier7d1aac92016-08-15 18:58:57 +0000758#if !(defined(_AIX) || defined(__sun__))
Richard Smith081bb592015-10-08 20:40:34 +0000759inline _LIBCPP_INLINE_VISIBILITY
760float
Mehdi Aminib3da6322017-02-10 02:44:23 +0000761abs(float __lcpp_x) _NOEXCEPT {return ::fabsf(__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +0000762
763inline _LIBCPP_INLINE_VISIBILITY
764double
Mehdi Aminib3da6322017-02-10 02:44:23 +0000765abs(double __lcpp_x) _NOEXCEPT {return ::fabs(__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +0000766
767inline _LIBCPP_INLINE_VISIBILITY
768long double
Mehdi Aminib3da6322017-02-10 02:44:23 +0000769abs(long double __lcpp_x) _NOEXCEPT {return ::fabsl(__lcpp_x);}
Eric Fiselier7d1aac92016-08-15 18:58:57 +0000770#endif // !(defined(_AIX) || defined(__sun__))
Richard Smith081bb592015-10-08 20:40:34 +0000771
772// acos
773
Shoaib Meenai159375f2017-04-07 02:20:52 +0000774#if !(defined(_AIX) || defined(__sun__))
Mehdi Aminib3da6322017-02-10 02:44:23 +0000775inline _LIBCPP_INLINE_VISIBILITY float acos(float __lcpp_x) _NOEXCEPT {return ::acosf(__lcpp_x);}
776inline _LIBCPP_INLINE_VISIBILITY long double acos(long double __lcpp_x) _NOEXCEPT {return ::acosl(__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +0000777#endif
778
779template <class _A1>
780inline _LIBCPP_INLINE_VISIBILITY
781typename std::enable_if<std::is_integral<_A1>::value, double>::type
Mehdi Aminib3da6322017-02-10 02:44:23 +0000782acos(_A1 __lcpp_x) _NOEXCEPT {return ::acos((double)__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +0000783
784// asin
785
Shoaib Meenai159375f2017-04-07 02:20:52 +0000786#if !(defined(_AIX) || defined(__sun__))
Mehdi Aminib3da6322017-02-10 02:44:23 +0000787inline _LIBCPP_INLINE_VISIBILITY float asin(float __lcpp_x) _NOEXCEPT {return ::asinf(__lcpp_x);}
788inline _LIBCPP_INLINE_VISIBILITY long double asin(long double __lcpp_x) _NOEXCEPT {return ::asinl(__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +0000789#endif
790
791template <class _A1>
792inline _LIBCPP_INLINE_VISIBILITY
793typename std::enable_if<std::is_integral<_A1>::value, double>::type
Mehdi Aminib3da6322017-02-10 02:44:23 +0000794asin(_A1 __lcpp_x) _NOEXCEPT {return ::asin((double)__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +0000795
796// atan
797
Shoaib Meenai159375f2017-04-07 02:20:52 +0000798#if !(defined(_AIX) || defined(__sun__))
Mehdi Aminib3da6322017-02-10 02:44:23 +0000799inline _LIBCPP_INLINE_VISIBILITY float atan(float __lcpp_x) _NOEXCEPT {return ::atanf(__lcpp_x);}
800inline _LIBCPP_INLINE_VISIBILITY long double atan(long double __lcpp_x) _NOEXCEPT {return ::atanl(__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +0000801#endif
802
803template <class _A1>
804inline _LIBCPP_INLINE_VISIBILITY
805typename std::enable_if<std::is_integral<_A1>::value, double>::type
Mehdi Aminib3da6322017-02-10 02:44:23 +0000806atan(_A1 __lcpp_x) _NOEXCEPT {return ::atan((double)__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +0000807
808// atan2
809
Shoaib Meenai159375f2017-04-07 02:20:52 +0000810#if !(defined(_AIX) || defined(__sun__))
Mehdi Aminib3da6322017-02-10 02:44:23 +0000811inline _LIBCPP_INLINE_VISIBILITY float atan2(float __lcpp_y, float __lcpp_x) _NOEXCEPT {return ::atan2f(__lcpp_y, __lcpp_x);}
812inline _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 +0000813#endif
814
815template <class _A1, class _A2>
816inline _LIBCPP_INLINE_VISIBILITY
817typename std::__lazy_enable_if
818<
819 std::is_arithmetic<_A1>::value &&
820 std::is_arithmetic<_A2>::value,
821 std::__promote<_A1, _A2>
822>::type
823atan2(_A1 __lcpp_y, _A2 __lcpp_x) _NOEXCEPT
824{
825 typedef typename std::__promote<_A1, _A2>::type __result_type;
826 static_assert((!(std::is_same<_A1, __result_type>::value &&
827 std::is_same<_A2, __result_type>::value)), "");
Mehdi Aminib3da6322017-02-10 02:44:23 +0000828 return ::atan2((__result_type)__lcpp_y, (__result_type)__lcpp_x);
Richard Smith081bb592015-10-08 20:40:34 +0000829}
830
831// ceil
832
Shoaib Meenai159375f2017-04-07 02:20:52 +0000833#if !(defined(_AIX) || defined(__sun__))
Mehdi Aminib3da6322017-02-10 02:44:23 +0000834inline _LIBCPP_INLINE_VISIBILITY float ceil(float __lcpp_x) _NOEXCEPT {return ::ceilf(__lcpp_x);}
835inline _LIBCPP_INLINE_VISIBILITY long double ceil(long double __lcpp_x) _NOEXCEPT {return ::ceill(__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +0000836#endif
837
838template <class _A1>
839inline _LIBCPP_INLINE_VISIBILITY
840typename std::enable_if<std::is_integral<_A1>::value, double>::type
Mehdi Aminib3da6322017-02-10 02:44:23 +0000841ceil(_A1 __lcpp_x) _NOEXCEPT {return ::ceil((double)__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +0000842
843// cos
844
Shoaib Meenai159375f2017-04-07 02:20:52 +0000845#if !(defined(_AIX) || defined(__sun__))
Mehdi Aminib3da6322017-02-10 02:44:23 +0000846inline _LIBCPP_INLINE_VISIBILITY float cos(float __lcpp_x) _NOEXCEPT {return ::cosf(__lcpp_x);}
847inline _LIBCPP_INLINE_VISIBILITY long double cos(long double __lcpp_x) _NOEXCEPT {return ::cosl(__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +0000848#endif
849
850template <class _A1>
851inline _LIBCPP_INLINE_VISIBILITY
852typename std::enable_if<std::is_integral<_A1>::value, double>::type
Mehdi Aminib3da6322017-02-10 02:44:23 +0000853cos(_A1 __lcpp_x) _NOEXCEPT {return ::cos((double)__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +0000854
855// cosh
856
Shoaib Meenai159375f2017-04-07 02:20:52 +0000857#if !(defined(_AIX) || defined(__sun__))
Mehdi Aminib3da6322017-02-10 02:44:23 +0000858inline _LIBCPP_INLINE_VISIBILITY float cosh(float __lcpp_x) _NOEXCEPT {return ::coshf(__lcpp_x);}
859inline _LIBCPP_INLINE_VISIBILITY long double cosh(long double __lcpp_x) _NOEXCEPT {return ::coshl(__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +0000860#endif
861
862template <class _A1>
863inline _LIBCPP_INLINE_VISIBILITY
864typename std::enable_if<std::is_integral<_A1>::value, double>::type
Mehdi Aminib3da6322017-02-10 02:44:23 +0000865cosh(_A1 __lcpp_x) _NOEXCEPT {return ::cosh((double)__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +0000866
867// exp
868
Shoaib Meenai159375f2017-04-07 02:20:52 +0000869#if !(defined(_AIX) || defined(__sun__))
Mehdi Aminib3da6322017-02-10 02:44:23 +0000870inline _LIBCPP_INLINE_VISIBILITY float exp(float __lcpp_x) _NOEXCEPT {return ::expf(__lcpp_x);}
871inline _LIBCPP_INLINE_VISIBILITY long double exp(long double __lcpp_x) _NOEXCEPT {return ::expl(__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +0000872#endif
873
874template <class _A1>
875inline _LIBCPP_INLINE_VISIBILITY
876typename std::enable_if<std::is_integral<_A1>::value, double>::type
Mehdi Aminib3da6322017-02-10 02:44:23 +0000877exp(_A1 __lcpp_x) _NOEXCEPT {return ::exp((double)__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +0000878
879// fabs
880
Shoaib Meenai159375f2017-04-07 02:20:52 +0000881#if !(defined(_AIX) || defined(__sun__))
Mehdi Aminib3da6322017-02-10 02:44:23 +0000882inline _LIBCPP_INLINE_VISIBILITY float fabs(float __lcpp_x) _NOEXCEPT {return ::fabsf(__lcpp_x);}
883inline _LIBCPP_INLINE_VISIBILITY long double fabs(long double __lcpp_x) _NOEXCEPT {return ::fabsl(__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +0000884#endif
885
886template <class _A1>
887inline _LIBCPP_INLINE_VISIBILITY
888typename std::enable_if<std::is_integral<_A1>::value, double>::type
Mehdi Aminib3da6322017-02-10 02:44:23 +0000889fabs(_A1 __lcpp_x) _NOEXCEPT {return ::fabs((double)__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +0000890
891// floor
892
Shoaib Meenai159375f2017-04-07 02:20:52 +0000893#if !(defined(_AIX) || defined(__sun__))
Mehdi Aminib3da6322017-02-10 02:44:23 +0000894inline _LIBCPP_INLINE_VISIBILITY float floor(float __lcpp_x) _NOEXCEPT {return ::floorf(__lcpp_x);}
895inline _LIBCPP_INLINE_VISIBILITY long double floor(long double __lcpp_x) _NOEXCEPT {return ::floorl(__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +0000896#endif
897
898template <class _A1>
899inline _LIBCPP_INLINE_VISIBILITY
900typename std::enable_if<std::is_integral<_A1>::value, double>::type
Mehdi Aminib3da6322017-02-10 02:44:23 +0000901floor(_A1 __lcpp_x) _NOEXCEPT {return ::floor((double)__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +0000902
903// fmod
904
Shoaib Meenai159375f2017-04-07 02:20:52 +0000905#if !(defined(_AIX) || defined(__sun__))
Mehdi Aminib3da6322017-02-10 02:44:23 +0000906inline _LIBCPP_INLINE_VISIBILITY float fmod(float __lcpp_x, float __lcpp_y) _NOEXCEPT {return ::fmodf(__lcpp_x, __lcpp_y);}
907inline _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 +0000908#endif
909
910template <class _A1, class _A2>
911inline _LIBCPP_INLINE_VISIBILITY
912typename std::__lazy_enable_if
913<
914 std::is_arithmetic<_A1>::value &&
915 std::is_arithmetic<_A2>::value,
916 std::__promote<_A1, _A2>
917>::type
918fmod(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
919{
920 typedef typename std::__promote<_A1, _A2>::type __result_type;
921 static_assert((!(std::is_same<_A1, __result_type>::value &&
922 std::is_same<_A2, __result_type>::value)), "");
Mehdi Aminib3da6322017-02-10 02:44:23 +0000923 return ::fmod((__result_type)__lcpp_x, (__result_type)__lcpp_y);
Richard Smith081bb592015-10-08 20:40:34 +0000924}
925
926// frexp
927
Shoaib Meenai159375f2017-04-07 02:20:52 +0000928#if !(defined(_AIX) || defined(__sun__))
Mehdi Aminib3da6322017-02-10 02:44:23 +0000929inline _LIBCPP_INLINE_VISIBILITY float frexp(float __lcpp_x, int* __lcpp_e) _NOEXCEPT {return ::frexpf(__lcpp_x, __lcpp_e);}
930inline _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 +0000931#endif
932
933template <class _A1>
934inline _LIBCPP_INLINE_VISIBILITY
935typename std::enable_if<std::is_integral<_A1>::value, double>::type
Mehdi Aminib3da6322017-02-10 02:44:23 +0000936frexp(_A1 __lcpp_x, int* __lcpp_e) _NOEXCEPT {return ::frexp((double)__lcpp_x, __lcpp_e);}
Richard Smith081bb592015-10-08 20:40:34 +0000937
938// ldexp
939
Shoaib Meenai159375f2017-04-07 02:20:52 +0000940#if !(defined(_AIX) || defined(__sun__))
Mehdi Aminib3da6322017-02-10 02:44:23 +0000941inline _LIBCPP_INLINE_VISIBILITY float ldexp(float __lcpp_x, int __lcpp_e) _NOEXCEPT {return ::ldexpf(__lcpp_x, __lcpp_e);}
942inline _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 +0000943#endif
944
945template <class _A1>
946inline _LIBCPP_INLINE_VISIBILITY
947typename std::enable_if<std::is_integral<_A1>::value, double>::type
Mehdi Aminib3da6322017-02-10 02:44:23 +0000948ldexp(_A1 __lcpp_x, int __lcpp_e) _NOEXCEPT {return ::ldexp((double)__lcpp_x, __lcpp_e);}
Richard Smith081bb592015-10-08 20:40:34 +0000949
950// log
951
Shoaib Meenai159375f2017-04-07 02:20:52 +0000952#if !(defined(_AIX) || defined(__sun__))
Mehdi Aminib3da6322017-02-10 02:44:23 +0000953inline _LIBCPP_INLINE_VISIBILITY float log(float __lcpp_x) _NOEXCEPT {return ::logf(__lcpp_x);}
954inline _LIBCPP_INLINE_VISIBILITY long double log(long double __lcpp_x) _NOEXCEPT {return ::logl(__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +0000955#endif
956
957template <class _A1>
958inline _LIBCPP_INLINE_VISIBILITY
959typename std::enable_if<std::is_integral<_A1>::value, double>::type
Mehdi Aminib3da6322017-02-10 02:44:23 +0000960log(_A1 __lcpp_x) _NOEXCEPT {return ::log((double)__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +0000961
962// log10
963
Shoaib Meenai159375f2017-04-07 02:20:52 +0000964#if !(defined(_AIX) || defined(__sun__))
Mehdi Aminib3da6322017-02-10 02:44:23 +0000965inline _LIBCPP_INLINE_VISIBILITY float log10(float __lcpp_x) _NOEXCEPT {return ::log10f(__lcpp_x);}
966inline _LIBCPP_INLINE_VISIBILITY long double log10(long double __lcpp_x) _NOEXCEPT {return ::log10l(__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +0000967#endif
968
969template <class _A1>
970inline _LIBCPP_INLINE_VISIBILITY
971typename std::enable_if<std::is_integral<_A1>::value, double>::type
Mehdi Aminib3da6322017-02-10 02:44:23 +0000972log10(_A1 __lcpp_x) _NOEXCEPT {return ::log10((double)__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +0000973
974// modf
975
Shoaib Meenai159375f2017-04-07 02:20:52 +0000976#if !(defined(_AIX) || defined(__sun__))
Mehdi Aminib3da6322017-02-10 02:44:23 +0000977inline _LIBCPP_INLINE_VISIBILITY float modf(float __lcpp_x, float* __lcpp_y) _NOEXCEPT {return ::modff(__lcpp_x, __lcpp_y);}
978inline _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 +0000979#endif
980
981// pow
982
Shoaib Meenai159375f2017-04-07 02:20:52 +0000983#if !(defined(_AIX) || defined(__sun__))
Mehdi Aminib3da6322017-02-10 02:44:23 +0000984inline _LIBCPP_INLINE_VISIBILITY float pow(float __lcpp_x, float __lcpp_y) _NOEXCEPT {return ::powf(__lcpp_x, __lcpp_y);}
985inline _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 +0000986#endif
987
988template <class _A1, class _A2>
989inline _LIBCPP_INLINE_VISIBILITY
990typename std::__lazy_enable_if
991<
992 std::is_arithmetic<_A1>::value &&
993 std::is_arithmetic<_A2>::value,
994 std::__promote<_A1, _A2>
995>::type
996pow(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
997{
998 typedef typename std::__promote<_A1, _A2>::type __result_type;
999 static_assert((!(std::is_same<_A1, __result_type>::value &&
1000 std::is_same<_A2, __result_type>::value)), "");
Mehdi Aminib3da6322017-02-10 02:44:23 +00001001 return ::pow((__result_type)__lcpp_x, (__result_type)__lcpp_y);
Richard Smith081bb592015-10-08 20:40:34 +00001002}
1003
1004// sin
1005
Shoaib Meenai159375f2017-04-07 02:20:52 +00001006#if !(defined(_AIX) || defined(__sun__))
Mehdi Aminib3da6322017-02-10 02:44:23 +00001007inline _LIBCPP_INLINE_VISIBILITY float sin(float __lcpp_x) _NOEXCEPT {return ::sinf(__lcpp_x);}
1008inline _LIBCPP_INLINE_VISIBILITY long double sin(long double __lcpp_x) _NOEXCEPT {return ::sinl(__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +00001009#endif
1010
1011template <class _A1>
1012inline _LIBCPP_INLINE_VISIBILITY
1013typename std::enable_if<std::is_integral<_A1>::value, double>::type
Mehdi Aminib3da6322017-02-10 02:44:23 +00001014sin(_A1 __lcpp_x) _NOEXCEPT {return ::sin((double)__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +00001015
1016// sinh
1017
Shoaib Meenai159375f2017-04-07 02:20:52 +00001018#if !(defined(_AIX) || defined(__sun__))
Mehdi Aminib3da6322017-02-10 02:44:23 +00001019inline _LIBCPP_INLINE_VISIBILITY float sinh(float __lcpp_x) _NOEXCEPT {return ::sinhf(__lcpp_x);}
1020inline _LIBCPP_INLINE_VISIBILITY long double sinh(long double __lcpp_x) _NOEXCEPT {return ::sinhl(__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +00001021#endif
1022
1023template <class _A1>
1024inline _LIBCPP_INLINE_VISIBILITY
1025typename std::enable_if<std::is_integral<_A1>::value, double>::type
Mehdi Aminib3da6322017-02-10 02:44:23 +00001026sinh(_A1 __lcpp_x) _NOEXCEPT {return ::sinh((double)__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +00001027
1028// sqrt
1029
Shoaib Meenai159375f2017-04-07 02:20:52 +00001030#if !(defined(_AIX) || defined(__sun__))
Mehdi Aminib3da6322017-02-10 02:44:23 +00001031inline _LIBCPP_INLINE_VISIBILITY float sqrt(float __lcpp_x) _NOEXCEPT {return ::sqrtf(__lcpp_x);}
1032inline _LIBCPP_INLINE_VISIBILITY long double sqrt(long double __lcpp_x) _NOEXCEPT {return ::sqrtl(__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +00001033#endif
1034
Richard Smith081bb592015-10-08 20:40:34 +00001035template <class _A1>
1036inline _LIBCPP_INLINE_VISIBILITY
1037typename std::enable_if<std::is_integral<_A1>::value, double>::type
Mehdi Aminib3da6322017-02-10 02:44:23 +00001038sqrt(_A1 __lcpp_x) _NOEXCEPT {return ::sqrt((double)__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +00001039
1040// tan
1041
Shoaib Meenai159375f2017-04-07 02:20:52 +00001042#if !(defined(_AIX) || defined(__sun__))
Mehdi Aminib3da6322017-02-10 02:44:23 +00001043inline _LIBCPP_INLINE_VISIBILITY float tan(float __lcpp_x) _NOEXCEPT {return ::tanf(__lcpp_x);}
1044inline _LIBCPP_INLINE_VISIBILITY long double tan(long double __lcpp_x) _NOEXCEPT {return ::tanl(__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +00001045#endif
1046
1047template <class _A1>
1048inline _LIBCPP_INLINE_VISIBILITY
1049typename std::enable_if<std::is_integral<_A1>::value, double>::type
Mehdi Aminib3da6322017-02-10 02:44:23 +00001050tan(_A1 __lcpp_x) _NOEXCEPT {return ::tan((double)__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +00001051
1052// tanh
1053
Shoaib Meenai159375f2017-04-07 02:20:52 +00001054#if !(defined(_AIX) || defined(__sun__))
Mehdi Aminib3da6322017-02-10 02:44:23 +00001055inline _LIBCPP_INLINE_VISIBILITY float tanh(float __lcpp_x) _NOEXCEPT {return ::tanhf(__lcpp_x);}
1056inline _LIBCPP_INLINE_VISIBILITY long double tanh(long double __lcpp_x) _NOEXCEPT {return ::tanhl(__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +00001057#endif
1058
1059template <class _A1>
1060inline _LIBCPP_INLINE_VISIBILITY
1061typename std::enable_if<std::is_integral<_A1>::value, double>::type
Mehdi Aminib3da6322017-02-10 02:44:23 +00001062tanh(_A1 __lcpp_x) _NOEXCEPT {return ::tanh((double)__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +00001063
1064// acosh
1065
Mehdi Aminib3da6322017-02-10 02:44:23 +00001066inline _LIBCPP_INLINE_VISIBILITY float acosh(float __lcpp_x) _NOEXCEPT {return ::acoshf(__lcpp_x);}
1067inline _LIBCPP_INLINE_VISIBILITY long double acosh(long double __lcpp_x) _NOEXCEPT {return ::acoshl(__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +00001068
1069template <class _A1>
1070inline _LIBCPP_INLINE_VISIBILITY
1071typename std::enable_if<std::is_integral<_A1>::value, double>::type
Mehdi Aminib3da6322017-02-10 02:44:23 +00001072acosh(_A1 __lcpp_x) _NOEXCEPT {return ::acosh((double)__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +00001073
1074// asinh
1075
Mehdi Aminib3da6322017-02-10 02:44:23 +00001076inline _LIBCPP_INLINE_VISIBILITY float asinh(float __lcpp_x) _NOEXCEPT {return ::asinhf(__lcpp_x);}
1077inline _LIBCPP_INLINE_VISIBILITY long double asinh(long double __lcpp_x) _NOEXCEPT {return ::asinhl(__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +00001078
1079template <class _A1>
1080inline _LIBCPP_INLINE_VISIBILITY
1081typename std::enable_if<std::is_integral<_A1>::value, double>::type
Mehdi Aminib3da6322017-02-10 02:44:23 +00001082asinh(_A1 __lcpp_x) _NOEXCEPT {return ::asinh((double)__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +00001083
1084// atanh
1085
Mehdi Aminib3da6322017-02-10 02:44:23 +00001086inline _LIBCPP_INLINE_VISIBILITY float atanh(float __lcpp_x) _NOEXCEPT {return ::atanhf(__lcpp_x);}
1087inline _LIBCPP_INLINE_VISIBILITY long double atanh(long double __lcpp_x) _NOEXCEPT {return ::atanhl(__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +00001088
1089template <class _A1>
1090inline _LIBCPP_INLINE_VISIBILITY
1091typename std::enable_if<std::is_integral<_A1>::value, double>::type
Mehdi Aminib3da6322017-02-10 02:44:23 +00001092atanh(_A1 __lcpp_x) _NOEXCEPT {return ::atanh((double)__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +00001093
1094// cbrt
1095
Mehdi Aminib3da6322017-02-10 02:44:23 +00001096inline _LIBCPP_INLINE_VISIBILITY float cbrt(float __lcpp_x) _NOEXCEPT {return ::cbrtf(__lcpp_x);}
1097inline _LIBCPP_INLINE_VISIBILITY long double cbrt(long double __lcpp_x) _NOEXCEPT {return ::cbrtl(__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +00001098
1099template <class _A1>
1100inline _LIBCPP_INLINE_VISIBILITY
1101typename std::enable_if<std::is_integral<_A1>::value, double>::type
Mehdi Aminib3da6322017-02-10 02:44:23 +00001102cbrt(_A1 __lcpp_x) _NOEXCEPT {return ::cbrt((double)__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +00001103
1104// copysign
1105
Richard Smith081bb592015-10-08 20:40:34 +00001106inline _LIBCPP_INLINE_VISIBILITY float copysign(float __lcpp_x,
1107 float __lcpp_y) _NOEXCEPT {
Mehdi Aminib3da6322017-02-10 02:44:23 +00001108 return ::copysignf(__lcpp_x, __lcpp_y);
Richard Smith081bb592015-10-08 20:40:34 +00001109}
1110inline _LIBCPP_INLINE_VISIBILITY long double
1111copysign(long double __lcpp_x, long double __lcpp_y) _NOEXCEPT {
Mehdi Aminib3da6322017-02-10 02:44:23 +00001112 return ::copysignl(__lcpp_x, __lcpp_y);
Richard Smith081bb592015-10-08 20:40:34 +00001113}
Richard Smith081bb592015-10-08 20:40:34 +00001114
1115template <class _A1, class _A2>
1116inline _LIBCPP_INLINE_VISIBILITY
1117typename std::__lazy_enable_if
1118<
1119 std::is_arithmetic<_A1>::value &&
1120 std::is_arithmetic<_A2>::value,
1121 std::__promote<_A1, _A2>
1122>::type
1123copysign(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
1124{
1125 typedef typename std::__promote<_A1, _A2>::type __result_type;
1126 static_assert((!(std::is_same<_A1, __result_type>::value &&
1127 std::is_same<_A2, __result_type>::value)), "");
Mehdi Aminib3da6322017-02-10 02:44:23 +00001128 return ::copysign((__result_type)__lcpp_x, (__result_type)__lcpp_y);
Richard Smith081bb592015-10-08 20:40:34 +00001129}
1130
Richard Smith081bb592015-10-08 20:40:34 +00001131// erf
1132
Mehdi Aminib3da6322017-02-10 02:44:23 +00001133inline _LIBCPP_INLINE_VISIBILITY float erf(float __lcpp_x) _NOEXCEPT {return ::erff(__lcpp_x);}
1134inline _LIBCPP_INLINE_VISIBILITY long double erf(long double __lcpp_x) _NOEXCEPT {return ::erfl(__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +00001135
1136template <class _A1>
1137inline _LIBCPP_INLINE_VISIBILITY
1138typename std::enable_if<std::is_integral<_A1>::value, double>::type
Mehdi Aminib3da6322017-02-10 02:44:23 +00001139erf(_A1 __lcpp_x) _NOEXCEPT {return ::erf((double)__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +00001140
1141// erfc
1142
Mehdi Aminib3da6322017-02-10 02:44:23 +00001143inline _LIBCPP_INLINE_VISIBILITY float erfc(float __lcpp_x) _NOEXCEPT {return ::erfcf(__lcpp_x);}
1144inline _LIBCPP_INLINE_VISIBILITY long double erfc(long double __lcpp_x) _NOEXCEPT {return ::erfcl(__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +00001145
1146template <class _A1>
1147inline _LIBCPP_INLINE_VISIBILITY
1148typename std::enable_if<std::is_integral<_A1>::value, double>::type
Mehdi Aminib3da6322017-02-10 02:44:23 +00001149erfc(_A1 __lcpp_x) _NOEXCEPT {return ::erfc((double)__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +00001150
1151// exp2
1152
Mehdi Aminib3da6322017-02-10 02:44:23 +00001153inline _LIBCPP_INLINE_VISIBILITY float exp2(float __lcpp_x) _NOEXCEPT {return ::exp2f(__lcpp_x);}
1154inline _LIBCPP_INLINE_VISIBILITY long double exp2(long double __lcpp_x) _NOEXCEPT {return ::exp2l(__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +00001155
1156template <class _A1>
1157inline _LIBCPP_INLINE_VISIBILITY
1158typename std::enable_if<std::is_integral<_A1>::value, double>::type
Mehdi Aminib3da6322017-02-10 02:44:23 +00001159exp2(_A1 __lcpp_x) _NOEXCEPT {return ::exp2((double)__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +00001160
1161// expm1
1162
Mehdi Aminib3da6322017-02-10 02:44:23 +00001163inline _LIBCPP_INLINE_VISIBILITY float expm1(float __lcpp_x) _NOEXCEPT {return ::expm1f(__lcpp_x);}
1164inline _LIBCPP_INLINE_VISIBILITY long double expm1(long double __lcpp_x) _NOEXCEPT {return ::expm1l(__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +00001165
1166template <class _A1>
1167inline _LIBCPP_INLINE_VISIBILITY
1168typename std::enable_if<std::is_integral<_A1>::value, double>::type
Mehdi Aminib3da6322017-02-10 02:44:23 +00001169expm1(_A1 __lcpp_x) _NOEXCEPT {return ::expm1((double)__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +00001170
1171// fdim
1172
Mehdi Aminib3da6322017-02-10 02:44:23 +00001173inline _LIBCPP_INLINE_VISIBILITY float fdim(float __lcpp_x, float __lcpp_y) _NOEXCEPT {return ::fdimf(__lcpp_x, __lcpp_y);}
1174inline _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 +00001175
1176template <class _A1, class _A2>
1177inline _LIBCPP_INLINE_VISIBILITY
1178typename std::__lazy_enable_if
1179<
1180 std::is_arithmetic<_A1>::value &&
1181 std::is_arithmetic<_A2>::value,
1182 std::__promote<_A1, _A2>
1183>::type
1184fdim(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
1185{
1186 typedef typename std::__promote<_A1, _A2>::type __result_type;
1187 static_assert((!(std::is_same<_A1, __result_type>::value &&
1188 std::is_same<_A2, __result_type>::value)), "");
Mehdi Aminib3da6322017-02-10 02:44:23 +00001189 return ::fdim((__result_type)__lcpp_x, (__result_type)__lcpp_y);
Richard Smith081bb592015-10-08 20:40:34 +00001190}
1191
1192// fma
1193
Mehdi Aminib3da6322017-02-10 02:44:23 +00001194inline _LIBCPP_INLINE_VISIBILITY float fma(float __lcpp_x, float __lcpp_y, float __lcpp_z) _NOEXCEPT {return ::fmaf(__lcpp_x, __lcpp_y, __lcpp_z);}
1195inline _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 +00001196
1197template <class _A1, class _A2, class _A3>
1198inline _LIBCPP_INLINE_VISIBILITY
1199typename std::__lazy_enable_if
1200<
1201 std::is_arithmetic<_A1>::value &&
1202 std::is_arithmetic<_A2>::value &&
1203 std::is_arithmetic<_A3>::value,
1204 std::__promote<_A1, _A2, _A3>
1205>::type
1206fma(_A1 __lcpp_x, _A2 __lcpp_y, _A3 __lcpp_z) _NOEXCEPT
1207{
1208 typedef typename std::__promote<_A1, _A2, _A3>::type __result_type;
1209 static_assert((!(std::is_same<_A1, __result_type>::value &&
1210 std::is_same<_A2, __result_type>::value &&
1211 std::is_same<_A3, __result_type>::value)), "");
Mehdi Aminib3da6322017-02-10 02:44:23 +00001212 return ::fma((__result_type)__lcpp_x, (__result_type)__lcpp_y, (__result_type)__lcpp_z);
Richard Smith081bb592015-10-08 20:40:34 +00001213}
1214
1215// fmax
1216
Mehdi Aminib3da6322017-02-10 02:44:23 +00001217inline _LIBCPP_INLINE_VISIBILITY float fmax(float __lcpp_x, float __lcpp_y) _NOEXCEPT {return ::fmaxf(__lcpp_x, __lcpp_y);}
1218inline _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 +00001219
1220template <class _A1, class _A2>
1221inline _LIBCPP_INLINE_VISIBILITY
1222typename std::__lazy_enable_if
1223<
1224 std::is_arithmetic<_A1>::value &&
1225 std::is_arithmetic<_A2>::value,
1226 std::__promote<_A1, _A2>
1227>::type
1228fmax(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
1229{
1230 typedef typename std::__promote<_A1, _A2>::type __result_type;
1231 static_assert((!(std::is_same<_A1, __result_type>::value &&
1232 std::is_same<_A2, __result_type>::value)), "");
Mehdi Aminib3da6322017-02-10 02:44:23 +00001233 return ::fmax((__result_type)__lcpp_x, (__result_type)__lcpp_y);
Richard Smith081bb592015-10-08 20:40:34 +00001234}
1235
1236// fmin
1237
Mehdi Aminib3da6322017-02-10 02:44:23 +00001238inline _LIBCPP_INLINE_VISIBILITY float fmin(float __lcpp_x, float __lcpp_y) _NOEXCEPT {return ::fminf(__lcpp_x, __lcpp_y);}
1239inline _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 +00001240
1241template <class _A1, class _A2>
1242inline _LIBCPP_INLINE_VISIBILITY
1243typename std::__lazy_enable_if
1244<
1245 std::is_arithmetic<_A1>::value &&
1246 std::is_arithmetic<_A2>::value,
1247 std::__promote<_A1, _A2>
1248>::type
1249fmin(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
1250{
1251 typedef typename std::__promote<_A1, _A2>::type __result_type;
1252 static_assert((!(std::is_same<_A1, __result_type>::value &&
1253 std::is_same<_A2, __result_type>::value)), "");
Mehdi Aminib3da6322017-02-10 02:44:23 +00001254 return ::fmin((__result_type)__lcpp_x, (__result_type)__lcpp_y);
Richard Smith081bb592015-10-08 20:40:34 +00001255}
1256
1257// hypot
1258
Mehdi Aminib3da6322017-02-10 02:44:23 +00001259inline _LIBCPP_INLINE_VISIBILITY float hypot(float __lcpp_x, float __lcpp_y) _NOEXCEPT {return ::hypotf(__lcpp_x, __lcpp_y);}
1260inline _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 +00001261
1262template <class _A1, class _A2>
1263inline _LIBCPP_INLINE_VISIBILITY
1264typename std::__lazy_enable_if
1265<
1266 std::is_arithmetic<_A1>::value &&
1267 std::is_arithmetic<_A2>::value,
1268 std::__promote<_A1, _A2>
1269>::type
1270hypot(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
1271{
1272 typedef typename std::__promote<_A1, _A2>::type __result_type;
1273 static_assert((!(std::is_same<_A1, __result_type>::value &&
1274 std::is_same<_A2, __result_type>::value)), "");
Mehdi Aminib3da6322017-02-10 02:44:23 +00001275 return ::hypot((__result_type)__lcpp_x, (__result_type)__lcpp_y);
Richard Smith081bb592015-10-08 20:40:34 +00001276}
1277
1278// ilogb
1279
Mehdi Aminib3da6322017-02-10 02:44:23 +00001280inline _LIBCPP_INLINE_VISIBILITY int ilogb(float __lcpp_x) _NOEXCEPT {return ::ilogbf(__lcpp_x);}
1281inline _LIBCPP_INLINE_VISIBILITY int ilogb(long double __lcpp_x) _NOEXCEPT {return ::ilogbl(__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +00001282
1283template <class _A1>
1284inline _LIBCPP_INLINE_VISIBILITY
1285typename std::enable_if<std::is_integral<_A1>::value, int>::type
Mehdi Aminib3da6322017-02-10 02:44:23 +00001286ilogb(_A1 __lcpp_x) _NOEXCEPT {return ::ilogb((double)__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +00001287
1288// lgamma
1289
Mehdi Aminib3da6322017-02-10 02:44:23 +00001290inline _LIBCPP_INLINE_VISIBILITY float lgamma(float __lcpp_x) _NOEXCEPT {return ::lgammaf(__lcpp_x);}
1291inline _LIBCPP_INLINE_VISIBILITY long double lgamma(long double __lcpp_x) _NOEXCEPT {return ::lgammal(__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +00001292
1293template <class _A1>
1294inline _LIBCPP_INLINE_VISIBILITY
1295typename std::enable_if<std::is_integral<_A1>::value, double>::type
Mehdi Aminib3da6322017-02-10 02:44:23 +00001296lgamma(_A1 __lcpp_x) _NOEXCEPT {return ::lgamma((double)__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +00001297
1298// llrint
1299
Mehdi Aminib3da6322017-02-10 02:44:23 +00001300inline _LIBCPP_INLINE_VISIBILITY long long llrint(float __lcpp_x) _NOEXCEPT {return ::llrintf(__lcpp_x);}
1301inline _LIBCPP_INLINE_VISIBILITY long long llrint(long double __lcpp_x) _NOEXCEPT {return ::llrintl(__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +00001302
1303template <class _A1>
1304inline _LIBCPP_INLINE_VISIBILITY
1305typename std::enable_if<std::is_integral<_A1>::value, long long>::type
Mehdi Aminib3da6322017-02-10 02:44:23 +00001306llrint(_A1 __lcpp_x) _NOEXCEPT {return ::llrint((double)__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +00001307
1308// llround
1309
Mehdi Aminib3da6322017-02-10 02:44:23 +00001310inline _LIBCPP_INLINE_VISIBILITY long long llround(float __lcpp_x) _NOEXCEPT {return ::llroundf(__lcpp_x);}
1311inline _LIBCPP_INLINE_VISIBILITY long long llround(long double __lcpp_x) _NOEXCEPT {return ::llroundl(__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +00001312
1313template <class _A1>
1314inline _LIBCPP_INLINE_VISIBILITY
1315typename std::enable_if<std::is_integral<_A1>::value, long long>::type
Mehdi Aminib3da6322017-02-10 02:44:23 +00001316llround(_A1 __lcpp_x) _NOEXCEPT {return ::llround((double)__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +00001317
1318// log1p
1319
Mehdi Aminib3da6322017-02-10 02:44:23 +00001320inline _LIBCPP_INLINE_VISIBILITY float log1p(float __lcpp_x) _NOEXCEPT {return ::log1pf(__lcpp_x);}
1321inline _LIBCPP_INLINE_VISIBILITY long double log1p(long double __lcpp_x) _NOEXCEPT {return ::log1pl(__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +00001322
1323template <class _A1>
1324inline _LIBCPP_INLINE_VISIBILITY
1325typename std::enable_if<std::is_integral<_A1>::value, double>::type
Mehdi Aminib3da6322017-02-10 02:44:23 +00001326log1p(_A1 __lcpp_x) _NOEXCEPT {return ::log1p((double)__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +00001327
1328// log2
1329
Mehdi Aminib3da6322017-02-10 02:44:23 +00001330inline _LIBCPP_INLINE_VISIBILITY float log2(float __lcpp_x) _NOEXCEPT {return ::log2f(__lcpp_x);}
1331inline _LIBCPP_INLINE_VISIBILITY long double log2(long double __lcpp_x) _NOEXCEPT {return ::log2l(__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +00001332
1333template <class _A1>
1334inline _LIBCPP_INLINE_VISIBILITY
1335typename std::enable_if<std::is_integral<_A1>::value, double>::type
Mehdi Aminib3da6322017-02-10 02:44:23 +00001336log2(_A1 __lcpp_x) _NOEXCEPT {return ::log2((double)__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +00001337
1338// logb
1339
Mehdi Aminib3da6322017-02-10 02:44:23 +00001340inline _LIBCPP_INLINE_VISIBILITY float logb(float __lcpp_x) _NOEXCEPT {return ::logbf(__lcpp_x);}
1341inline _LIBCPP_INLINE_VISIBILITY long double logb(long double __lcpp_x) _NOEXCEPT {return ::logbl(__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +00001342
1343template <class _A1>
1344inline _LIBCPP_INLINE_VISIBILITY
1345typename std::enable_if<std::is_integral<_A1>::value, double>::type
Mehdi Aminib3da6322017-02-10 02:44:23 +00001346logb(_A1 __lcpp_x) _NOEXCEPT {return ::logb((double)__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +00001347
1348// lrint
1349
Mehdi Aminib3da6322017-02-10 02:44:23 +00001350inline _LIBCPP_INLINE_VISIBILITY long lrint(float __lcpp_x) _NOEXCEPT {return ::lrintf(__lcpp_x);}
1351inline _LIBCPP_INLINE_VISIBILITY long lrint(long double __lcpp_x) _NOEXCEPT {return ::lrintl(__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +00001352
1353template <class _A1>
1354inline _LIBCPP_INLINE_VISIBILITY
1355typename std::enable_if<std::is_integral<_A1>::value, long>::type
Mehdi Aminib3da6322017-02-10 02:44:23 +00001356lrint(_A1 __lcpp_x) _NOEXCEPT {return ::lrint((double)__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +00001357
1358// lround
1359
Mehdi Aminib3da6322017-02-10 02:44:23 +00001360inline _LIBCPP_INLINE_VISIBILITY long lround(float __lcpp_x) _NOEXCEPT {return ::lroundf(__lcpp_x);}
1361inline _LIBCPP_INLINE_VISIBILITY long lround(long double __lcpp_x) _NOEXCEPT {return ::lroundl(__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +00001362
1363template <class _A1>
1364inline _LIBCPP_INLINE_VISIBILITY
1365typename std::enable_if<std::is_integral<_A1>::value, long>::type
Mehdi Aminib3da6322017-02-10 02:44:23 +00001366lround(_A1 __lcpp_x) _NOEXCEPT {return ::lround((double)__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +00001367
1368// nan
1369
1370// nearbyint
1371
Mehdi Aminib3da6322017-02-10 02:44:23 +00001372inline _LIBCPP_INLINE_VISIBILITY float nearbyint(float __lcpp_x) _NOEXCEPT {return ::nearbyintf(__lcpp_x);}
1373inline _LIBCPP_INLINE_VISIBILITY long double nearbyint(long double __lcpp_x) _NOEXCEPT {return ::nearbyintl(__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +00001374
1375template <class _A1>
1376inline _LIBCPP_INLINE_VISIBILITY
1377typename std::enable_if<std::is_integral<_A1>::value, double>::type
Mehdi Aminib3da6322017-02-10 02:44:23 +00001378nearbyint(_A1 __lcpp_x) _NOEXCEPT {return ::nearbyint((double)__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +00001379
1380// nextafter
1381
Mehdi Aminib3da6322017-02-10 02:44:23 +00001382inline _LIBCPP_INLINE_VISIBILITY float nextafter(float __lcpp_x, float __lcpp_y) _NOEXCEPT {return ::nextafterf(__lcpp_x, __lcpp_y);}
1383inline _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 +00001384
1385template <class _A1, class _A2>
1386inline _LIBCPP_INLINE_VISIBILITY
1387typename std::__lazy_enable_if
1388<
1389 std::is_arithmetic<_A1>::value &&
1390 std::is_arithmetic<_A2>::value,
1391 std::__promote<_A1, _A2>
1392>::type
1393nextafter(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
1394{
1395 typedef typename std::__promote<_A1, _A2>::type __result_type;
1396 static_assert((!(std::is_same<_A1, __result_type>::value &&
1397 std::is_same<_A2, __result_type>::value)), "");
Mehdi Aminib3da6322017-02-10 02:44:23 +00001398 return ::nextafter((__result_type)__lcpp_x, (__result_type)__lcpp_y);
Richard Smith081bb592015-10-08 20:40:34 +00001399}
1400
1401// nexttoward
1402
Mehdi Aminib3da6322017-02-10 02:44:23 +00001403inline _LIBCPP_INLINE_VISIBILITY float nexttoward(float __lcpp_x, long double __lcpp_y) _NOEXCEPT {return ::nexttowardf(__lcpp_x, __lcpp_y);}
1404inline _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 +00001405
1406template <class _A1>
1407inline _LIBCPP_INLINE_VISIBILITY
1408typename std::enable_if<std::is_integral<_A1>::value, double>::type
Mehdi Aminib3da6322017-02-10 02:44:23 +00001409nexttoward(_A1 __lcpp_x, long double __lcpp_y) _NOEXCEPT {return ::nexttoward((double)__lcpp_x, __lcpp_y);}
Richard Smith081bb592015-10-08 20:40:34 +00001410
1411// remainder
1412
Mehdi Aminib3da6322017-02-10 02:44:23 +00001413inline _LIBCPP_INLINE_VISIBILITY float remainder(float __lcpp_x, float __lcpp_y) _NOEXCEPT {return ::remainderf(__lcpp_x, __lcpp_y);}
1414inline _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 +00001415
1416template <class _A1, class _A2>
1417inline _LIBCPP_INLINE_VISIBILITY
1418typename std::__lazy_enable_if
1419<
1420 std::is_arithmetic<_A1>::value &&
1421 std::is_arithmetic<_A2>::value,
1422 std::__promote<_A1, _A2>
1423>::type
1424remainder(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
1425{
1426 typedef typename std::__promote<_A1, _A2>::type __result_type;
1427 static_assert((!(std::is_same<_A1, __result_type>::value &&
1428 std::is_same<_A2, __result_type>::value)), "");
Mehdi Aminib3da6322017-02-10 02:44:23 +00001429 return ::remainder((__result_type)__lcpp_x, (__result_type)__lcpp_y);
Richard Smith081bb592015-10-08 20:40:34 +00001430}
1431
1432// remquo
1433
Mehdi Aminib3da6322017-02-10 02:44:23 +00001434inline _LIBCPP_INLINE_VISIBILITY float remquo(float __lcpp_x, float __lcpp_y, int* __lcpp_z) _NOEXCEPT {return ::remquof(__lcpp_x, __lcpp_y, __lcpp_z);}
1435inline _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 +00001436
1437template <class _A1, class _A2>
1438inline _LIBCPP_INLINE_VISIBILITY
1439typename std::__lazy_enable_if
1440<
1441 std::is_arithmetic<_A1>::value &&
1442 std::is_arithmetic<_A2>::value,
1443 std::__promote<_A1, _A2>
1444>::type
1445remquo(_A1 __lcpp_x, _A2 __lcpp_y, int* __lcpp_z) _NOEXCEPT
1446{
1447 typedef typename std::__promote<_A1, _A2>::type __result_type;
1448 static_assert((!(std::is_same<_A1, __result_type>::value &&
1449 std::is_same<_A2, __result_type>::value)), "");
Mehdi Aminib3da6322017-02-10 02:44:23 +00001450 return ::remquo((__result_type)__lcpp_x, (__result_type)__lcpp_y, __lcpp_z);
Richard Smith081bb592015-10-08 20:40:34 +00001451}
1452
1453// rint
1454
Mehdi Aminib3da6322017-02-10 02:44:23 +00001455inline _LIBCPP_INLINE_VISIBILITY float rint(float __lcpp_x) _NOEXCEPT {return ::rintf(__lcpp_x);}
1456inline _LIBCPP_INLINE_VISIBILITY long double rint(long double __lcpp_x) _NOEXCEPT {return ::rintl(__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +00001457
1458template <class _A1>
1459inline _LIBCPP_INLINE_VISIBILITY
1460typename std::enable_if<std::is_integral<_A1>::value, double>::type
Mehdi Aminib3da6322017-02-10 02:44:23 +00001461rint(_A1 __lcpp_x) _NOEXCEPT {return ::rint((double)__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +00001462
1463// round
1464
Mehdi Aminib3da6322017-02-10 02:44:23 +00001465inline _LIBCPP_INLINE_VISIBILITY float round(float __lcpp_x) _NOEXCEPT {return ::roundf(__lcpp_x);}
1466inline _LIBCPP_INLINE_VISIBILITY long double round(long double __lcpp_x) _NOEXCEPT {return ::roundl(__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +00001467
1468template <class _A1>
1469inline _LIBCPP_INLINE_VISIBILITY
1470typename std::enable_if<std::is_integral<_A1>::value, double>::type
Mehdi Aminib3da6322017-02-10 02:44:23 +00001471round(_A1 __lcpp_x) _NOEXCEPT {return ::round((double)__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +00001472
1473// scalbln
1474
Mehdi Aminib3da6322017-02-10 02:44:23 +00001475inline _LIBCPP_INLINE_VISIBILITY float scalbln(float __lcpp_x, long __lcpp_y) _NOEXCEPT {return ::scalblnf(__lcpp_x, __lcpp_y);}
1476inline _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 +00001477
1478template <class _A1>
1479inline _LIBCPP_INLINE_VISIBILITY
1480typename std::enable_if<std::is_integral<_A1>::value, double>::type
Mehdi Aminib3da6322017-02-10 02:44:23 +00001481scalbln(_A1 __lcpp_x, long __lcpp_y) _NOEXCEPT {return ::scalbln((double)__lcpp_x, __lcpp_y);}
Richard Smith081bb592015-10-08 20:40:34 +00001482
1483// scalbn
1484
Mehdi Aminib3da6322017-02-10 02:44:23 +00001485inline _LIBCPP_INLINE_VISIBILITY float scalbn(float __lcpp_x, int __lcpp_y) _NOEXCEPT {return ::scalbnf(__lcpp_x, __lcpp_y);}
1486inline _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 +00001487
1488template <class _A1>
1489inline _LIBCPP_INLINE_VISIBILITY
1490typename std::enable_if<std::is_integral<_A1>::value, double>::type
Mehdi Aminib3da6322017-02-10 02:44:23 +00001491scalbn(_A1 __lcpp_x, int __lcpp_y) _NOEXCEPT {return ::scalbn((double)__lcpp_x, __lcpp_y);}
Richard Smith081bb592015-10-08 20:40:34 +00001492
1493// tgamma
1494
Mehdi Aminib3da6322017-02-10 02:44:23 +00001495inline _LIBCPP_INLINE_VISIBILITY float tgamma(float __lcpp_x) _NOEXCEPT {return ::tgammaf(__lcpp_x);}
1496inline _LIBCPP_INLINE_VISIBILITY long double tgamma(long double __lcpp_x) _NOEXCEPT {return ::tgammal(__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +00001497
1498template <class _A1>
1499inline _LIBCPP_INLINE_VISIBILITY
1500typename std::enable_if<std::is_integral<_A1>::value, double>::type
Mehdi Aminib3da6322017-02-10 02:44:23 +00001501tgamma(_A1 __lcpp_x) _NOEXCEPT {return ::tgamma((double)__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +00001502
1503// trunc
1504
Mehdi Aminib3da6322017-02-10 02:44:23 +00001505inline _LIBCPP_INLINE_VISIBILITY float trunc(float __lcpp_x) _NOEXCEPT {return ::truncf(__lcpp_x);}
1506inline _LIBCPP_INLINE_VISIBILITY long double trunc(long double __lcpp_x) _NOEXCEPT {return ::truncl(__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +00001507
1508template <class _A1>
1509inline _LIBCPP_INLINE_VISIBILITY
1510typename std::enable_if<std::is_integral<_A1>::value, double>::type
Mehdi Aminib3da6322017-02-10 02:44:23 +00001511trunc(_A1 __lcpp_x) _NOEXCEPT {return ::trunc((double)__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +00001512
Richard Smith081bb592015-10-08 20:40:34 +00001513} // extern "C++"
1514
1515#endif // __cplusplus
1516
Mikhail Maltsev34b4f972018-02-22 09:34:08 +00001517#else // _LIBCPP_MATH_H
1518
1519// This include lives outside the header guard in order to support an MSVC
1520// extension which allows users to do:
1521//
1522// #define _USE_MATH_DEFINES
1523// #include <math.h>
1524//
1525// and receive the definitions of mathematical constants, even if <math.h>
1526// has previously been included.
1527#if defined(_LIBCPP_MSVCRT) && defined(_USE_MATH_DEFINES)
1528#include_next <math.h>
1529#endif
1530
Richard Smith081bb592015-10-08 20:40:34 +00001531#endif // _LIBCPP_MATH_H