blob: 8c30ba85d22c99b2016a7e3728c30014a150ad0f [file] [log] [blame]
Richard Smith4faa3942015-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 Smith4faa3942015-10-08 20:40:34 +0000296
297#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
298#pragma GCC system_header
299#endif
300
Richard Smith45bae0b2015-10-09 00:26:50 +0000301#include_next <math.h>
302
Richard Smith4faa3942015-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 Smith5df171d2017-04-21 23:14:55 +0000310#include <limits>
Richard Smith4faa3942015-10-08 20:40:34 +0000311
Richard Smith4faa3942015-10-08 20:40:34 +0000312// signbit
313
314#ifdef signbit
315
316template <class _A1>
317_LIBCPP_ALWAYS_INLINE
318bool
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 Smith5df171d2017-04-21 23:14:55 +0000328typename std::enable_if<std::is_floating_point<_A1>::value, bool>::type
Richard Smith4faa3942015-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 Smith5df171d2017-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 Meenai04b59f92017-04-07 02:20:52 +0000348#elif defined(_LIBCPP_MSVCRT)
Saleem Abdulrasool1eab1682017-02-18 19:28:38 +0000349
350template <typename _A1>
351inline _LIBCPP_INLINE_VISIBILITY
Duncan P. N. Exon Smith5df171d2017-04-21 23:14:55 +0000352typename std::enable_if<std::is_floating_point<_A1>::value, bool>::type
Saleem Abdulrasool1eab1682017-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 Smith5df171d2017-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 Smith4faa3942015-10-08 20:40:34 +0000372#endif // signbit
373
374// fpclassify
375
376#ifdef fpclassify
377
378template <class _A1>
379_LIBCPP_ALWAYS_INLINE
380int
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 Smith5df171d2017-04-21 23:14:55 +0000390typename std::enable_if<std::is_floating_point<_A1>::value, int>::type
Richard Smith4faa3942015-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 Smith5df171d2017-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 Meenai04b59f92017-04-07 02:20:52 +0000402#elif defined(_LIBCPP_MSVCRT)
Saleem Abdulrasool1eab1682017-02-18 19:28:38 +0000403
404template <typename _A1>
405inline _LIBCPP_INLINE_VISIBILITY
Duncan P. N. Exon Smith5df171d2017-04-21 23:14:55 +0000406typename std::enable_if<std::is_floating_point<_A1>::value, bool>::type
Saleem Abdulrasool1eab1682017-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 Smith5df171d2017-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 Smith4faa3942015-10-08 20:40:34 +0000418#endif // fpclassify
419
420// isfinite
421
422#ifdef isfinite
423
424template <class _A1>
425_LIBCPP_ALWAYS_INLINE
426bool
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 Smith5df171d2017-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 Smith4faa3942015-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 Smith5df171d2017-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 Smith4faa3942015-10-08 20:40:34 +0000452#endif // isfinite
453
454// isinf
455
456#ifdef isinf
457
458template <class _A1>
459_LIBCPP_ALWAYS_INLINE
460bool
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 Smith5df171d2017-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 Smith4faa3942015-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 Smith5df171d2017-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 Smith4faa3942015-10-08 20:40:34 +0000486#endif // isinf
487
488// isnan
489
490#ifdef isnan
491
492template <class _A1>
493_LIBCPP_ALWAYS_INLINE
494bool
495__libcpp_isnan(_A1 __lcpp_x) _NOEXCEPT
496{
497 return isnan(__lcpp_x);
498}
499
500#undef isnan
501
502template <class _A1>
503inline _LIBCPP_INLINE_VISIBILITY
Duncan P. N. Exon Smith5df171d2017-04-21 23:14:55 +0000504typename std::enable_if<std::is_floating_point<_A1>::value, bool>::type
Richard Smith4faa3942015-10-08 20:40:34 +0000505isnan(_A1 __lcpp_x) _NOEXCEPT
506{
507 return __libcpp_isnan((typename std::__promote<_A1>::type)__lcpp_x);
508}
509
Duncan P. N. Exon Smith5df171d2017-04-21 23:14:55 +0000510template <class _A1>
511inline _LIBCPP_INLINE_VISIBILITY
512typename std::enable_if<std::is_integral<_A1>::value, bool>::type
513isnan(_A1) _NOEXCEPT
514{ return false; }
515
Richard Smith4faa3942015-10-08 20:40:34 +0000516#endif // isnan
517
518// isnormal
519
520#ifdef isnormal
521
522template <class _A1>
523_LIBCPP_ALWAYS_INLINE
524bool
525__libcpp_isnormal(_A1 __lcpp_x) _NOEXCEPT
526{
527 return isnormal(__lcpp_x);
528}
529
530#undef isnormal
531
532template <class _A1>
533inline _LIBCPP_INLINE_VISIBILITY
Duncan P. N. Exon Smith5df171d2017-04-21 23:14:55 +0000534typename std::enable_if<std::is_floating_point<_A1>::value, bool>::type
Richard Smith4faa3942015-10-08 20:40:34 +0000535isnormal(_A1 __lcpp_x) _NOEXCEPT
536{
537 return __libcpp_isnormal((typename std::__promote<_A1>::type)__lcpp_x);
538}
539
Duncan P. N. Exon Smith5df171d2017-04-21 23:14:55 +0000540template <class _A1>
541inline _LIBCPP_INLINE_VISIBILITY
542typename std::enable_if<std::is_integral<_A1>::value, bool>::type
543isnormal(_A1 __lcpp_x) _NOEXCEPT
544{ return __lcpp_x != 0; }
545
Richard Smith4faa3942015-10-08 20:40:34 +0000546#endif // isnormal
547
548// isgreater
549
550#ifdef isgreater
551
552template <class _A1, class _A2>
553_LIBCPP_ALWAYS_INLINE
554bool
555__libcpp_isgreater(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
556{
557 return isgreater(__lcpp_x, __lcpp_y);
558}
559
560#undef isgreater
561
562template <class _A1, class _A2>
563inline _LIBCPP_INLINE_VISIBILITY
564typename std::enable_if
565<
566 std::is_arithmetic<_A1>::value &&
567 std::is_arithmetic<_A2>::value,
568 bool
569>::type
570isgreater(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
571{
572 typedef typename std::__promote<_A1, _A2>::type type;
573 return __libcpp_isgreater((type)__lcpp_x, (type)__lcpp_y);
574}
575
576#endif // isgreater
577
578// isgreaterequal
579
580#ifdef isgreaterequal
581
582template <class _A1, class _A2>
583_LIBCPP_ALWAYS_INLINE
584bool
585__libcpp_isgreaterequal(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
586{
587 return isgreaterequal(__lcpp_x, __lcpp_y);
588}
589
590#undef isgreaterequal
591
592template <class _A1, class _A2>
593inline _LIBCPP_INLINE_VISIBILITY
594typename std::enable_if
595<
596 std::is_arithmetic<_A1>::value &&
597 std::is_arithmetic<_A2>::value,
598 bool
599>::type
600isgreaterequal(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
601{
602 typedef typename std::__promote<_A1, _A2>::type type;
603 return __libcpp_isgreaterequal((type)__lcpp_x, (type)__lcpp_y);
604}
605
606#endif // isgreaterequal
607
608// isless
609
610#ifdef isless
611
612template <class _A1, class _A2>
613_LIBCPP_ALWAYS_INLINE
614bool
615__libcpp_isless(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
616{
617 return isless(__lcpp_x, __lcpp_y);
618}
619
620#undef isless
621
622template <class _A1, class _A2>
623inline _LIBCPP_INLINE_VISIBILITY
624typename std::enable_if
625<
626 std::is_arithmetic<_A1>::value &&
627 std::is_arithmetic<_A2>::value,
628 bool
629>::type
630isless(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
631{
632 typedef typename std::__promote<_A1, _A2>::type type;
633 return __libcpp_isless((type)__lcpp_x, (type)__lcpp_y);
634}
635
636#endif // isless
637
638// islessequal
639
640#ifdef islessequal
641
642template <class _A1, class _A2>
643_LIBCPP_ALWAYS_INLINE
644bool
645__libcpp_islessequal(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
646{
647 return islessequal(__lcpp_x, __lcpp_y);
648}
649
650#undef islessequal
651
652template <class _A1, class _A2>
653inline _LIBCPP_INLINE_VISIBILITY
654typename std::enable_if
655<
656 std::is_arithmetic<_A1>::value &&
657 std::is_arithmetic<_A2>::value,
658 bool
659>::type
660islessequal(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
661{
662 typedef typename std::__promote<_A1, _A2>::type type;
663 return __libcpp_islessequal((type)__lcpp_x, (type)__lcpp_y);
664}
665
666#endif // islessequal
667
668// islessgreater
669
670#ifdef islessgreater
671
672template <class _A1, class _A2>
673_LIBCPP_ALWAYS_INLINE
674bool
675__libcpp_islessgreater(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
676{
677 return islessgreater(__lcpp_x, __lcpp_y);
678}
679
680#undef islessgreater
681
682template <class _A1, class _A2>
683inline _LIBCPP_INLINE_VISIBILITY
684typename std::enable_if
685<
686 std::is_arithmetic<_A1>::value &&
687 std::is_arithmetic<_A2>::value,
688 bool
689>::type
690islessgreater(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
691{
692 typedef typename std::__promote<_A1, _A2>::type type;
693 return __libcpp_islessgreater((type)__lcpp_x, (type)__lcpp_y);
694}
695
696#endif // islessgreater
697
698// isunordered
699
700#ifdef isunordered
701
702template <class _A1, class _A2>
703_LIBCPP_ALWAYS_INLINE
704bool
705__libcpp_isunordered(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
706{
707 return isunordered(__lcpp_x, __lcpp_y);
708}
709
710#undef isunordered
711
712template <class _A1, class _A2>
713inline _LIBCPP_INLINE_VISIBILITY
714typename std::enable_if
715<
716 std::is_arithmetic<_A1>::value &&
717 std::is_arithmetic<_A2>::value,
718 bool
719>::type
720isunordered(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
721{
722 typedef typename std::__promote<_A1, _A2>::type type;
723 return __libcpp_isunordered((type)__lcpp_x, (type)__lcpp_y);
724}
725
726#endif // isunordered
727
Richard Smith4faa3942015-10-08 20:40:34 +0000728// abs
729
Eric Fiselier543cf612016-08-15 18:58:57 +0000730#if !(defined(_AIX) || defined(__sun__))
Richard Smith4faa3942015-10-08 20:40:34 +0000731inline _LIBCPP_INLINE_VISIBILITY
732float
Mehdi Amini76661302017-02-10 02:44:23 +0000733abs(float __lcpp_x) _NOEXCEPT {return ::fabsf(__lcpp_x);}
Richard Smith4faa3942015-10-08 20:40:34 +0000734
735inline _LIBCPP_INLINE_VISIBILITY
736double
Mehdi Amini76661302017-02-10 02:44:23 +0000737abs(double __lcpp_x) _NOEXCEPT {return ::fabs(__lcpp_x);}
Richard Smith4faa3942015-10-08 20:40:34 +0000738
739inline _LIBCPP_INLINE_VISIBILITY
740long double
Mehdi Amini76661302017-02-10 02:44:23 +0000741abs(long double __lcpp_x) _NOEXCEPT {return ::fabsl(__lcpp_x);}
Eric Fiselier543cf612016-08-15 18:58:57 +0000742#endif // !(defined(_AIX) || defined(__sun__))
Richard Smith4faa3942015-10-08 20:40:34 +0000743
744// acos
745
Shoaib Meenai04b59f92017-04-07 02:20:52 +0000746#if !(defined(_AIX) || defined(__sun__))
Mehdi Amini76661302017-02-10 02:44:23 +0000747inline _LIBCPP_INLINE_VISIBILITY float acos(float __lcpp_x) _NOEXCEPT {return ::acosf(__lcpp_x);}
748inline _LIBCPP_INLINE_VISIBILITY long double acos(long double __lcpp_x) _NOEXCEPT {return ::acosl(__lcpp_x);}
Richard Smith4faa3942015-10-08 20:40:34 +0000749#endif
750
751template <class _A1>
752inline _LIBCPP_INLINE_VISIBILITY
753typename std::enable_if<std::is_integral<_A1>::value, double>::type
Mehdi Amini76661302017-02-10 02:44:23 +0000754acos(_A1 __lcpp_x) _NOEXCEPT {return ::acos((double)__lcpp_x);}
Richard Smith4faa3942015-10-08 20:40:34 +0000755
756// asin
757
Shoaib Meenai04b59f92017-04-07 02:20:52 +0000758#if !(defined(_AIX) || defined(__sun__))
Mehdi Amini76661302017-02-10 02:44:23 +0000759inline _LIBCPP_INLINE_VISIBILITY float asin(float __lcpp_x) _NOEXCEPT {return ::asinf(__lcpp_x);}
760inline _LIBCPP_INLINE_VISIBILITY long double asin(long double __lcpp_x) _NOEXCEPT {return ::asinl(__lcpp_x);}
Richard Smith4faa3942015-10-08 20:40:34 +0000761#endif
762
763template <class _A1>
764inline _LIBCPP_INLINE_VISIBILITY
765typename std::enable_if<std::is_integral<_A1>::value, double>::type
Mehdi Amini76661302017-02-10 02:44:23 +0000766asin(_A1 __lcpp_x) _NOEXCEPT {return ::asin((double)__lcpp_x);}
Richard Smith4faa3942015-10-08 20:40:34 +0000767
768// atan
769
Shoaib Meenai04b59f92017-04-07 02:20:52 +0000770#if !(defined(_AIX) || defined(__sun__))
Mehdi Amini76661302017-02-10 02:44:23 +0000771inline _LIBCPP_INLINE_VISIBILITY float atan(float __lcpp_x) _NOEXCEPT {return ::atanf(__lcpp_x);}
772inline _LIBCPP_INLINE_VISIBILITY long double atan(long double __lcpp_x) _NOEXCEPT {return ::atanl(__lcpp_x);}
Richard Smith4faa3942015-10-08 20:40:34 +0000773#endif
774
775template <class _A1>
776inline _LIBCPP_INLINE_VISIBILITY
777typename std::enable_if<std::is_integral<_A1>::value, double>::type
Mehdi Amini76661302017-02-10 02:44:23 +0000778atan(_A1 __lcpp_x) _NOEXCEPT {return ::atan((double)__lcpp_x);}
Richard Smith4faa3942015-10-08 20:40:34 +0000779
780// atan2
781
Shoaib Meenai04b59f92017-04-07 02:20:52 +0000782#if !(defined(_AIX) || defined(__sun__))
Mehdi Amini76661302017-02-10 02:44:23 +0000783inline _LIBCPP_INLINE_VISIBILITY float atan2(float __lcpp_y, float __lcpp_x) _NOEXCEPT {return ::atan2f(__lcpp_y, __lcpp_x);}
784inline _LIBCPP_INLINE_VISIBILITY long double atan2(long double __lcpp_y, long double __lcpp_x) _NOEXCEPT {return ::atan2l(__lcpp_y, __lcpp_x);}
Richard Smith4faa3942015-10-08 20:40:34 +0000785#endif
786
787template <class _A1, class _A2>
788inline _LIBCPP_INLINE_VISIBILITY
789typename std::__lazy_enable_if
790<
791 std::is_arithmetic<_A1>::value &&
792 std::is_arithmetic<_A2>::value,
793 std::__promote<_A1, _A2>
794>::type
795atan2(_A1 __lcpp_y, _A2 __lcpp_x) _NOEXCEPT
796{
797 typedef typename std::__promote<_A1, _A2>::type __result_type;
798 static_assert((!(std::is_same<_A1, __result_type>::value &&
799 std::is_same<_A2, __result_type>::value)), "");
Mehdi Amini76661302017-02-10 02:44:23 +0000800 return ::atan2((__result_type)__lcpp_y, (__result_type)__lcpp_x);
Richard Smith4faa3942015-10-08 20:40:34 +0000801}
802
803// ceil
804
Shoaib Meenai04b59f92017-04-07 02:20:52 +0000805#if !(defined(_AIX) || defined(__sun__))
Mehdi Amini76661302017-02-10 02:44:23 +0000806inline _LIBCPP_INLINE_VISIBILITY float ceil(float __lcpp_x) _NOEXCEPT {return ::ceilf(__lcpp_x);}
807inline _LIBCPP_INLINE_VISIBILITY long double ceil(long double __lcpp_x) _NOEXCEPT {return ::ceill(__lcpp_x);}
Richard Smith4faa3942015-10-08 20:40:34 +0000808#endif
809
810template <class _A1>
811inline _LIBCPP_INLINE_VISIBILITY
812typename std::enable_if<std::is_integral<_A1>::value, double>::type
Mehdi Amini76661302017-02-10 02:44:23 +0000813ceil(_A1 __lcpp_x) _NOEXCEPT {return ::ceil((double)__lcpp_x);}
Richard Smith4faa3942015-10-08 20:40:34 +0000814
815// cos
816
Shoaib Meenai04b59f92017-04-07 02:20:52 +0000817#if !(defined(_AIX) || defined(__sun__))
Mehdi Amini76661302017-02-10 02:44:23 +0000818inline _LIBCPP_INLINE_VISIBILITY float cos(float __lcpp_x) _NOEXCEPT {return ::cosf(__lcpp_x);}
819inline _LIBCPP_INLINE_VISIBILITY long double cos(long double __lcpp_x) _NOEXCEPT {return ::cosl(__lcpp_x);}
Richard Smith4faa3942015-10-08 20:40:34 +0000820#endif
821
822template <class _A1>
823inline _LIBCPP_INLINE_VISIBILITY
824typename std::enable_if<std::is_integral<_A1>::value, double>::type
Mehdi Amini76661302017-02-10 02:44:23 +0000825cos(_A1 __lcpp_x) _NOEXCEPT {return ::cos((double)__lcpp_x);}
Richard Smith4faa3942015-10-08 20:40:34 +0000826
827// cosh
828
Shoaib Meenai04b59f92017-04-07 02:20:52 +0000829#if !(defined(_AIX) || defined(__sun__))
Mehdi Amini76661302017-02-10 02:44:23 +0000830inline _LIBCPP_INLINE_VISIBILITY float cosh(float __lcpp_x) _NOEXCEPT {return ::coshf(__lcpp_x);}
831inline _LIBCPP_INLINE_VISIBILITY long double cosh(long double __lcpp_x) _NOEXCEPT {return ::coshl(__lcpp_x);}
Richard Smith4faa3942015-10-08 20:40:34 +0000832#endif
833
834template <class _A1>
835inline _LIBCPP_INLINE_VISIBILITY
836typename std::enable_if<std::is_integral<_A1>::value, double>::type
Mehdi Amini76661302017-02-10 02:44:23 +0000837cosh(_A1 __lcpp_x) _NOEXCEPT {return ::cosh((double)__lcpp_x);}
Richard Smith4faa3942015-10-08 20:40:34 +0000838
839// exp
840
Shoaib Meenai04b59f92017-04-07 02:20:52 +0000841#if !(defined(_AIX) || defined(__sun__))
Mehdi Amini76661302017-02-10 02:44:23 +0000842inline _LIBCPP_INLINE_VISIBILITY float exp(float __lcpp_x) _NOEXCEPT {return ::expf(__lcpp_x);}
843inline _LIBCPP_INLINE_VISIBILITY long double exp(long double __lcpp_x) _NOEXCEPT {return ::expl(__lcpp_x);}
Richard Smith4faa3942015-10-08 20:40:34 +0000844#endif
845
846template <class _A1>
847inline _LIBCPP_INLINE_VISIBILITY
848typename std::enable_if<std::is_integral<_A1>::value, double>::type
Mehdi Amini76661302017-02-10 02:44:23 +0000849exp(_A1 __lcpp_x) _NOEXCEPT {return ::exp((double)__lcpp_x);}
Richard Smith4faa3942015-10-08 20:40:34 +0000850
851// fabs
852
Shoaib Meenai04b59f92017-04-07 02:20:52 +0000853#if !(defined(_AIX) || defined(__sun__))
Mehdi Amini76661302017-02-10 02:44:23 +0000854inline _LIBCPP_INLINE_VISIBILITY float fabs(float __lcpp_x) _NOEXCEPT {return ::fabsf(__lcpp_x);}
855inline _LIBCPP_INLINE_VISIBILITY long double fabs(long double __lcpp_x) _NOEXCEPT {return ::fabsl(__lcpp_x);}
Richard Smith4faa3942015-10-08 20:40:34 +0000856#endif
857
858template <class _A1>
859inline _LIBCPP_INLINE_VISIBILITY
860typename std::enable_if<std::is_integral<_A1>::value, double>::type
Mehdi Amini76661302017-02-10 02:44:23 +0000861fabs(_A1 __lcpp_x) _NOEXCEPT {return ::fabs((double)__lcpp_x);}
Richard Smith4faa3942015-10-08 20:40:34 +0000862
863// floor
864
Shoaib Meenai04b59f92017-04-07 02:20:52 +0000865#if !(defined(_AIX) || defined(__sun__))
Mehdi Amini76661302017-02-10 02:44:23 +0000866inline _LIBCPP_INLINE_VISIBILITY float floor(float __lcpp_x) _NOEXCEPT {return ::floorf(__lcpp_x);}
867inline _LIBCPP_INLINE_VISIBILITY long double floor(long double __lcpp_x) _NOEXCEPT {return ::floorl(__lcpp_x);}
Richard Smith4faa3942015-10-08 20:40:34 +0000868#endif
869
870template <class _A1>
871inline _LIBCPP_INLINE_VISIBILITY
872typename std::enable_if<std::is_integral<_A1>::value, double>::type
Mehdi Amini76661302017-02-10 02:44:23 +0000873floor(_A1 __lcpp_x) _NOEXCEPT {return ::floor((double)__lcpp_x);}
Richard Smith4faa3942015-10-08 20:40:34 +0000874
875// fmod
876
Shoaib Meenai04b59f92017-04-07 02:20:52 +0000877#if !(defined(_AIX) || defined(__sun__))
Mehdi Amini76661302017-02-10 02:44:23 +0000878inline _LIBCPP_INLINE_VISIBILITY float fmod(float __lcpp_x, float __lcpp_y) _NOEXCEPT {return ::fmodf(__lcpp_x, __lcpp_y);}
879inline _LIBCPP_INLINE_VISIBILITY long double fmod(long double __lcpp_x, long double __lcpp_y) _NOEXCEPT {return ::fmodl(__lcpp_x, __lcpp_y);}
Richard Smith4faa3942015-10-08 20:40:34 +0000880#endif
881
882template <class _A1, class _A2>
883inline _LIBCPP_INLINE_VISIBILITY
884typename std::__lazy_enable_if
885<
886 std::is_arithmetic<_A1>::value &&
887 std::is_arithmetic<_A2>::value,
888 std::__promote<_A1, _A2>
889>::type
890fmod(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
891{
892 typedef typename std::__promote<_A1, _A2>::type __result_type;
893 static_assert((!(std::is_same<_A1, __result_type>::value &&
894 std::is_same<_A2, __result_type>::value)), "");
Mehdi Amini76661302017-02-10 02:44:23 +0000895 return ::fmod((__result_type)__lcpp_x, (__result_type)__lcpp_y);
Richard Smith4faa3942015-10-08 20:40:34 +0000896}
897
898// frexp
899
Shoaib Meenai04b59f92017-04-07 02:20:52 +0000900#if !(defined(_AIX) || defined(__sun__))
Mehdi Amini76661302017-02-10 02:44:23 +0000901inline _LIBCPP_INLINE_VISIBILITY float frexp(float __lcpp_x, int* __lcpp_e) _NOEXCEPT {return ::frexpf(__lcpp_x, __lcpp_e);}
902inline _LIBCPP_INLINE_VISIBILITY long double frexp(long double __lcpp_x, int* __lcpp_e) _NOEXCEPT {return ::frexpl(__lcpp_x, __lcpp_e);}
Richard Smith4faa3942015-10-08 20:40:34 +0000903#endif
904
905template <class _A1>
906inline _LIBCPP_INLINE_VISIBILITY
907typename std::enable_if<std::is_integral<_A1>::value, double>::type
Mehdi Amini76661302017-02-10 02:44:23 +0000908frexp(_A1 __lcpp_x, int* __lcpp_e) _NOEXCEPT {return ::frexp((double)__lcpp_x, __lcpp_e);}
Richard Smith4faa3942015-10-08 20:40:34 +0000909
910// ldexp
911
Shoaib Meenai04b59f92017-04-07 02:20:52 +0000912#if !(defined(_AIX) || defined(__sun__))
Mehdi Amini76661302017-02-10 02:44:23 +0000913inline _LIBCPP_INLINE_VISIBILITY float ldexp(float __lcpp_x, int __lcpp_e) _NOEXCEPT {return ::ldexpf(__lcpp_x, __lcpp_e);}
914inline _LIBCPP_INLINE_VISIBILITY long double ldexp(long double __lcpp_x, int __lcpp_e) _NOEXCEPT {return ::ldexpl(__lcpp_x, __lcpp_e);}
Richard Smith4faa3942015-10-08 20:40:34 +0000915#endif
916
917template <class _A1>
918inline _LIBCPP_INLINE_VISIBILITY
919typename std::enable_if<std::is_integral<_A1>::value, double>::type
Mehdi Amini76661302017-02-10 02:44:23 +0000920ldexp(_A1 __lcpp_x, int __lcpp_e) _NOEXCEPT {return ::ldexp((double)__lcpp_x, __lcpp_e);}
Richard Smith4faa3942015-10-08 20:40:34 +0000921
922// log
923
Shoaib Meenai04b59f92017-04-07 02:20:52 +0000924#if !(defined(_AIX) || defined(__sun__))
Mehdi Amini76661302017-02-10 02:44:23 +0000925inline _LIBCPP_INLINE_VISIBILITY float log(float __lcpp_x) _NOEXCEPT {return ::logf(__lcpp_x);}
926inline _LIBCPP_INLINE_VISIBILITY long double log(long double __lcpp_x) _NOEXCEPT {return ::logl(__lcpp_x);}
Richard Smith4faa3942015-10-08 20:40:34 +0000927#endif
928
929template <class _A1>
930inline _LIBCPP_INLINE_VISIBILITY
931typename std::enable_if<std::is_integral<_A1>::value, double>::type
Mehdi Amini76661302017-02-10 02:44:23 +0000932log(_A1 __lcpp_x) _NOEXCEPT {return ::log((double)__lcpp_x);}
Richard Smith4faa3942015-10-08 20:40:34 +0000933
934// log10
935
Shoaib Meenai04b59f92017-04-07 02:20:52 +0000936#if !(defined(_AIX) || defined(__sun__))
Mehdi Amini76661302017-02-10 02:44:23 +0000937inline _LIBCPP_INLINE_VISIBILITY float log10(float __lcpp_x) _NOEXCEPT {return ::log10f(__lcpp_x);}
938inline _LIBCPP_INLINE_VISIBILITY long double log10(long double __lcpp_x) _NOEXCEPT {return ::log10l(__lcpp_x);}
Richard Smith4faa3942015-10-08 20:40:34 +0000939#endif
940
941template <class _A1>
942inline _LIBCPP_INLINE_VISIBILITY
943typename std::enable_if<std::is_integral<_A1>::value, double>::type
Mehdi Amini76661302017-02-10 02:44:23 +0000944log10(_A1 __lcpp_x) _NOEXCEPT {return ::log10((double)__lcpp_x);}
Richard Smith4faa3942015-10-08 20:40:34 +0000945
946// modf
947
Shoaib Meenai04b59f92017-04-07 02:20:52 +0000948#if !(defined(_AIX) || defined(__sun__))
Mehdi Amini76661302017-02-10 02:44:23 +0000949inline _LIBCPP_INLINE_VISIBILITY float modf(float __lcpp_x, float* __lcpp_y) _NOEXCEPT {return ::modff(__lcpp_x, __lcpp_y);}
950inline _LIBCPP_INLINE_VISIBILITY long double modf(long double __lcpp_x, long double* __lcpp_y) _NOEXCEPT {return ::modfl(__lcpp_x, __lcpp_y);}
Richard Smith4faa3942015-10-08 20:40:34 +0000951#endif
952
953// pow
954
Shoaib Meenai04b59f92017-04-07 02:20:52 +0000955#if !(defined(_AIX) || defined(__sun__))
Mehdi Amini76661302017-02-10 02:44:23 +0000956inline _LIBCPP_INLINE_VISIBILITY float pow(float __lcpp_x, float __lcpp_y) _NOEXCEPT {return ::powf(__lcpp_x, __lcpp_y);}
957inline _LIBCPP_INLINE_VISIBILITY long double pow(long double __lcpp_x, long double __lcpp_y) _NOEXCEPT {return ::powl(__lcpp_x, __lcpp_y);}
Richard Smith4faa3942015-10-08 20:40:34 +0000958#endif
959
960template <class _A1, class _A2>
961inline _LIBCPP_INLINE_VISIBILITY
962typename std::__lazy_enable_if
963<
964 std::is_arithmetic<_A1>::value &&
965 std::is_arithmetic<_A2>::value,
966 std::__promote<_A1, _A2>
967>::type
968pow(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
969{
970 typedef typename std::__promote<_A1, _A2>::type __result_type;
971 static_assert((!(std::is_same<_A1, __result_type>::value &&
972 std::is_same<_A2, __result_type>::value)), "");
Mehdi Amini76661302017-02-10 02:44:23 +0000973 return ::pow((__result_type)__lcpp_x, (__result_type)__lcpp_y);
Richard Smith4faa3942015-10-08 20:40:34 +0000974}
975
976// sin
977
Shoaib Meenai04b59f92017-04-07 02:20:52 +0000978#if !(defined(_AIX) || defined(__sun__))
Mehdi Amini76661302017-02-10 02:44:23 +0000979inline _LIBCPP_INLINE_VISIBILITY float sin(float __lcpp_x) _NOEXCEPT {return ::sinf(__lcpp_x);}
980inline _LIBCPP_INLINE_VISIBILITY long double sin(long double __lcpp_x) _NOEXCEPT {return ::sinl(__lcpp_x);}
Richard Smith4faa3942015-10-08 20:40:34 +0000981#endif
982
983template <class _A1>
984inline _LIBCPP_INLINE_VISIBILITY
985typename std::enable_if<std::is_integral<_A1>::value, double>::type
Mehdi Amini76661302017-02-10 02:44:23 +0000986sin(_A1 __lcpp_x) _NOEXCEPT {return ::sin((double)__lcpp_x);}
Richard Smith4faa3942015-10-08 20:40:34 +0000987
988// sinh
989
Shoaib Meenai04b59f92017-04-07 02:20:52 +0000990#if !(defined(_AIX) || defined(__sun__))
Mehdi Amini76661302017-02-10 02:44:23 +0000991inline _LIBCPP_INLINE_VISIBILITY float sinh(float __lcpp_x) _NOEXCEPT {return ::sinhf(__lcpp_x);}
992inline _LIBCPP_INLINE_VISIBILITY long double sinh(long double __lcpp_x) _NOEXCEPT {return ::sinhl(__lcpp_x);}
Richard Smith4faa3942015-10-08 20:40:34 +0000993#endif
994
995template <class _A1>
996inline _LIBCPP_INLINE_VISIBILITY
997typename std::enable_if<std::is_integral<_A1>::value, double>::type
Mehdi Amini76661302017-02-10 02:44:23 +0000998sinh(_A1 __lcpp_x) _NOEXCEPT {return ::sinh((double)__lcpp_x);}
Richard Smith4faa3942015-10-08 20:40:34 +0000999
1000// sqrt
1001
Shoaib Meenai04b59f92017-04-07 02:20:52 +00001002#if !(defined(_AIX) || defined(__sun__))
Mehdi Amini76661302017-02-10 02:44:23 +00001003inline _LIBCPP_INLINE_VISIBILITY float sqrt(float __lcpp_x) _NOEXCEPT {return ::sqrtf(__lcpp_x);}
1004inline _LIBCPP_INLINE_VISIBILITY long double sqrt(long double __lcpp_x) _NOEXCEPT {return ::sqrtl(__lcpp_x);}
Richard Smith4faa3942015-10-08 20:40:34 +00001005#endif
1006
Richard Smith4faa3942015-10-08 20:40:34 +00001007template <class _A1>
1008inline _LIBCPP_INLINE_VISIBILITY
1009typename std::enable_if<std::is_integral<_A1>::value, double>::type
Mehdi Amini76661302017-02-10 02:44:23 +00001010sqrt(_A1 __lcpp_x) _NOEXCEPT {return ::sqrt((double)__lcpp_x);}
Richard Smith4faa3942015-10-08 20:40:34 +00001011
1012// tan
1013
Shoaib Meenai04b59f92017-04-07 02:20:52 +00001014#if !(defined(_AIX) || defined(__sun__))
Mehdi Amini76661302017-02-10 02:44:23 +00001015inline _LIBCPP_INLINE_VISIBILITY float tan(float __lcpp_x) _NOEXCEPT {return ::tanf(__lcpp_x);}
1016inline _LIBCPP_INLINE_VISIBILITY long double tan(long double __lcpp_x) _NOEXCEPT {return ::tanl(__lcpp_x);}
Richard Smith4faa3942015-10-08 20:40:34 +00001017#endif
1018
1019template <class _A1>
1020inline _LIBCPP_INLINE_VISIBILITY
1021typename std::enable_if<std::is_integral<_A1>::value, double>::type
Mehdi Amini76661302017-02-10 02:44:23 +00001022tan(_A1 __lcpp_x) _NOEXCEPT {return ::tan((double)__lcpp_x);}
Richard Smith4faa3942015-10-08 20:40:34 +00001023
1024// tanh
1025
Shoaib Meenai04b59f92017-04-07 02:20:52 +00001026#if !(defined(_AIX) || defined(__sun__))
Mehdi Amini76661302017-02-10 02:44:23 +00001027inline _LIBCPP_INLINE_VISIBILITY float tanh(float __lcpp_x) _NOEXCEPT {return ::tanhf(__lcpp_x);}
1028inline _LIBCPP_INLINE_VISIBILITY long double tanh(long double __lcpp_x) _NOEXCEPT {return ::tanhl(__lcpp_x);}
Richard Smith4faa3942015-10-08 20:40:34 +00001029#endif
1030
1031template <class _A1>
1032inline _LIBCPP_INLINE_VISIBILITY
1033typename std::enable_if<std::is_integral<_A1>::value, double>::type
Mehdi Amini76661302017-02-10 02:44:23 +00001034tanh(_A1 __lcpp_x) _NOEXCEPT {return ::tanh((double)__lcpp_x);}
Richard Smith4faa3942015-10-08 20:40:34 +00001035
1036// acosh
1037
Mehdi Amini76661302017-02-10 02:44:23 +00001038inline _LIBCPP_INLINE_VISIBILITY float acosh(float __lcpp_x) _NOEXCEPT {return ::acoshf(__lcpp_x);}
1039inline _LIBCPP_INLINE_VISIBILITY long double acosh(long double __lcpp_x) _NOEXCEPT {return ::acoshl(__lcpp_x);}
Richard Smith4faa3942015-10-08 20:40:34 +00001040
1041template <class _A1>
1042inline _LIBCPP_INLINE_VISIBILITY
1043typename std::enable_if<std::is_integral<_A1>::value, double>::type
Mehdi Amini76661302017-02-10 02:44:23 +00001044acosh(_A1 __lcpp_x) _NOEXCEPT {return ::acosh((double)__lcpp_x);}
Richard Smith4faa3942015-10-08 20:40:34 +00001045
1046// asinh
1047
Mehdi Amini76661302017-02-10 02:44:23 +00001048inline _LIBCPP_INLINE_VISIBILITY float asinh(float __lcpp_x) _NOEXCEPT {return ::asinhf(__lcpp_x);}
1049inline _LIBCPP_INLINE_VISIBILITY long double asinh(long double __lcpp_x) _NOEXCEPT {return ::asinhl(__lcpp_x);}
Richard Smith4faa3942015-10-08 20:40:34 +00001050
1051template <class _A1>
1052inline _LIBCPP_INLINE_VISIBILITY
1053typename std::enable_if<std::is_integral<_A1>::value, double>::type
Mehdi Amini76661302017-02-10 02:44:23 +00001054asinh(_A1 __lcpp_x) _NOEXCEPT {return ::asinh((double)__lcpp_x);}
Richard Smith4faa3942015-10-08 20:40:34 +00001055
1056// atanh
1057
Mehdi Amini76661302017-02-10 02:44:23 +00001058inline _LIBCPP_INLINE_VISIBILITY float atanh(float __lcpp_x) _NOEXCEPT {return ::atanhf(__lcpp_x);}
1059inline _LIBCPP_INLINE_VISIBILITY long double atanh(long double __lcpp_x) _NOEXCEPT {return ::atanhl(__lcpp_x);}
Richard Smith4faa3942015-10-08 20:40:34 +00001060
1061template <class _A1>
1062inline _LIBCPP_INLINE_VISIBILITY
1063typename std::enable_if<std::is_integral<_A1>::value, double>::type
Mehdi Amini76661302017-02-10 02:44:23 +00001064atanh(_A1 __lcpp_x) _NOEXCEPT {return ::atanh((double)__lcpp_x);}
Richard Smith4faa3942015-10-08 20:40:34 +00001065
1066// cbrt
1067
Mehdi Amini76661302017-02-10 02:44:23 +00001068inline _LIBCPP_INLINE_VISIBILITY float cbrt(float __lcpp_x) _NOEXCEPT {return ::cbrtf(__lcpp_x);}
1069inline _LIBCPP_INLINE_VISIBILITY long double cbrt(long double __lcpp_x) _NOEXCEPT {return ::cbrtl(__lcpp_x);}
Richard Smith4faa3942015-10-08 20:40:34 +00001070
1071template <class _A1>
1072inline _LIBCPP_INLINE_VISIBILITY
1073typename std::enable_if<std::is_integral<_A1>::value, double>::type
Mehdi Amini76661302017-02-10 02:44:23 +00001074cbrt(_A1 __lcpp_x) _NOEXCEPT {return ::cbrt((double)__lcpp_x);}
Richard Smith4faa3942015-10-08 20:40:34 +00001075
1076// copysign
1077
Richard Smith4faa3942015-10-08 20:40:34 +00001078inline _LIBCPP_INLINE_VISIBILITY float copysign(float __lcpp_x,
1079 float __lcpp_y) _NOEXCEPT {
Mehdi Amini76661302017-02-10 02:44:23 +00001080 return ::copysignf(__lcpp_x, __lcpp_y);
Richard Smith4faa3942015-10-08 20:40:34 +00001081}
1082inline _LIBCPP_INLINE_VISIBILITY long double
1083copysign(long double __lcpp_x, long double __lcpp_y) _NOEXCEPT {
Mehdi Amini76661302017-02-10 02:44:23 +00001084 return ::copysignl(__lcpp_x, __lcpp_y);
Richard Smith4faa3942015-10-08 20:40:34 +00001085}
Richard Smith4faa3942015-10-08 20:40:34 +00001086
1087template <class _A1, class _A2>
1088inline _LIBCPP_INLINE_VISIBILITY
1089typename std::__lazy_enable_if
1090<
1091 std::is_arithmetic<_A1>::value &&
1092 std::is_arithmetic<_A2>::value,
1093 std::__promote<_A1, _A2>
1094>::type
1095copysign(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
1096{
1097 typedef typename std::__promote<_A1, _A2>::type __result_type;
1098 static_assert((!(std::is_same<_A1, __result_type>::value &&
1099 std::is_same<_A2, __result_type>::value)), "");
Mehdi Amini76661302017-02-10 02:44:23 +00001100 return ::copysign((__result_type)__lcpp_x, (__result_type)__lcpp_y);
Richard Smith4faa3942015-10-08 20:40:34 +00001101}
1102
Richard Smith4faa3942015-10-08 20:40:34 +00001103// erf
1104
Mehdi Amini76661302017-02-10 02:44:23 +00001105inline _LIBCPP_INLINE_VISIBILITY float erf(float __lcpp_x) _NOEXCEPT {return ::erff(__lcpp_x);}
1106inline _LIBCPP_INLINE_VISIBILITY long double erf(long double __lcpp_x) _NOEXCEPT {return ::erfl(__lcpp_x);}
Richard Smith4faa3942015-10-08 20:40:34 +00001107
1108template <class _A1>
1109inline _LIBCPP_INLINE_VISIBILITY
1110typename std::enable_if<std::is_integral<_A1>::value, double>::type
Mehdi Amini76661302017-02-10 02:44:23 +00001111erf(_A1 __lcpp_x) _NOEXCEPT {return ::erf((double)__lcpp_x);}
Richard Smith4faa3942015-10-08 20:40:34 +00001112
1113// erfc
1114
Mehdi Amini76661302017-02-10 02:44:23 +00001115inline _LIBCPP_INLINE_VISIBILITY float erfc(float __lcpp_x) _NOEXCEPT {return ::erfcf(__lcpp_x);}
1116inline _LIBCPP_INLINE_VISIBILITY long double erfc(long double __lcpp_x) _NOEXCEPT {return ::erfcl(__lcpp_x);}
Richard Smith4faa3942015-10-08 20:40:34 +00001117
1118template <class _A1>
1119inline _LIBCPP_INLINE_VISIBILITY
1120typename std::enable_if<std::is_integral<_A1>::value, double>::type
Mehdi Amini76661302017-02-10 02:44:23 +00001121erfc(_A1 __lcpp_x) _NOEXCEPT {return ::erfc((double)__lcpp_x);}
Richard Smith4faa3942015-10-08 20:40:34 +00001122
1123// exp2
1124
Mehdi Amini76661302017-02-10 02:44:23 +00001125inline _LIBCPP_INLINE_VISIBILITY float exp2(float __lcpp_x) _NOEXCEPT {return ::exp2f(__lcpp_x);}
1126inline _LIBCPP_INLINE_VISIBILITY long double exp2(long double __lcpp_x) _NOEXCEPT {return ::exp2l(__lcpp_x);}
Richard Smith4faa3942015-10-08 20:40:34 +00001127
1128template <class _A1>
1129inline _LIBCPP_INLINE_VISIBILITY
1130typename std::enable_if<std::is_integral<_A1>::value, double>::type
Mehdi Amini76661302017-02-10 02:44:23 +00001131exp2(_A1 __lcpp_x) _NOEXCEPT {return ::exp2((double)__lcpp_x);}
Richard Smith4faa3942015-10-08 20:40:34 +00001132
1133// expm1
1134
Mehdi Amini76661302017-02-10 02:44:23 +00001135inline _LIBCPP_INLINE_VISIBILITY float expm1(float __lcpp_x) _NOEXCEPT {return ::expm1f(__lcpp_x);}
1136inline _LIBCPP_INLINE_VISIBILITY long double expm1(long double __lcpp_x) _NOEXCEPT {return ::expm1l(__lcpp_x);}
Richard Smith4faa3942015-10-08 20:40:34 +00001137
1138template <class _A1>
1139inline _LIBCPP_INLINE_VISIBILITY
1140typename std::enable_if<std::is_integral<_A1>::value, double>::type
Mehdi Amini76661302017-02-10 02:44:23 +00001141expm1(_A1 __lcpp_x) _NOEXCEPT {return ::expm1((double)__lcpp_x);}
Richard Smith4faa3942015-10-08 20:40:34 +00001142
1143// fdim
1144
Mehdi Amini76661302017-02-10 02:44:23 +00001145inline _LIBCPP_INLINE_VISIBILITY float fdim(float __lcpp_x, float __lcpp_y) _NOEXCEPT {return ::fdimf(__lcpp_x, __lcpp_y);}
1146inline _LIBCPP_INLINE_VISIBILITY long double fdim(long double __lcpp_x, long double __lcpp_y) _NOEXCEPT {return ::fdiml(__lcpp_x, __lcpp_y);}
Richard Smith4faa3942015-10-08 20:40:34 +00001147
1148template <class _A1, class _A2>
1149inline _LIBCPP_INLINE_VISIBILITY
1150typename std::__lazy_enable_if
1151<
1152 std::is_arithmetic<_A1>::value &&
1153 std::is_arithmetic<_A2>::value,
1154 std::__promote<_A1, _A2>
1155>::type
1156fdim(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
1157{
1158 typedef typename std::__promote<_A1, _A2>::type __result_type;
1159 static_assert((!(std::is_same<_A1, __result_type>::value &&
1160 std::is_same<_A2, __result_type>::value)), "");
Mehdi Amini76661302017-02-10 02:44:23 +00001161 return ::fdim((__result_type)__lcpp_x, (__result_type)__lcpp_y);
Richard Smith4faa3942015-10-08 20:40:34 +00001162}
1163
1164// fma
1165
Mehdi Amini76661302017-02-10 02:44:23 +00001166inline _LIBCPP_INLINE_VISIBILITY float fma(float __lcpp_x, float __lcpp_y, float __lcpp_z) _NOEXCEPT {return ::fmaf(__lcpp_x, __lcpp_y, __lcpp_z);}
1167inline _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 Smith4faa3942015-10-08 20:40:34 +00001168
1169template <class _A1, class _A2, class _A3>
1170inline _LIBCPP_INLINE_VISIBILITY
1171typename std::__lazy_enable_if
1172<
1173 std::is_arithmetic<_A1>::value &&
1174 std::is_arithmetic<_A2>::value &&
1175 std::is_arithmetic<_A3>::value,
1176 std::__promote<_A1, _A2, _A3>
1177>::type
1178fma(_A1 __lcpp_x, _A2 __lcpp_y, _A3 __lcpp_z) _NOEXCEPT
1179{
1180 typedef typename std::__promote<_A1, _A2, _A3>::type __result_type;
1181 static_assert((!(std::is_same<_A1, __result_type>::value &&
1182 std::is_same<_A2, __result_type>::value &&
1183 std::is_same<_A3, __result_type>::value)), "");
Mehdi Amini76661302017-02-10 02:44:23 +00001184 return ::fma((__result_type)__lcpp_x, (__result_type)__lcpp_y, (__result_type)__lcpp_z);
Richard Smith4faa3942015-10-08 20:40:34 +00001185}
1186
1187// fmax
1188
Mehdi Amini76661302017-02-10 02:44:23 +00001189inline _LIBCPP_INLINE_VISIBILITY float fmax(float __lcpp_x, float __lcpp_y) _NOEXCEPT {return ::fmaxf(__lcpp_x, __lcpp_y);}
1190inline _LIBCPP_INLINE_VISIBILITY long double fmax(long double __lcpp_x, long double __lcpp_y) _NOEXCEPT {return ::fmaxl(__lcpp_x, __lcpp_y);}
Richard Smith4faa3942015-10-08 20:40:34 +00001191
1192template <class _A1, class _A2>
1193inline _LIBCPP_INLINE_VISIBILITY
1194typename std::__lazy_enable_if
1195<
1196 std::is_arithmetic<_A1>::value &&
1197 std::is_arithmetic<_A2>::value,
1198 std::__promote<_A1, _A2>
1199>::type
1200fmax(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
1201{
1202 typedef typename std::__promote<_A1, _A2>::type __result_type;
1203 static_assert((!(std::is_same<_A1, __result_type>::value &&
1204 std::is_same<_A2, __result_type>::value)), "");
Mehdi Amini76661302017-02-10 02:44:23 +00001205 return ::fmax((__result_type)__lcpp_x, (__result_type)__lcpp_y);
Richard Smith4faa3942015-10-08 20:40:34 +00001206}
1207
1208// fmin
1209
Mehdi Amini76661302017-02-10 02:44:23 +00001210inline _LIBCPP_INLINE_VISIBILITY float fmin(float __lcpp_x, float __lcpp_y) _NOEXCEPT {return ::fminf(__lcpp_x, __lcpp_y);}
1211inline _LIBCPP_INLINE_VISIBILITY long double fmin(long double __lcpp_x, long double __lcpp_y) _NOEXCEPT {return ::fminl(__lcpp_x, __lcpp_y);}
Richard Smith4faa3942015-10-08 20:40:34 +00001212
1213template <class _A1, class _A2>
1214inline _LIBCPP_INLINE_VISIBILITY
1215typename std::__lazy_enable_if
1216<
1217 std::is_arithmetic<_A1>::value &&
1218 std::is_arithmetic<_A2>::value,
1219 std::__promote<_A1, _A2>
1220>::type
1221fmin(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
1222{
1223 typedef typename std::__promote<_A1, _A2>::type __result_type;
1224 static_assert((!(std::is_same<_A1, __result_type>::value &&
1225 std::is_same<_A2, __result_type>::value)), "");
Mehdi Amini76661302017-02-10 02:44:23 +00001226 return ::fmin((__result_type)__lcpp_x, (__result_type)__lcpp_y);
Richard Smith4faa3942015-10-08 20:40:34 +00001227}
1228
1229// hypot
1230
Mehdi Amini76661302017-02-10 02:44:23 +00001231inline _LIBCPP_INLINE_VISIBILITY float hypot(float __lcpp_x, float __lcpp_y) _NOEXCEPT {return ::hypotf(__lcpp_x, __lcpp_y);}
1232inline _LIBCPP_INLINE_VISIBILITY long double hypot(long double __lcpp_x, long double __lcpp_y) _NOEXCEPT {return ::hypotl(__lcpp_x, __lcpp_y);}
Richard Smith4faa3942015-10-08 20:40:34 +00001233
1234template <class _A1, class _A2>
1235inline _LIBCPP_INLINE_VISIBILITY
1236typename std::__lazy_enable_if
1237<
1238 std::is_arithmetic<_A1>::value &&
1239 std::is_arithmetic<_A2>::value,
1240 std::__promote<_A1, _A2>
1241>::type
1242hypot(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
1243{
1244 typedef typename std::__promote<_A1, _A2>::type __result_type;
1245 static_assert((!(std::is_same<_A1, __result_type>::value &&
1246 std::is_same<_A2, __result_type>::value)), "");
Mehdi Amini76661302017-02-10 02:44:23 +00001247 return ::hypot((__result_type)__lcpp_x, (__result_type)__lcpp_y);
Richard Smith4faa3942015-10-08 20:40:34 +00001248}
1249
1250// ilogb
1251
Mehdi Amini76661302017-02-10 02:44:23 +00001252inline _LIBCPP_INLINE_VISIBILITY int ilogb(float __lcpp_x) _NOEXCEPT {return ::ilogbf(__lcpp_x);}
1253inline _LIBCPP_INLINE_VISIBILITY int ilogb(long double __lcpp_x) _NOEXCEPT {return ::ilogbl(__lcpp_x);}
Richard Smith4faa3942015-10-08 20:40:34 +00001254
1255template <class _A1>
1256inline _LIBCPP_INLINE_VISIBILITY
1257typename std::enable_if<std::is_integral<_A1>::value, int>::type
Mehdi Amini76661302017-02-10 02:44:23 +00001258ilogb(_A1 __lcpp_x) _NOEXCEPT {return ::ilogb((double)__lcpp_x);}
Richard Smith4faa3942015-10-08 20:40:34 +00001259
1260// lgamma
1261
Mehdi Amini76661302017-02-10 02:44:23 +00001262inline _LIBCPP_INLINE_VISIBILITY float lgamma(float __lcpp_x) _NOEXCEPT {return ::lgammaf(__lcpp_x);}
1263inline _LIBCPP_INLINE_VISIBILITY long double lgamma(long double __lcpp_x) _NOEXCEPT {return ::lgammal(__lcpp_x);}
Richard Smith4faa3942015-10-08 20:40:34 +00001264
1265template <class _A1>
1266inline _LIBCPP_INLINE_VISIBILITY
1267typename std::enable_if<std::is_integral<_A1>::value, double>::type
Mehdi Amini76661302017-02-10 02:44:23 +00001268lgamma(_A1 __lcpp_x) _NOEXCEPT {return ::lgamma((double)__lcpp_x);}
Richard Smith4faa3942015-10-08 20:40:34 +00001269
1270// llrint
1271
Mehdi Amini76661302017-02-10 02:44:23 +00001272inline _LIBCPP_INLINE_VISIBILITY long long llrint(float __lcpp_x) _NOEXCEPT {return ::llrintf(__lcpp_x);}
1273inline _LIBCPP_INLINE_VISIBILITY long long llrint(long double __lcpp_x) _NOEXCEPT {return ::llrintl(__lcpp_x);}
Richard Smith4faa3942015-10-08 20:40:34 +00001274
1275template <class _A1>
1276inline _LIBCPP_INLINE_VISIBILITY
1277typename std::enable_if<std::is_integral<_A1>::value, long long>::type
Mehdi Amini76661302017-02-10 02:44:23 +00001278llrint(_A1 __lcpp_x) _NOEXCEPT {return ::llrint((double)__lcpp_x);}
Richard Smith4faa3942015-10-08 20:40:34 +00001279
1280// llround
1281
Mehdi Amini76661302017-02-10 02:44:23 +00001282inline _LIBCPP_INLINE_VISIBILITY long long llround(float __lcpp_x) _NOEXCEPT {return ::llroundf(__lcpp_x);}
1283inline _LIBCPP_INLINE_VISIBILITY long long llround(long double __lcpp_x) _NOEXCEPT {return ::llroundl(__lcpp_x);}
Richard Smith4faa3942015-10-08 20:40:34 +00001284
1285template <class _A1>
1286inline _LIBCPP_INLINE_VISIBILITY
1287typename std::enable_if<std::is_integral<_A1>::value, long long>::type
Mehdi Amini76661302017-02-10 02:44:23 +00001288llround(_A1 __lcpp_x) _NOEXCEPT {return ::llround((double)__lcpp_x);}
Richard Smith4faa3942015-10-08 20:40:34 +00001289
1290// log1p
1291
Mehdi Amini76661302017-02-10 02:44:23 +00001292inline _LIBCPP_INLINE_VISIBILITY float log1p(float __lcpp_x) _NOEXCEPT {return ::log1pf(__lcpp_x);}
1293inline _LIBCPP_INLINE_VISIBILITY long double log1p(long double __lcpp_x) _NOEXCEPT {return ::log1pl(__lcpp_x);}
Richard Smith4faa3942015-10-08 20:40:34 +00001294
1295template <class _A1>
1296inline _LIBCPP_INLINE_VISIBILITY
1297typename std::enable_if<std::is_integral<_A1>::value, double>::type
Mehdi Amini76661302017-02-10 02:44:23 +00001298log1p(_A1 __lcpp_x) _NOEXCEPT {return ::log1p((double)__lcpp_x);}
Richard Smith4faa3942015-10-08 20:40:34 +00001299
1300// log2
1301
Mehdi Amini76661302017-02-10 02:44:23 +00001302inline _LIBCPP_INLINE_VISIBILITY float log2(float __lcpp_x) _NOEXCEPT {return ::log2f(__lcpp_x);}
1303inline _LIBCPP_INLINE_VISIBILITY long double log2(long double __lcpp_x) _NOEXCEPT {return ::log2l(__lcpp_x);}
Richard Smith4faa3942015-10-08 20:40:34 +00001304
1305template <class _A1>
1306inline _LIBCPP_INLINE_VISIBILITY
1307typename std::enable_if<std::is_integral<_A1>::value, double>::type
Mehdi Amini76661302017-02-10 02:44:23 +00001308log2(_A1 __lcpp_x) _NOEXCEPT {return ::log2((double)__lcpp_x);}
Richard Smith4faa3942015-10-08 20:40:34 +00001309
1310// logb
1311
Mehdi Amini76661302017-02-10 02:44:23 +00001312inline _LIBCPP_INLINE_VISIBILITY float logb(float __lcpp_x) _NOEXCEPT {return ::logbf(__lcpp_x);}
1313inline _LIBCPP_INLINE_VISIBILITY long double logb(long double __lcpp_x) _NOEXCEPT {return ::logbl(__lcpp_x);}
Richard Smith4faa3942015-10-08 20:40:34 +00001314
1315template <class _A1>
1316inline _LIBCPP_INLINE_VISIBILITY
1317typename std::enable_if<std::is_integral<_A1>::value, double>::type
Mehdi Amini76661302017-02-10 02:44:23 +00001318logb(_A1 __lcpp_x) _NOEXCEPT {return ::logb((double)__lcpp_x);}
Richard Smith4faa3942015-10-08 20:40:34 +00001319
1320// lrint
1321
Mehdi Amini76661302017-02-10 02:44:23 +00001322inline _LIBCPP_INLINE_VISIBILITY long lrint(float __lcpp_x) _NOEXCEPT {return ::lrintf(__lcpp_x);}
1323inline _LIBCPP_INLINE_VISIBILITY long lrint(long double __lcpp_x) _NOEXCEPT {return ::lrintl(__lcpp_x);}
Richard Smith4faa3942015-10-08 20:40:34 +00001324
1325template <class _A1>
1326inline _LIBCPP_INLINE_VISIBILITY
1327typename std::enable_if<std::is_integral<_A1>::value, long>::type
Mehdi Amini76661302017-02-10 02:44:23 +00001328lrint(_A1 __lcpp_x) _NOEXCEPT {return ::lrint((double)__lcpp_x);}
Richard Smith4faa3942015-10-08 20:40:34 +00001329
1330// lround
1331
Mehdi Amini76661302017-02-10 02:44:23 +00001332inline _LIBCPP_INLINE_VISIBILITY long lround(float __lcpp_x) _NOEXCEPT {return ::lroundf(__lcpp_x);}
1333inline _LIBCPP_INLINE_VISIBILITY long lround(long double __lcpp_x) _NOEXCEPT {return ::lroundl(__lcpp_x);}
Richard Smith4faa3942015-10-08 20:40:34 +00001334
1335template <class _A1>
1336inline _LIBCPP_INLINE_VISIBILITY
1337typename std::enable_if<std::is_integral<_A1>::value, long>::type
Mehdi Amini76661302017-02-10 02:44:23 +00001338lround(_A1 __lcpp_x) _NOEXCEPT {return ::lround((double)__lcpp_x);}
Richard Smith4faa3942015-10-08 20:40:34 +00001339
1340// nan
1341
1342// nearbyint
1343
Mehdi Amini76661302017-02-10 02:44:23 +00001344inline _LIBCPP_INLINE_VISIBILITY float nearbyint(float __lcpp_x) _NOEXCEPT {return ::nearbyintf(__lcpp_x);}
1345inline _LIBCPP_INLINE_VISIBILITY long double nearbyint(long double __lcpp_x) _NOEXCEPT {return ::nearbyintl(__lcpp_x);}
Richard Smith4faa3942015-10-08 20:40:34 +00001346
1347template <class _A1>
1348inline _LIBCPP_INLINE_VISIBILITY
1349typename std::enable_if<std::is_integral<_A1>::value, double>::type
Mehdi Amini76661302017-02-10 02:44:23 +00001350nearbyint(_A1 __lcpp_x) _NOEXCEPT {return ::nearbyint((double)__lcpp_x);}
Richard Smith4faa3942015-10-08 20:40:34 +00001351
1352// nextafter
1353
Mehdi Amini76661302017-02-10 02:44:23 +00001354inline _LIBCPP_INLINE_VISIBILITY float nextafter(float __lcpp_x, float __lcpp_y) _NOEXCEPT {return ::nextafterf(__lcpp_x, __lcpp_y);}
1355inline _LIBCPP_INLINE_VISIBILITY long double nextafter(long double __lcpp_x, long double __lcpp_y) _NOEXCEPT {return ::nextafterl(__lcpp_x, __lcpp_y);}
Richard Smith4faa3942015-10-08 20:40:34 +00001356
1357template <class _A1, class _A2>
1358inline _LIBCPP_INLINE_VISIBILITY
1359typename std::__lazy_enable_if
1360<
1361 std::is_arithmetic<_A1>::value &&
1362 std::is_arithmetic<_A2>::value,
1363 std::__promote<_A1, _A2>
1364>::type
1365nextafter(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
1366{
1367 typedef typename std::__promote<_A1, _A2>::type __result_type;
1368 static_assert((!(std::is_same<_A1, __result_type>::value &&
1369 std::is_same<_A2, __result_type>::value)), "");
Mehdi Amini76661302017-02-10 02:44:23 +00001370 return ::nextafter((__result_type)__lcpp_x, (__result_type)__lcpp_y);
Richard Smith4faa3942015-10-08 20:40:34 +00001371}
1372
1373// nexttoward
1374
Mehdi Amini76661302017-02-10 02:44:23 +00001375inline _LIBCPP_INLINE_VISIBILITY float nexttoward(float __lcpp_x, long double __lcpp_y) _NOEXCEPT {return ::nexttowardf(__lcpp_x, __lcpp_y);}
1376inline _LIBCPP_INLINE_VISIBILITY long double nexttoward(long double __lcpp_x, long double __lcpp_y) _NOEXCEPT {return ::nexttowardl(__lcpp_x, __lcpp_y);}
Richard Smith4faa3942015-10-08 20:40:34 +00001377
1378template <class _A1>
1379inline _LIBCPP_INLINE_VISIBILITY
1380typename std::enable_if<std::is_integral<_A1>::value, double>::type
Mehdi Amini76661302017-02-10 02:44:23 +00001381nexttoward(_A1 __lcpp_x, long double __lcpp_y) _NOEXCEPT {return ::nexttoward((double)__lcpp_x, __lcpp_y);}
Richard Smith4faa3942015-10-08 20:40:34 +00001382
1383// remainder
1384
Mehdi Amini76661302017-02-10 02:44:23 +00001385inline _LIBCPP_INLINE_VISIBILITY float remainder(float __lcpp_x, float __lcpp_y) _NOEXCEPT {return ::remainderf(__lcpp_x, __lcpp_y);}
1386inline _LIBCPP_INLINE_VISIBILITY long double remainder(long double __lcpp_x, long double __lcpp_y) _NOEXCEPT {return ::remainderl(__lcpp_x, __lcpp_y);}
Richard Smith4faa3942015-10-08 20:40:34 +00001387
1388template <class _A1, class _A2>
1389inline _LIBCPP_INLINE_VISIBILITY
1390typename std::__lazy_enable_if
1391<
1392 std::is_arithmetic<_A1>::value &&
1393 std::is_arithmetic<_A2>::value,
1394 std::__promote<_A1, _A2>
1395>::type
1396remainder(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
1397{
1398 typedef typename std::__promote<_A1, _A2>::type __result_type;
1399 static_assert((!(std::is_same<_A1, __result_type>::value &&
1400 std::is_same<_A2, __result_type>::value)), "");
Mehdi Amini76661302017-02-10 02:44:23 +00001401 return ::remainder((__result_type)__lcpp_x, (__result_type)__lcpp_y);
Richard Smith4faa3942015-10-08 20:40:34 +00001402}
1403
1404// remquo
1405
Mehdi Amini76661302017-02-10 02:44:23 +00001406inline _LIBCPP_INLINE_VISIBILITY float remquo(float __lcpp_x, float __lcpp_y, int* __lcpp_z) _NOEXCEPT {return ::remquof(__lcpp_x, __lcpp_y, __lcpp_z);}
1407inline _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 Smith4faa3942015-10-08 20:40:34 +00001408
1409template <class _A1, class _A2>
1410inline _LIBCPP_INLINE_VISIBILITY
1411typename std::__lazy_enable_if
1412<
1413 std::is_arithmetic<_A1>::value &&
1414 std::is_arithmetic<_A2>::value,
1415 std::__promote<_A1, _A2>
1416>::type
1417remquo(_A1 __lcpp_x, _A2 __lcpp_y, int* __lcpp_z) _NOEXCEPT
1418{
1419 typedef typename std::__promote<_A1, _A2>::type __result_type;
1420 static_assert((!(std::is_same<_A1, __result_type>::value &&
1421 std::is_same<_A2, __result_type>::value)), "");
Mehdi Amini76661302017-02-10 02:44:23 +00001422 return ::remquo((__result_type)__lcpp_x, (__result_type)__lcpp_y, __lcpp_z);
Richard Smith4faa3942015-10-08 20:40:34 +00001423}
1424
1425// rint
1426
Mehdi Amini76661302017-02-10 02:44:23 +00001427inline _LIBCPP_INLINE_VISIBILITY float rint(float __lcpp_x) _NOEXCEPT {return ::rintf(__lcpp_x);}
1428inline _LIBCPP_INLINE_VISIBILITY long double rint(long double __lcpp_x) _NOEXCEPT {return ::rintl(__lcpp_x);}
Richard Smith4faa3942015-10-08 20:40:34 +00001429
1430template <class _A1>
1431inline _LIBCPP_INLINE_VISIBILITY
1432typename std::enable_if<std::is_integral<_A1>::value, double>::type
Mehdi Amini76661302017-02-10 02:44:23 +00001433rint(_A1 __lcpp_x) _NOEXCEPT {return ::rint((double)__lcpp_x);}
Richard Smith4faa3942015-10-08 20:40:34 +00001434
1435// round
1436
Mehdi Amini76661302017-02-10 02:44:23 +00001437inline _LIBCPP_INLINE_VISIBILITY float round(float __lcpp_x) _NOEXCEPT {return ::roundf(__lcpp_x);}
1438inline _LIBCPP_INLINE_VISIBILITY long double round(long double __lcpp_x) _NOEXCEPT {return ::roundl(__lcpp_x);}
Richard Smith4faa3942015-10-08 20:40:34 +00001439
1440template <class _A1>
1441inline _LIBCPP_INLINE_VISIBILITY
1442typename std::enable_if<std::is_integral<_A1>::value, double>::type
Mehdi Amini76661302017-02-10 02:44:23 +00001443round(_A1 __lcpp_x) _NOEXCEPT {return ::round((double)__lcpp_x);}
Richard Smith4faa3942015-10-08 20:40:34 +00001444
1445// scalbln
1446
Mehdi Amini76661302017-02-10 02:44:23 +00001447inline _LIBCPP_INLINE_VISIBILITY float scalbln(float __lcpp_x, long __lcpp_y) _NOEXCEPT {return ::scalblnf(__lcpp_x, __lcpp_y);}
1448inline _LIBCPP_INLINE_VISIBILITY long double scalbln(long double __lcpp_x, long __lcpp_y) _NOEXCEPT {return ::scalblnl(__lcpp_x, __lcpp_y);}
Richard Smith4faa3942015-10-08 20:40:34 +00001449
1450template <class _A1>
1451inline _LIBCPP_INLINE_VISIBILITY
1452typename std::enable_if<std::is_integral<_A1>::value, double>::type
Mehdi Amini76661302017-02-10 02:44:23 +00001453scalbln(_A1 __lcpp_x, long __lcpp_y) _NOEXCEPT {return ::scalbln((double)__lcpp_x, __lcpp_y);}
Richard Smith4faa3942015-10-08 20:40:34 +00001454
1455// scalbn
1456
Mehdi Amini76661302017-02-10 02:44:23 +00001457inline _LIBCPP_INLINE_VISIBILITY float scalbn(float __lcpp_x, int __lcpp_y) _NOEXCEPT {return ::scalbnf(__lcpp_x, __lcpp_y);}
1458inline _LIBCPP_INLINE_VISIBILITY long double scalbn(long double __lcpp_x, int __lcpp_y) _NOEXCEPT {return ::scalbnl(__lcpp_x, __lcpp_y);}
Richard Smith4faa3942015-10-08 20:40:34 +00001459
1460template <class _A1>
1461inline _LIBCPP_INLINE_VISIBILITY
1462typename std::enable_if<std::is_integral<_A1>::value, double>::type
Mehdi Amini76661302017-02-10 02:44:23 +00001463scalbn(_A1 __lcpp_x, int __lcpp_y) _NOEXCEPT {return ::scalbn((double)__lcpp_x, __lcpp_y);}
Richard Smith4faa3942015-10-08 20:40:34 +00001464
1465// tgamma
1466
Mehdi Amini76661302017-02-10 02:44:23 +00001467inline _LIBCPP_INLINE_VISIBILITY float tgamma(float __lcpp_x) _NOEXCEPT {return ::tgammaf(__lcpp_x);}
1468inline _LIBCPP_INLINE_VISIBILITY long double tgamma(long double __lcpp_x) _NOEXCEPT {return ::tgammal(__lcpp_x);}
Richard Smith4faa3942015-10-08 20:40:34 +00001469
1470template <class _A1>
1471inline _LIBCPP_INLINE_VISIBILITY
1472typename std::enable_if<std::is_integral<_A1>::value, double>::type
Mehdi Amini76661302017-02-10 02:44:23 +00001473tgamma(_A1 __lcpp_x) _NOEXCEPT {return ::tgamma((double)__lcpp_x);}
Richard Smith4faa3942015-10-08 20:40:34 +00001474
1475// trunc
1476
Mehdi Amini76661302017-02-10 02:44:23 +00001477inline _LIBCPP_INLINE_VISIBILITY float trunc(float __lcpp_x) _NOEXCEPT {return ::truncf(__lcpp_x);}
1478inline _LIBCPP_INLINE_VISIBILITY long double trunc(long double __lcpp_x) _NOEXCEPT {return ::truncl(__lcpp_x);}
Richard Smith4faa3942015-10-08 20:40:34 +00001479
1480template <class _A1>
1481inline _LIBCPP_INLINE_VISIBILITY
1482typename std::enable_if<std::is_integral<_A1>::value, double>::type
Mehdi Amini76661302017-02-10 02:44:23 +00001483trunc(_A1 __lcpp_x) _NOEXCEPT {return ::trunc((double)__lcpp_x);}
Richard Smith4faa3942015-10-08 20:40:34 +00001484
Richard Smith4faa3942015-10-08 20:40:34 +00001485} // extern "C++"
1486
1487#endif // __cplusplus
1488
1489#endif // _LIBCPP_MATH_H