blob: 79ebf2f119d7c59d455560fa694d47d70398aced [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
Richard Smith523b1722015-10-09 00:26:50 +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>
310
Richard Smith081bb592015-10-08 20:40:34 +0000311// signbit
312
313#ifdef signbit
314
315template <class _A1>
316_LIBCPP_ALWAYS_INLINE
317bool
318__libcpp_signbit(_A1 __lcpp_x) _NOEXCEPT
319{
320 return signbit(__lcpp_x);
321}
322
323#undef signbit
324
325template <class _A1>
326inline _LIBCPP_INLINE_VISIBILITY
327typename std::enable_if<std::is_arithmetic<_A1>::value, bool>::type
328signbit(_A1 __lcpp_x) _NOEXCEPT
329{
330 return __libcpp_signbit((typename std::__promote<_A1>::type)__lcpp_x);
331}
332
Shoaib Meenai159375f2017-04-07 02:20:52 +0000333#elif defined(_LIBCPP_MSVCRT)
Saleem Abdulrasool257256b2017-02-18 19:28:38 +0000334
335template <typename _A1>
336inline _LIBCPP_INLINE_VISIBILITY
337typename std::enable_if<std::is_arithmetic<_A1>::value, bool>::type
338signbit(_A1 __lcpp_x) _NOEXCEPT
339{
340 return ::signbit(static_cast<typename std::__promote<_A1>::type>(__lcpp_x));
341}
342
Richard Smith081bb592015-10-08 20:40:34 +0000343#endif // signbit
344
345// fpclassify
346
347#ifdef fpclassify
348
349template <class _A1>
350_LIBCPP_ALWAYS_INLINE
351int
352__libcpp_fpclassify(_A1 __lcpp_x) _NOEXCEPT
353{
354 return fpclassify(__lcpp_x);
355}
356
357#undef fpclassify
358
359template <class _A1>
360inline _LIBCPP_INLINE_VISIBILITY
361typename std::enable_if<std::is_arithmetic<_A1>::value, int>::type
362fpclassify(_A1 __lcpp_x) _NOEXCEPT
363{
364 return __libcpp_fpclassify((typename std::__promote<_A1>::type)__lcpp_x);
365}
366
Shoaib Meenai159375f2017-04-07 02:20:52 +0000367#elif defined(_LIBCPP_MSVCRT)
Saleem Abdulrasool257256b2017-02-18 19:28:38 +0000368
369template <typename _A1>
370inline _LIBCPP_INLINE_VISIBILITY
371typename std::enable_if<std::is_arithmetic<_A1>::value, int>::type
372fpclassify(_A1 __lcpp_x) _NOEXCEPT
373{
374 return ::fpclassify(static_cast<typename std::__promote<_A1>::type>(__lcpp_x));
375}
376
Richard Smith081bb592015-10-08 20:40:34 +0000377#endif // fpclassify
378
379// isfinite
380
381#ifdef isfinite
382
383template <class _A1>
384_LIBCPP_ALWAYS_INLINE
385bool
386__libcpp_isfinite(_A1 __lcpp_x) _NOEXCEPT
387{
388 return isfinite(__lcpp_x);
389}
390
391#undef isfinite
392
393template <class _A1>
394inline _LIBCPP_INLINE_VISIBILITY
395typename std::enable_if<std::is_arithmetic<_A1>::value, bool>::type
396isfinite(_A1 __lcpp_x) _NOEXCEPT
397{
398 return __libcpp_isfinite((typename std::__promote<_A1>::type)__lcpp_x);
399}
400
401#endif // isfinite
402
403// isinf
404
405#ifdef isinf
406
407template <class _A1>
408_LIBCPP_ALWAYS_INLINE
409bool
410__libcpp_isinf(_A1 __lcpp_x) _NOEXCEPT
411{
412 return isinf(__lcpp_x);
413}
414
415#undef isinf
416
417template <class _A1>
418inline _LIBCPP_INLINE_VISIBILITY
419typename std::enable_if<std::is_arithmetic<_A1>::value, bool>::type
420isinf(_A1 __lcpp_x) _NOEXCEPT
421{
422 return __libcpp_isinf((typename std::__promote<_A1>::type)__lcpp_x);
423}
424
425#endif // isinf
426
427// isnan
428
429#ifdef isnan
430
431template <class _A1>
432_LIBCPP_ALWAYS_INLINE
433bool
434__libcpp_isnan(_A1 __lcpp_x) _NOEXCEPT
435{
436 return isnan(__lcpp_x);
437}
438
439#undef isnan
440
441template <class _A1>
442inline _LIBCPP_INLINE_VISIBILITY
443typename std::enable_if<std::is_arithmetic<_A1>::value, bool>::type
444isnan(_A1 __lcpp_x) _NOEXCEPT
445{
446 return __libcpp_isnan((typename std::__promote<_A1>::type)__lcpp_x);
447}
448
449#endif // isnan
450
451// isnormal
452
453#ifdef isnormal
454
455template <class _A1>
456_LIBCPP_ALWAYS_INLINE
457bool
458__libcpp_isnormal(_A1 __lcpp_x) _NOEXCEPT
459{
460 return isnormal(__lcpp_x);
461}
462
463#undef isnormal
464
465template <class _A1>
466inline _LIBCPP_INLINE_VISIBILITY
467typename std::enable_if<std::is_arithmetic<_A1>::value, bool>::type
468isnormal(_A1 __lcpp_x) _NOEXCEPT
469{
470 return __libcpp_isnormal((typename std::__promote<_A1>::type)__lcpp_x);
471}
472
473#endif // isnormal
474
475// isgreater
476
477#ifdef isgreater
478
479template <class _A1, class _A2>
480_LIBCPP_ALWAYS_INLINE
481bool
482__libcpp_isgreater(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
483{
484 return isgreater(__lcpp_x, __lcpp_y);
485}
486
487#undef isgreater
488
489template <class _A1, class _A2>
490inline _LIBCPP_INLINE_VISIBILITY
491typename std::enable_if
492<
493 std::is_arithmetic<_A1>::value &&
494 std::is_arithmetic<_A2>::value,
495 bool
496>::type
497isgreater(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
498{
499 typedef typename std::__promote<_A1, _A2>::type type;
500 return __libcpp_isgreater((type)__lcpp_x, (type)__lcpp_y);
501}
502
503#endif // isgreater
504
505// isgreaterequal
506
507#ifdef isgreaterequal
508
509template <class _A1, class _A2>
510_LIBCPP_ALWAYS_INLINE
511bool
512__libcpp_isgreaterequal(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
513{
514 return isgreaterequal(__lcpp_x, __lcpp_y);
515}
516
517#undef isgreaterequal
518
519template <class _A1, class _A2>
520inline _LIBCPP_INLINE_VISIBILITY
521typename std::enable_if
522<
523 std::is_arithmetic<_A1>::value &&
524 std::is_arithmetic<_A2>::value,
525 bool
526>::type
527isgreaterequal(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
528{
529 typedef typename std::__promote<_A1, _A2>::type type;
530 return __libcpp_isgreaterequal((type)__lcpp_x, (type)__lcpp_y);
531}
532
533#endif // isgreaterequal
534
535// isless
536
537#ifdef isless
538
539template <class _A1, class _A2>
540_LIBCPP_ALWAYS_INLINE
541bool
542__libcpp_isless(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
543{
544 return isless(__lcpp_x, __lcpp_y);
545}
546
547#undef isless
548
549template <class _A1, class _A2>
550inline _LIBCPP_INLINE_VISIBILITY
551typename std::enable_if
552<
553 std::is_arithmetic<_A1>::value &&
554 std::is_arithmetic<_A2>::value,
555 bool
556>::type
557isless(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
558{
559 typedef typename std::__promote<_A1, _A2>::type type;
560 return __libcpp_isless((type)__lcpp_x, (type)__lcpp_y);
561}
562
563#endif // isless
564
565// islessequal
566
567#ifdef islessequal
568
569template <class _A1, class _A2>
570_LIBCPP_ALWAYS_INLINE
571bool
572__libcpp_islessequal(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
573{
574 return islessequal(__lcpp_x, __lcpp_y);
575}
576
577#undef islessequal
578
579template <class _A1, class _A2>
580inline _LIBCPP_INLINE_VISIBILITY
581typename std::enable_if
582<
583 std::is_arithmetic<_A1>::value &&
584 std::is_arithmetic<_A2>::value,
585 bool
586>::type
587islessequal(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
588{
589 typedef typename std::__promote<_A1, _A2>::type type;
590 return __libcpp_islessequal((type)__lcpp_x, (type)__lcpp_y);
591}
592
593#endif // islessequal
594
595// islessgreater
596
597#ifdef islessgreater
598
599template <class _A1, class _A2>
600_LIBCPP_ALWAYS_INLINE
601bool
602__libcpp_islessgreater(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
603{
604 return islessgreater(__lcpp_x, __lcpp_y);
605}
606
607#undef islessgreater
608
609template <class _A1, class _A2>
610inline _LIBCPP_INLINE_VISIBILITY
611typename std::enable_if
612<
613 std::is_arithmetic<_A1>::value &&
614 std::is_arithmetic<_A2>::value,
615 bool
616>::type
617islessgreater(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
618{
619 typedef typename std::__promote<_A1, _A2>::type type;
620 return __libcpp_islessgreater((type)__lcpp_x, (type)__lcpp_y);
621}
622
623#endif // islessgreater
624
625// isunordered
626
627#ifdef isunordered
628
629template <class _A1, class _A2>
630_LIBCPP_ALWAYS_INLINE
631bool
632__libcpp_isunordered(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
633{
634 return isunordered(__lcpp_x, __lcpp_y);
635}
636
637#undef isunordered
638
639template <class _A1, class _A2>
640inline _LIBCPP_INLINE_VISIBILITY
641typename std::enable_if
642<
643 std::is_arithmetic<_A1>::value &&
644 std::is_arithmetic<_A2>::value,
645 bool
646>::type
647isunordered(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
648{
649 typedef typename std::__promote<_A1, _A2>::type type;
650 return __libcpp_isunordered((type)__lcpp_x, (type)__lcpp_y);
651}
652
653#endif // isunordered
654
Richard Smith081bb592015-10-08 20:40:34 +0000655// abs
656
Eric Fiselier7d1aac92016-08-15 18:58:57 +0000657#if !(defined(_AIX) || defined(__sun__))
Richard Smith081bb592015-10-08 20:40:34 +0000658inline _LIBCPP_INLINE_VISIBILITY
659float
Mehdi Aminib3da6322017-02-10 02:44:23 +0000660abs(float __lcpp_x) _NOEXCEPT {return ::fabsf(__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +0000661
662inline _LIBCPP_INLINE_VISIBILITY
663double
Mehdi Aminib3da6322017-02-10 02:44:23 +0000664abs(double __lcpp_x) _NOEXCEPT {return ::fabs(__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +0000665
666inline _LIBCPP_INLINE_VISIBILITY
667long double
Mehdi Aminib3da6322017-02-10 02:44:23 +0000668abs(long double __lcpp_x) _NOEXCEPT {return ::fabsl(__lcpp_x);}
Eric Fiselier7d1aac92016-08-15 18:58:57 +0000669#endif // !(defined(_AIX) || defined(__sun__))
Richard Smith081bb592015-10-08 20:40:34 +0000670
671// acos
672
Shoaib Meenai159375f2017-04-07 02:20:52 +0000673#if !(defined(_AIX) || defined(__sun__))
Mehdi Aminib3da6322017-02-10 02:44:23 +0000674inline _LIBCPP_INLINE_VISIBILITY float acos(float __lcpp_x) _NOEXCEPT {return ::acosf(__lcpp_x);}
675inline _LIBCPP_INLINE_VISIBILITY long double acos(long double __lcpp_x) _NOEXCEPT {return ::acosl(__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +0000676#endif
677
678template <class _A1>
679inline _LIBCPP_INLINE_VISIBILITY
680typename std::enable_if<std::is_integral<_A1>::value, double>::type
Mehdi Aminib3da6322017-02-10 02:44:23 +0000681acos(_A1 __lcpp_x) _NOEXCEPT {return ::acos((double)__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +0000682
683// asin
684
Shoaib Meenai159375f2017-04-07 02:20:52 +0000685#if !(defined(_AIX) || defined(__sun__))
Mehdi Aminib3da6322017-02-10 02:44:23 +0000686inline _LIBCPP_INLINE_VISIBILITY float asin(float __lcpp_x) _NOEXCEPT {return ::asinf(__lcpp_x);}
687inline _LIBCPP_INLINE_VISIBILITY long double asin(long double __lcpp_x) _NOEXCEPT {return ::asinl(__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +0000688#endif
689
690template <class _A1>
691inline _LIBCPP_INLINE_VISIBILITY
692typename std::enable_if<std::is_integral<_A1>::value, double>::type
Mehdi Aminib3da6322017-02-10 02:44:23 +0000693asin(_A1 __lcpp_x) _NOEXCEPT {return ::asin((double)__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +0000694
695// atan
696
Shoaib Meenai159375f2017-04-07 02:20:52 +0000697#if !(defined(_AIX) || defined(__sun__))
Mehdi Aminib3da6322017-02-10 02:44:23 +0000698inline _LIBCPP_INLINE_VISIBILITY float atan(float __lcpp_x) _NOEXCEPT {return ::atanf(__lcpp_x);}
699inline _LIBCPP_INLINE_VISIBILITY long double atan(long double __lcpp_x) _NOEXCEPT {return ::atanl(__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +0000700#endif
701
702template <class _A1>
703inline _LIBCPP_INLINE_VISIBILITY
704typename std::enable_if<std::is_integral<_A1>::value, double>::type
Mehdi Aminib3da6322017-02-10 02:44:23 +0000705atan(_A1 __lcpp_x) _NOEXCEPT {return ::atan((double)__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +0000706
707// atan2
708
Shoaib Meenai159375f2017-04-07 02:20:52 +0000709#if !(defined(_AIX) || defined(__sun__))
Mehdi Aminib3da6322017-02-10 02:44:23 +0000710inline _LIBCPP_INLINE_VISIBILITY float atan2(float __lcpp_y, float __lcpp_x) _NOEXCEPT {return ::atan2f(__lcpp_y, __lcpp_x);}
711inline _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 +0000712#endif
713
714template <class _A1, class _A2>
715inline _LIBCPP_INLINE_VISIBILITY
716typename std::__lazy_enable_if
717<
718 std::is_arithmetic<_A1>::value &&
719 std::is_arithmetic<_A2>::value,
720 std::__promote<_A1, _A2>
721>::type
722atan2(_A1 __lcpp_y, _A2 __lcpp_x) _NOEXCEPT
723{
724 typedef typename std::__promote<_A1, _A2>::type __result_type;
725 static_assert((!(std::is_same<_A1, __result_type>::value &&
726 std::is_same<_A2, __result_type>::value)), "");
Mehdi Aminib3da6322017-02-10 02:44:23 +0000727 return ::atan2((__result_type)__lcpp_y, (__result_type)__lcpp_x);
Richard Smith081bb592015-10-08 20:40:34 +0000728}
729
730// ceil
731
Shoaib Meenai159375f2017-04-07 02:20:52 +0000732#if !(defined(_AIX) || defined(__sun__))
Mehdi Aminib3da6322017-02-10 02:44:23 +0000733inline _LIBCPP_INLINE_VISIBILITY float ceil(float __lcpp_x) _NOEXCEPT {return ::ceilf(__lcpp_x);}
734inline _LIBCPP_INLINE_VISIBILITY long double ceil(long double __lcpp_x) _NOEXCEPT {return ::ceill(__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +0000735#endif
736
737template <class _A1>
738inline _LIBCPP_INLINE_VISIBILITY
739typename std::enable_if<std::is_integral<_A1>::value, double>::type
Mehdi Aminib3da6322017-02-10 02:44:23 +0000740ceil(_A1 __lcpp_x) _NOEXCEPT {return ::ceil((double)__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +0000741
742// cos
743
Shoaib Meenai159375f2017-04-07 02:20:52 +0000744#if !(defined(_AIX) || defined(__sun__))
Mehdi Aminib3da6322017-02-10 02:44:23 +0000745inline _LIBCPP_INLINE_VISIBILITY float cos(float __lcpp_x) _NOEXCEPT {return ::cosf(__lcpp_x);}
746inline _LIBCPP_INLINE_VISIBILITY long double cos(long double __lcpp_x) _NOEXCEPT {return ::cosl(__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +0000747#endif
748
749template <class _A1>
750inline _LIBCPP_INLINE_VISIBILITY
751typename std::enable_if<std::is_integral<_A1>::value, double>::type
Mehdi Aminib3da6322017-02-10 02:44:23 +0000752cos(_A1 __lcpp_x) _NOEXCEPT {return ::cos((double)__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +0000753
754// cosh
755
Shoaib Meenai159375f2017-04-07 02:20:52 +0000756#if !(defined(_AIX) || defined(__sun__))
Mehdi Aminib3da6322017-02-10 02:44:23 +0000757inline _LIBCPP_INLINE_VISIBILITY float cosh(float __lcpp_x) _NOEXCEPT {return ::coshf(__lcpp_x);}
758inline _LIBCPP_INLINE_VISIBILITY long double cosh(long double __lcpp_x) _NOEXCEPT {return ::coshl(__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +0000759#endif
760
761template <class _A1>
762inline _LIBCPP_INLINE_VISIBILITY
763typename std::enable_if<std::is_integral<_A1>::value, double>::type
Mehdi Aminib3da6322017-02-10 02:44:23 +0000764cosh(_A1 __lcpp_x) _NOEXCEPT {return ::cosh((double)__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +0000765
766// exp
767
Shoaib Meenai159375f2017-04-07 02:20:52 +0000768#if !(defined(_AIX) || defined(__sun__))
Mehdi Aminib3da6322017-02-10 02:44:23 +0000769inline _LIBCPP_INLINE_VISIBILITY float exp(float __lcpp_x) _NOEXCEPT {return ::expf(__lcpp_x);}
770inline _LIBCPP_INLINE_VISIBILITY long double exp(long double __lcpp_x) _NOEXCEPT {return ::expl(__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +0000771#endif
772
773template <class _A1>
774inline _LIBCPP_INLINE_VISIBILITY
775typename std::enable_if<std::is_integral<_A1>::value, double>::type
Mehdi Aminib3da6322017-02-10 02:44:23 +0000776exp(_A1 __lcpp_x) _NOEXCEPT {return ::exp((double)__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +0000777
778// fabs
779
Shoaib Meenai159375f2017-04-07 02:20:52 +0000780#if !(defined(_AIX) || defined(__sun__))
Mehdi Aminib3da6322017-02-10 02:44:23 +0000781inline _LIBCPP_INLINE_VISIBILITY float fabs(float __lcpp_x) _NOEXCEPT {return ::fabsf(__lcpp_x);}
782inline _LIBCPP_INLINE_VISIBILITY long double fabs(long double __lcpp_x) _NOEXCEPT {return ::fabsl(__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +0000783#endif
784
785template <class _A1>
786inline _LIBCPP_INLINE_VISIBILITY
787typename std::enable_if<std::is_integral<_A1>::value, double>::type
Mehdi Aminib3da6322017-02-10 02:44:23 +0000788fabs(_A1 __lcpp_x) _NOEXCEPT {return ::fabs((double)__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +0000789
790// floor
791
Shoaib Meenai159375f2017-04-07 02:20:52 +0000792#if !(defined(_AIX) || defined(__sun__))
Mehdi Aminib3da6322017-02-10 02:44:23 +0000793inline _LIBCPP_INLINE_VISIBILITY float floor(float __lcpp_x) _NOEXCEPT {return ::floorf(__lcpp_x);}
794inline _LIBCPP_INLINE_VISIBILITY long double floor(long double __lcpp_x) _NOEXCEPT {return ::floorl(__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +0000795#endif
796
797template <class _A1>
798inline _LIBCPP_INLINE_VISIBILITY
799typename std::enable_if<std::is_integral<_A1>::value, double>::type
Mehdi Aminib3da6322017-02-10 02:44:23 +0000800floor(_A1 __lcpp_x) _NOEXCEPT {return ::floor((double)__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +0000801
802// fmod
803
Shoaib Meenai159375f2017-04-07 02:20:52 +0000804#if !(defined(_AIX) || defined(__sun__))
Mehdi Aminib3da6322017-02-10 02:44:23 +0000805inline _LIBCPP_INLINE_VISIBILITY float fmod(float __lcpp_x, float __lcpp_y) _NOEXCEPT {return ::fmodf(__lcpp_x, __lcpp_y);}
806inline _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 +0000807#endif
808
809template <class _A1, class _A2>
810inline _LIBCPP_INLINE_VISIBILITY
811typename std::__lazy_enable_if
812<
813 std::is_arithmetic<_A1>::value &&
814 std::is_arithmetic<_A2>::value,
815 std::__promote<_A1, _A2>
816>::type
817fmod(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
818{
819 typedef typename std::__promote<_A1, _A2>::type __result_type;
820 static_assert((!(std::is_same<_A1, __result_type>::value &&
821 std::is_same<_A2, __result_type>::value)), "");
Mehdi Aminib3da6322017-02-10 02:44:23 +0000822 return ::fmod((__result_type)__lcpp_x, (__result_type)__lcpp_y);
Richard Smith081bb592015-10-08 20:40:34 +0000823}
824
825// frexp
826
Shoaib Meenai159375f2017-04-07 02:20:52 +0000827#if !(defined(_AIX) || defined(__sun__))
Mehdi Aminib3da6322017-02-10 02:44:23 +0000828inline _LIBCPP_INLINE_VISIBILITY float frexp(float __lcpp_x, int* __lcpp_e) _NOEXCEPT {return ::frexpf(__lcpp_x, __lcpp_e);}
829inline _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 +0000830#endif
831
832template <class _A1>
833inline _LIBCPP_INLINE_VISIBILITY
834typename std::enable_if<std::is_integral<_A1>::value, double>::type
Mehdi Aminib3da6322017-02-10 02:44:23 +0000835frexp(_A1 __lcpp_x, int* __lcpp_e) _NOEXCEPT {return ::frexp((double)__lcpp_x, __lcpp_e);}
Richard Smith081bb592015-10-08 20:40:34 +0000836
837// ldexp
838
Shoaib Meenai159375f2017-04-07 02:20:52 +0000839#if !(defined(_AIX) || defined(__sun__))
Mehdi Aminib3da6322017-02-10 02:44:23 +0000840inline _LIBCPP_INLINE_VISIBILITY float ldexp(float __lcpp_x, int __lcpp_e) _NOEXCEPT {return ::ldexpf(__lcpp_x, __lcpp_e);}
841inline _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 +0000842#endif
843
844template <class _A1>
845inline _LIBCPP_INLINE_VISIBILITY
846typename std::enable_if<std::is_integral<_A1>::value, double>::type
Mehdi Aminib3da6322017-02-10 02:44:23 +0000847ldexp(_A1 __lcpp_x, int __lcpp_e) _NOEXCEPT {return ::ldexp((double)__lcpp_x, __lcpp_e);}
Richard Smith081bb592015-10-08 20:40:34 +0000848
849// log
850
Shoaib Meenai159375f2017-04-07 02:20:52 +0000851#if !(defined(_AIX) || defined(__sun__))
Mehdi Aminib3da6322017-02-10 02:44:23 +0000852inline _LIBCPP_INLINE_VISIBILITY float log(float __lcpp_x) _NOEXCEPT {return ::logf(__lcpp_x);}
853inline _LIBCPP_INLINE_VISIBILITY long double log(long double __lcpp_x) _NOEXCEPT {return ::logl(__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +0000854#endif
855
856template <class _A1>
857inline _LIBCPP_INLINE_VISIBILITY
858typename std::enable_if<std::is_integral<_A1>::value, double>::type
Mehdi Aminib3da6322017-02-10 02:44:23 +0000859log(_A1 __lcpp_x) _NOEXCEPT {return ::log((double)__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +0000860
861// log10
862
Shoaib Meenai159375f2017-04-07 02:20:52 +0000863#if !(defined(_AIX) || defined(__sun__))
Mehdi Aminib3da6322017-02-10 02:44:23 +0000864inline _LIBCPP_INLINE_VISIBILITY float log10(float __lcpp_x) _NOEXCEPT {return ::log10f(__lcpp_x);}
865inline _LIBCPP_INLINE_VISIBILITY long double log10(long double __lcpp_x) _NOEXCEPT {return ::log10l(__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +0000866#endif
867
868template <class _A1>
869inline _LIBCPP_INLINE_VISIBILITY
870typename std::enable_if<std::is_integral<_A1>::value, double>::type
Mehdi Aminib3da6322017-02-10 02:44:23 +0000871log10(_A1 __lcpp_x) _NOEXCEPT {return ::log10((double)__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +0000872
873// modf
874
Shoaib Meenai159375f2017-04-07 02:20:52 +0000875#if !(defined(_AIX) || defined(__sun__))
Mehdi Aminib3da6322017-02-10 02:44:23 +0000876inline _LIBCPP_INLINE_VISIBILITY float modf(float __lcpp_x, float* __lcpp_y) _NOEXCEPT {return ::modff(__lcpp_x, __lcpp_y);}
877inline _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 +0000878#endif
879
880// pow
881
Shoaib Meenai159375f2017-04-07 02:20:52 +0000882#if !(defined(_AIX) || defined(__sun__))
Mehdi Aminib3da6322017-02-10 02:44:23 +0000883inline _LIBCPP_INLINE_VISIBILITY float pow(float __lcpp_x, float __lcpp_y) _NOEXCEPT {return ::powf(__lcpp_x, __lcpp_y);}
884inline _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 +0000885#endif
886
887template <class _A1, class _A2>
888inline _LIBCPP_INLINE_VISIBILITY
889typename std::__lazy_enable_if
890<
891 std::is_arithmetic<_A1>::value &&
892 std::is_arithmetic<_A2>::value,
893 std::__promote<_A1, _A2>
894>::type
895pow(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
896{
897 typedef typename std::__promote<_A1, _A2>::type __result_type;
898 static_assert((!(std::is_same<_A1, __result_type>::value &&
899 std::is_same<_A2, __result_type>::value)), "");
Mehdi Aminib3da6322017-02-10 02:44:23 +0000900 return ::pow((__result_type)__lcpp_x, (__result_type)__lcpp_y);
Richard Smith081bb592015-10-08 20:40:34 +0000901}
902
903// sin
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 sin(float __lcpp_x) _NOEXCEPT {return ::sinf(__lcpp_x);}
907inline _LIBCPP_INLINE_VISIBILITY long double sin(long double __lcpp_x) _NOEXCEPT {return ::sinl(__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +0000908#endif
909
910template <class _A1>
911inline _LIBCPP_INLINE_VISIBILITY
912typename std::enable_if<std::is_integral<_A1>::value, double>::type
Mehdi Aminib3da6322017-02-10 02:44:23 +0000913sin(_A1 __lcpp_x) _NOEXCEPT {return ::sin((double)__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +0000914
915// sinh
916
Shoaib Meenai159375f2017-04-07 02:20:52 +0000917#if !(defined(_AIX) || defined(__sun__))
Mehdi Aminib3da6322017-02-10 02:44:23 +0000918inline _LIBCPP_INLINE_VISIBILITY float sinh(float __lcpp_x) _NOEXCEPT {return ::sinhf(__lcpp_x);}
919inline _LIBCPP_INLINE_VISIBILITY long double sinh(long double __lcpp_x) _NOEXCEPT {return ::sinhl(__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +0000920#endif
921
922template <class _A1>
923inline _LIBCPP_INLINE_VISIBILITY
924typename std::enable_if<std::is_integral<_A1>::value, double>::type
Mehdi Aminib3da6322017-02-10 02:44:23 +0000925sinh(_A1 __lcpp_x) _NOEXCEPT {return ::sinh((double)__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +0000926
927// sqrt
928
Shoaib Meenai159375f2017-04-07 02:20:52 +0000929#if !(defined(_AIX) || defined(__sun__))
Mehdi Aminib3da6322017-02-10 02:44:23 +0000930inline _LIBCPP_INLINE_VISIBILITY float sqrt(float __lcpp_x) _NOEXCEPT {return ::sqrtf(__lcpp_x);}
931inline _LIBCPP_INLINE_VISIBILITY long double sqrt(long double __lcpp_x) _NOEXCEPT {return ::sqrtl(__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +0000932#endif
933
Richard Smith081bb592015-10-08 20:40:34 +0000934template <class _A1>
935inline _LIBCPP_INLINE_VISIBILITY
936typename std::enable_if<std::is_integral<_A1>::value, double>::type
Mehdi Aminib3da6322017-02-10 02:44:23 +0000937sqrt(_A1 __lcpp_x) _NOEXCEPT {return ::sqrt((double)__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +0000938
939// tan
940
Shoaib Meenai159375f2017-04-07 02:20:52 +0000941#if !(defined(_AIX) || defined(__sun__))
Mehdi Aminib3da6322017-02-10 02:44:23 +0000942inline _LIBCPP_INLINE_VISIBILITY float tan(float __lcpp_x) _NOEXCEPT {return ::tanf(__lcpp_x);}
943inline _LIBCPP_INLINE_VISIBILITY long double tan(long double __lcpp_x) _NOEXCEPT {return ::tanl(__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +0000944#endif
945
946template <class _A1>
947inline _LIBCPP_INLINE_VISIBILITY
948typename std::enable_if<std::is_integral<_A1>::value, double>::type
Mehdi Aminib3da6322017-02-10 02:44:23 +0000949tan(_A1 __lcpp_x) _NOEXCEPT {return ::tan((double)__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +0000950
951// tanh
952
Shoaib Meenai159375f2017-04-07 02:20:52 +0000953#if !(defined(_AIX) || defined(__sun__))
Mehdi Aminib3da6322017-02-10 02:44:23 +0000954inline _LIBCPP_INLINE_VISIBILITY float tanh(float __lcpp_x) _NOEXCEPT {return ::tanhf(__lcpp_x);}
955inline _LIBCPP_INLINE_VISIBILITY long double tanh(long double __lcpp_x) _NOEXCEPT {return ::tanhl(__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +0000956#endif
957
958template <class _A1>
959inline _LIBCPP_INLINE_VISIBILITY
960typename std::enable_if<std::is_integral<_A1>::value, double>::type
Mehdi Aminib3da6322017-02-10 02:44:23 +0000961tanh(_A1 __lcpp_x) _NOEXCEPT {return ::tanh((double)__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +0000962
963// acosh
964
Mehdi Aminib3da6322017-02-10 02:44:23 +0000965inline _LIBCPP_INLINE_VISIBILITY float acosh(float __lcpp_x) _NOEXCEPT {return ::acoshf(__lcpp_x);}
966inline _LIBCPP_INLINE_VISIBILITY long double acosh(long double __lcpp_x) _NOEXCEPT {return ::acoshl(__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +0000967
968template <class _A1>
969inline _LIBCPP_INLINE_VISIBILITY
970typename std::enable_if<std::is_integral<_A1>::value, double>::type
Mehdi Aminib3da6322017-02-10 02:44:23 +0000971acosh(_A1 __lcpp_x) _NOEXCEPT {return ::acosh((double)__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +0000972
973// asinh
974
Mehdi Aminib3da6322017-02-10 02:44:23 +0000975inline _LIBCPP_INLINE_VISIBILITY float asinh(float __lcpp_x) _NOEXCEPT {return ::asinhf(__lcpp_x);}
976inline _LIBCPP_INLINE_VISIBILITY long double asinh(long double __lcpp_x) _NOEXCEPT {return ::asinhl(__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +0000977
978template <class _A1>
979inline _LIBCPP_INLINE_VISIBILITY
980typename std::enable_if<std::is_integral<_A1>::value, double>::type
Mehdi Aminib3da6322017-02-10 02:44:23 +0000981asinh(_A1 __lcpp_x) _NOEXCEPT {return ::asinh((double)__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +0000982
983// atanh
984
Mehdi Aminib3da6322017-02-10 02:44:23 +0000985inline _LIBCPP_INLINE_VISIBILITY float atanh(float __lcpp_x) _NOEXCEPT {return ::atanhf(__lcpp_x);}
986inline _LIBCPP_INLINE_VISIBILITY long double atanh(long double __lcpp_x) _NOEXCEPT {return ::atanhl(__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +0000987
988template <class _A1>
989inline _LIBCPP_INLINE_VISIBILITY
990typename std::enable_if<std::is_integral<_A1>::value, double>::type
Mehdi Aminib3da6322017-02-10 02:44:23 +0000991atanh(_A1 __lcpp_x) _NOEXCEPT {return ::atanh((double)__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +0000992
993// cbrt
994
Mehdi Aminib3da6322017-02-10 02:44:23 +0000995inline _LIBCPP_INLINE_VISIBILITY float cbrt(float __lcpp_x) _NOEXCEPT {return ::cbrtf(__lcpp_x);}
996inline _LIBCPP_INLINE_VISIBILITY long double cbrt(long double __lcpp_x) _NOEXCEPT {return ::cbrtl(__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +0000997
998template <class _A1>
999inline _LIBCPP_INLINE_VISIBILITY
1000typename std::enable_if<std::is_integral<_A1>::value, double>::type
Mehdi Aminib3da6322017-02-10 02:44:23 +00001001cbrt(_A1 __lcpp_x) _NOEXCEPT {return ::cbrt((double)__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +00001002
1003// copysign
1004
Richard Smith081bb592015-10-08 20:40:34 +00001005inline _LIBCPP_INLINE_VISIBILITY float copysign(float __lcpp_x,
1006 float __lcpp_y) _NOEXCEPT {
Mehdi Aminib3da6322017-02-10 02:44:23 +00001007 return ::copysignf(__lcpp_x, __lcpp_y);
Richard Smith081bb592015-10-08 20:40:34 +00001008}
1009inline _LIBCPP_INLINE_VISIBILITY long double
1010copysign(long double __lcpp_x, long double __lcpp_y) _NOEXCEPT {
Mehdi Aminib3da6322017-02-10 02:44:23 +00001011 return ::copysignl(__lcpp_x, __lcpp_y);
Richard Smith081bb592015-10-08 20:40:34 +00001012}
Richard Smith081bb592015-10-08 20:40:34 +00001013
1014template <class _A1, class _A2>
1015inline _LIBCPP_INLINE_VISIBILITY
1016typename std::__lazy_enable_if
1017<
1018 std::is_arithmetic<_A1>::value &&
1019 std::is_arithmetic<_A2>::value,
1020 std::__promote<_A1, _A2>
1021>::type
1022copysign(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
1023{
1024 typedef typename std::__promote<_A1, _A2>::type __result_type;
1025 static_assert((!(std::is_same<_A1, __result_type>::value &&
1026 std::is_same<_A2, __result_type>::value)), "");
Mehdi Aminib3da6322017-02-10 02:44:23 +00001027 return ::copysign((__result_type)__lcpp_x, (__result_type)__lcpp_y);
Richard Smith081bb592015-10-08 20:40:34 +00001028}
1029
Richard Smith081bb592015-10-08 20:40:34 +00001030// erf
1031
Mehdi Aminib3da6322017-02-10 02:44:23 +00001032inline _LIBCPP_INLINE_VISIBILITY float erf(float __lcpp_x) _NOEXCEPT {return ::erff(__lcpp_x);}
1033inline _LIBCPP_INLINE_VISIBILITY long double erf(long double __lcpp_x) _NOEXCEPT {return ::erfl(__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +00001034
1035template <class _A1>
1036inline _LIBCPP_INLINE_VISIBILITY
1037typename std::enable_if<std::is_integral<_A1>::value, double>::type
Mehdi Aminib3da6322017-02-10 02:44:23 +00001038erf(_A1 __lcpp_x) _NOEXCEPT {return ::erf((double)__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +00001039
1040// erfc
1041
Mehdi Aminib3da6322017-02-10 02:44:23 +00001042inline _LIBCPP_INLINE_VISIBILITY float erfc(float __lcpp_x) _NOEXCEPT {return ::erfcf(__lcpp_x);}
1043inline _LIBCPP_INLINE_VISIBILITY long double erfc(long double __lcpp_x) _NOEXCEPT {return ::erfcl(__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +00001044
1045template <class _A1>
1046inline _LIBCPP_INLINE_VISIBILITY
1047typename std::enable_if<std::is_integral<_A1>::value, double>::type
Mehdi Aminib3da6322017-02-10 02:44:23 +00001048erfc(_A1 __lcpp_x) _NOEXCEPT {return ::erfc((double)__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +00001049
1050// exp2
1051
Mehdi Aminib3da6322017-02-10 02:44:23 +00001052inline _LIBCPP_INLINE_VISIBILITY float exp2(float __lcpp_x) _NOEXCEPT {return ::exp2f(__lcpp_x);}
1053inline _LIBCPP_INLINE_VISIBILITY long double exp2(long double __lcpp_x) _NOEXCEPT {return ::exp2l(__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +00001054
1055template <class _A1>
1056inline _LIBCPP_INLINE_VISIBILITY
1057typename std::enable_if<std::is_integral<_A1>::value, double>::type
Mehdi Aminib3da6322017-02-10 02:44:23 +00001058exp2(_A1 __lcpp_x) _NOEXCEPT {return ::exp2((double)__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +00001059
1060// expm1
1061
Mehdi Aminib3da6322017-02-10 02:44:23 +00001062inline _LIBCPP_INLINE_VISIBILITY float expm1(float __lcpp_x) _NOEXCEPT {return ::expm1f(__lcpp_x);}
1063inline _LIBCPP_INLINE_VISIBILITY long double expm1(long double __lcpp_x) _NOEXCEPT {return ::expm1l(__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +00001064
1065template <class _A1>
1066inline _LIBCPP_INLINE_VISIBILITY
1067typename std::enable_if<std::is_integral<_A1>::value, double>::type
Mehdi Aminib3da6322017-02-10 02:44:23 +00001068expm1(_A1 __lcpp_x) _NOEXCEPT {return ::expm1((double)__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +00001069
1070// fdim
1071
Mehdi Aminib3da6322017-02-10 02:44:23 +00001072inline _LIBCPP_INLINE_VISIBILITY float fdim(float __lcpp_x, float __lcpp_y) _NOEXCEPT {return ::fdimf(__lcpp_x, __lcpp_y);}
1073inline _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 +00001074
1075template <class _A1, class _A2>
1076inline _LIBCPP_INLINE_VISIBILITY
1077typename std::__lazy_enable_if
1078<
1079 std::is_arithmetic<_A1>::value &&
1080 std::is_arithmetic<_A2>::value,
1081 std::__promote<_A1, _A2>
1082>::type
1083fdim(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
1084{
1085 typedef typename std::__promote<_A1, _A2>::type __result_type;
1086 static_assert((!(std::is_same<_A1, __result_type>::value &&
1087 std::is_same<_A2, __result_type>::value)), "");
Mehdi Aminib3da6322017-02-10 02:44:23 +00001088 return ::fdim((__result_type)__lcpp_x, (__result_type)__lcpp_y);
Richard Smith081bb592015-10-08 20:40:34 +00001089}
1090
1091// fma
1092
Mehdi Aminib3da6322017-02-10 02:44:23 +00001093inline _LIBCPP_INLINE_VISIBILITY float fma(float __lcpp_x, float __lcpp_y, float __lcpp_z) _NOEXCEPT {return ::fmaf(__lcpp_x, __lcpp_y, __lcpp_z);}
1094inline _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 +00001095
1096template <class _A1, class _A2, class _A3>
1097inline _LIBCPP_INLINE_VISIBILITY
1098typename std::__lazy_enable_if
1099<
1100 std::is_arithmetic<_A1>::value &&
1101 std::is_arithmetic<_A2>::value &&
1102 std::is_arithmetic<_A3>::value,
1103 std::__promote<_A1, _A2, _A3>
1104>::type
1105fma(_A1 __lcpp_x, _A2 __lcpp_y, _A3 __lcpp_z) _NOEXCEPT
1106{
1107 typedef typename std::__promote<_A1, _A2, _A3>::type __result_type;
1108 static_assert((!(std::is_same<_A1, __result_type>::value &&
1109 std::is_same<_A2, __result_type>::value &&
1110 std::is_same<_A3, __result_type>::value)), "");
Mehdi Aminib3da6322017-02-10 02:44:23 +00001111 return ::fma((__result_type)__lcpp_x, (__result_type)__lcpp_y, (__result_type)__lcpp_z);
Richard Smith081bb592015-10-08 20:40:34 +00001112}
1113
1114// fmax
1115
Mehdi Aminib3da6322017-02-10 02:44:23 +00001116inline _LIBCPP_INLINE_VISIBILITY float fmax(float __lcpp_x, float __lcpp_y) _NOEXCEPT {return ::fmaxf(__lcpp_x, __lcpp_y);}
1117inline _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 +00001118
1119template <class _A1, class _A2>
1120inline _LIBCPP_INLINE_VISIBILITY
1121typename std::__lazy_enable_if
1122<
1123 std::is_arithmetic<_A1>::value &&
1124 std::is_arithmetic<_A2>::value,
1125 std::__promote<_A1, _A2>
1126>::type
1127fmax(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
1128{
1129 typedef typename std::__promote<_A1, _A2>::type __result_type;
1130 static_assert((!(std::is_same<_A1, __result_type>::value &&
1131 std::is_same<_A2, __result_type>::value)), "");
Mehdi Aminib3da6322017-02-10 02:44:23 +00001132 return ::fmax((__result_type)__lcpp_x, (__result_type)__lcpp_y);
Richard Smith081bb592015-10-08 20:40:34 +00001133}
1134
1135// fmin
1136
Mehdi Aminib3da6322017-02-10 02:44:23 +00001137inline _LIBCPP_INLINE_VISIBILITY float fmin(float __lcpp_x, float __lcpp_y) _NOEXCEPT {return ::fminf(__lcpp_x, __lcpp_y);}
1138inline _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 +00001139
1140template <class _A1, class _A2>
1141inline _LIBCPP_INLINE_VISIBILITY
1142typename std::__lazy_enable_if
1143<
1144 std::is_arithmetic<_A1>::value &&
1145 std::is_arithmetic<_A2>::value,
1146 std::__promote<_A1, _A2>
1147>::type
1148fmin(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
1149{
1150 typedef typename std::__promote<_A1, _A2>::type __result_type;
1151 static_assert((!(std::is_same<_A1, __result_type>::value &&
1152 std::is_same<_A2, __result_type>::value)), "");
Mehdi Aminib3da6322017-02-10 02:44:23 +00001153 return ::fmin((__result_type)__lcpp_x, (__result_type)__lcpp_y);
Richard Smith081bb592015-10-08 20:40:34 +00001154}
1155
1156// hypot
1157
Mehdi Aminib3da6322017-02-10 02:44:23 +00001158inline _LIBCPP_INLINE_VISIBILITY float hypot(float __lcpp_x, float __lcpp_y) _NOEXCEPT {return ::hypotf(__lcpp_x, __lcpp_y);}
1159inline _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 +00001160
1161template <class _A1, class _A2>
1162inline _LIBCPP_INLINE_VISIBILITY
1163typename std::__lazy_enable_if
1164<
1165 std::is_arithmetic<_A1>::value &&
1166 std::is_arithmetic<_A2>::value,
1167 std::__promote<_A1, _A2>
1168>::type
1169hypot(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
1170{
1171 typedef typename std::__promote<_A1, _A2>::type __result_type;
1172 static_assert((!(std::is_same<_A1, __result_type>::value &&
1173 std::is_same<_A2, __result_type>::value)), "");
Mehdi Aminib3da6322017-02-10 02:44:23 +00001174 return ::hypot((__result_type)__lcpp_x, (__result_type)__lcpp_y);
Richard Smith081bb592015-10-08 20:40:34 +00001175}
1176
1177// ilogb
1178
Mehdi Aminib3da6322017-02-10 02:44:23 +00001179inline _LIBCPP_INLINE_VISIBILITY int ilogb(float __lcpp_x) _NOEXCEPT {return ::ilogbf(__lcpp_x);}
1180inline _LIBCPP_INLINE_VISIBILITY int ilogb(long double __lcpp_x) _NOEXCEPT {return ::ilogbl(__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +00001181
1182template <class _A1>
1183inline _LIBCPP_INLINE_VISIBILITY
1184typename std::enable_if<std::is_integral<_A1>::value, int>::type
Mehdi Aminib3da6322017-02-10 02:44:23 +00001185ilogb(_A1 __lcpp_x) _NOEXCEPT {return ::ilogb((double)__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +00001186
1187// lgamma
1188
Mehdi Aminib3da6322017-02-10 02:44:23 +00001189inline _LIBCPP_INLINE_VISIBILITY float lgamma(float __lcpp_x) _NOEXCEPT {return ::lgammaf(__lcpp_x);}
1190inline _LIBCPP_INLINE_VISIBILITY long double lgamma(long double __lcpp_x) _NOEXCEPT {return ::lgammal(__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +00001191
1192template <class _A1>
1193inline _LIBCPP_INLINE_VISIBILITY
1194typename std::enable_if<std::is_integral<_A1>::value, double>::type
Mehdi Aminib3da6322017-02-10 02:44:23 +00001195lgamma(_A1 __lcpp_x) _NOEXCEPT {return ::lgamma((double)__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +00001196
1197// llrint
1198
Mehdi Aminib3da6322017-02-10 02:44:23 +00001199inline _LIBCPP_INLINE_VISIBILITY long long llrint(float __lcpp_x) _NOEXCEPT {return ::llrintf(__lcpp_x);}
1200inline _LIBCPP_INLINE_VISIBILITY long long llrint(long double __lcpp_x) _NOEXCEPT {return ::llrintl(__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +00001201
1202template <class _A1>
1203inline _LIBCPP_INLINE_VISIBILITY
1204typename std::enable_if<std::is_integral<_A1>::value, long long>::type
Mehdi Aminib3da6322017-02-10 02:44:23 +00001205llrint(_A1 __lcpp_x) _NOEXCEPT {return ::llrint((double)__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +00001206
1207// llround
1208
Mehdi Aminib3da6322017-02-10 02:44:23 +00001209inline _LIBCPP_INLINE_VISIBILITY long long llround(float __lcpp_x) _NOEXCEPT {return ::llroundf(__lcpp_x);}
1210inline _LIBCPP_INLINE_VISIBILITY long long llround(long double __lcpp_x) _NOEXCEPT {return ::llroundl(__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +00001211
1212template <class _A1>
1213inline _LIBCPP_INLINE_VISIBILITY
1214typename std::enable_if<std::is_integral<_A1>::value, long long>::type
Mehdi Aminib3da6322017-02-10 02:44:23 +00001215llround(_A1 __lcpp_x) _NOEXCEPT {return ::llround((double)__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +00001216
1217// log1p
1218
Mehdi Aminib3da6322017-02-10 02:44:23 +00001219inline _LIBCPP_INLINE_VISIBILITY float log1p(float __lcpp_x) _NOEXCEPT {return ::log1pf(__lcpp_x);}
1220inline _LIBCPP_INLINE_VISIBILITY long double log1p(long double __lcpp_x) _NOEXCEPT {return ::log1pl(__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +00001221
1222template <class _A1>
1223inline _LIBCPP_INLINE_VISIBILITY
1224typename std::enable_if<std::is_integral<_A1>::value, double>::type
Mehdi Aminib3da6322017-02-10 02:44:23 +00001225log1p(_A1 __lcpp_x) _NOEXCEPT {return ::log1p((double)__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +00001226
1227// log2
1228
Mehdi Aminib3da6322017-02-10 02:44:23 +00001229inline _LIBCPP_INLINE_VISIBILITY float log2(float __lcpp_x) _NOEXCEPT {return ::log2f(__lcpp_x);}
1230inline _LIBCPP_INLINE_VISIBILITY long double log2(long double __lcpp_x) _NOEXCEPT {return ::log2l(__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +00001231
1232template <class _A1>
1233inline _LIBCPP_INLINE_VISIBILITY
1234typename std::enable_if<std::is_integral<_A1>::value, double>::type
Mehdi Aminib3da6322017-02-10 02:44:23 +00001235log2(_A1 __lcpp_x) _NOEXCEPT {return ::log2((double)__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +00001236
1237// logb
1238
Mehdi Aminib3da6322017-02-10 02:44:23 +00001239inline _LIBCPP_INLINE_VISIBILITY float logb(float __lcpp_x) _NOEXCEPT {return ::logbf(__lcpp_x);}
1240inline _LIBCPP_INLINE_VISIBILITY long double logb(long double __lcpp_x) _NOEXCEPT {return ::logbl(__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +00001241
1242template <class _A1>
1243inline _LIBCPP_INLINE_VISIBILITY
1244typename std::enable_if<std::is_integral<_A1>::value, double>::type
Mehdi Aminib3da6322017-02-10 02:44:23 +00001245logb(_A1 __lcpp_x) _NOEXCEPT {return ::logb((double)__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +00001246
1247// lrint
1248
Mehdi Aminib3da6322017-02-10 02:44:23 +00001249inline _LIBCPP_INLINE_VISIBILITY long lrint(float __lcpp_x) _NOEXCEPT {return ::lrintf(__lcpp_x);}
1250inline _LIBCPP_INLINE_VISIBILITY long lrint(long double __lcpp_x) _NOEXCEPT {return ::lrintl(__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +00001251
1252template <class _A1>
1253inline _LIBCPP_INLINE_VISIBILITY
1254typename std::enable_if<std::is_integral<_A1>::value, long>::type
Mehdi Aminib3da6322017-02-10 02:44:23 +00001255lrint(_A1 __lcpp_x) _NOEXCEPT {return ::lrint((double)__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +00001256
1257// lround
1258
Mehdi Aminib3da6322017-02-10 02:44:23 +00001259inline _LIBCPP_INLINE_VISIBILITY long lround(float __lcpp_x) _NOEXCEPT {return ::lroundf(__lcpp_x);}
1260inline _LIBCPP_INLINE_VISIBILITY long lround(long double __lcpp_x) _NOEXCEPT {return ::lroundl(__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +00001261
1262template <class _A1>
1263inline _LIBCPP_INLINE_VISIBILITY
1264typename std::enable_if<std::is_integral<_A1>::value, long>::type
Mehdi Aminib3da6322017-02-10 02:44:23 +00001265lround(_A1 __lcpp_x) _NOEXCEPT {return ::lround((double)__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +00001266
1267// nan
1268
1269// nearbyint
1270
Mehdi Aminib3da6322017-02-10 02:44:23 +00001271inline _LIBCPP_INLINE_VISIBILITY float nearbyint(float __lcpp_x) _NOEXCEPT {return ::nearbyintf(__lcpp_x);}
1272inline _LIBCPP_INLINE_VISIBILITY long double nearbyint(long double __lcpp_x) _NOEXCEPT {return ::nearbyintl(__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +00001273
1274template <class _A1>
1275inline _LIBCPP_INLINE_VISIBILITY
1276typename std::enable_if<std::is_integral<_A1>::value, double>::type
Mehdi Aminib3da6322017-02-10 02:44:23 +00001277nearbyint(_A1 __lcpp_x) _NOEXCEPT {return ::nearbyint((double)__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +00001278
1279// nextafter
1280
Mehdi Aminib3da6322017-02-10 02:44:23 +00001281inline _LIBCPP_INLINE_VISIBILITY float nextafter(float __lcpp_x, float __lcpp_y) _NOEXCEPT {return ::nextafterf(__lcpp_x, __lcpp_y);}
1282inline _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 +00001283
1284template <class _A1, class _A2>
1285inline _LIBCPP_INLINE_VISIBILITY
1286typename std::__lazy_enable_if
1287<
1288 std::is_arithmetic<_A1>::value &&
1289 std::is_arithmetic<_A2>::value,
1290 std::__promote<_A1, _A2>
1291>::type
1292nextafter(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
1293{
1294 typedef typename std::__promote<_A1, _A2>::type __result_type;
1295 static_assert((!(std::is_same<_A1, __result_type>::value &&
1296 std::is_same<_A2, __result_type>::value)), "");
Mehdi Aminib3da6322017-02-10 02:44:23 +00001297 return ::nextafter((__result_type)__lcpp_x, (__result_type)__lcpp_y);
Richard Smith081bb592015-10-08 20:40:34 +00001298}
1299
1300// nexttoward
1301
Mehdi Aminib3da6322017-02-10 02:44:23 +00001302inline _LIBCPP_INLINE_VISIBILITY float nexttoward(float __lcpp_x, long double __lcpp_y) _NOEXCEPT {return ::nexttowardf(__lcpp_x, __lcpp_y);}
1303inline _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 +00001304
1305template <class _A1>
1306inline _LIBCPP_INLINE_VISIBILITY
1307typename std::enable_if<std::is_integral<_A1>::value, double>::type
Mehdi Aminib3da6322017-02-10 02:44:23 +00001308nexttoward(_A1 __lcpp_x, long double __lcpp_y) _NOEXCEPT {return ::nexttoward((double)__lcpp_x, __lcpp_y);}
Richard Smith081bb592015-10-08 20:40:34 +00001309
1310// remainder
1311
Mehdi Aminib3da6322017-02-10 02:44:23 +00001312inline _LIBCPP_INLINE_VISIBILITY float remainder(float __lcpp_x, float __lcpp_y) _NOEXCEPT {return ::remainderf(__lcpp_x, __lcpp_y);}
1313inline _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 +00001314
1315template <class _A1, class _A2>
1316inline _LIBCPP_INLINE_VISIBILITY
1317typename std::__lazy_enable_if
1318<
1319 std::is_arithmetic<_A1>::value &&
1320 std::is_arithmetic<_A2>::value,
1321 std::__promote<_A1, _A2>
1322>::type
1323remainder(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
1324{
1325 typedef typename std::__promote<_A1, _A2>::type __result_type;
1326 static_assert((!(std::is_same<_A1, __result_type>::value &&
1327 std::is_same<_A2, __result_type>::value)), "");
Mehdi Aminib3da6322017-02-10 02:44:23 +00001328 return ::remainder((__result_type)__lcpp_x, (__result_type)__lcpp_y);
Richard Smith081bb592015-10-08 20:40:34 +00001329}
1330
1331// remquo
1332
Mehdi Aminib3da6322017-02-10 02:44:23 +00001333inline _LIBCPP_INLINE_VISIBILITY float remquo(float __lcpp_x, float __lcpp_y, int* __lcpp_z) _NOEXCEPT {return ::remquof(__lcpp_x, __lcpp_y, __lcpp_z);}
1334inline _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 +00001335
1336template <class _A1, class _A2>
1337inline _LIBCPP_INLINE_VISIBILITY
1338typename std::__lazy_enable_if
1339<
1340 std::is_arithmetic<_A1>::value &&
1341 std::is_arithmetic<_A2>::value,
1342 std::__promote<_A1, _A2>
1343>::type
1344remquo(_A1 __lcpp_x, _A2 __lcpp_y, int* __lcpp_z) _NOEXCEPT
1345{
1346 typedef typename std::__promote<_A1, _A2>::type __result_type;
1347 static_assert((!(std::is_same<_A1, __result_type>::value &&
1348 std::is_same<_A2, __result_type>::value)), "");
Mehdi Aminib3da6322017-02-10 02:44:23 +00001349 return ::remquo((__result_type)__lcpp_x, (__result_type)__lcpp_y, __lcpp_z);
Richard Smith081bb592015-10-08 20:40:34 +00001350}
1351
1352// rint
1353
Mehdi Aminib3da6322017-02-10 02:44:23 +00001354inline _LIBCPP_INLINE_VISIBILITY float rint(float __lcpp_x) _NOEXCEPT {return ::rintf(__lcpp_x);}
1355inline _LIBCPP_INLINE_VISIBILITY long double rint(long double __lcpp_x) _NOEXCEPT {return ::rintl(__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +00001356
1357template <class _A1>
1358inline _LIBCPP_INLINE_VISIBILITY
1359typename std::enable_if<std::is_integral<_A1>::value, double>::type
Mehdi Aminib3da6322017-02-10 02:44:23 +00001360rint(_A1 __lcpp_x) _NOEXCEPT {return ::rint((double)__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +00001361
1362// round
1363
Mehdi Aminib3da6322017-02-10 02:44:23 +00001364inline _LIBCPP_INLINE_VISIBILITY float round(float __lcpp_x) _NOEXCEPT {return ::roundf(__lcpp_x);}
1365inline _LIBCPP_INLINE_VISIBILITY long double round(long double __lcpp_x) _NOEXCEPT {return ::roundl(__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +00001366
1367template <class _A1>
1368inline _LIBCPP_INLINE_VISIBILITY
1369typename std::enable_if<std::is_integral<_A1>::value, double>::type
Mehdi Aminib3da6322017-02-10 02:44:23 +00001370round(_A1 __lcpp_x) _NOEXCEPT {return ::round((double)__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +00001371
1372// scalbln
1373
Mehdi Aminib3da6322017-02-10 02:44:23 +00001374inline _LIBCPP_INLINE_VISIBILITY float scalbln(float __lcpp_x, long __lcpp_y) _NOEXCEPT {return ::scalblnf(__lcpp_x, __lcpp_y);}
1375inline _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 +00001376
1377template <class _A1>
1378inline _LIBCPP_INLINE_VISIBILITY
1379typename std::enable_if<std::is_integral<_A1>::value, double>::type
Mehdi Aminib3da6322017-02-10 02:44:23 +00001380scalbln(_A1 __lcpp_x, long __lcpp_y) _NOEXCEPT {return ::scalbln((double)__lcpp_x, __lcpp_y);}
Richard Smith081bb592015-10-08 20:40:34 +00001381
1382// scalbn
1383
Mehdi Aminib3da6322017-02-10 02:44:23 +00001384inline _LIBCPP_INLINE_VISIBILITY float scalbn(float __lcpp_x, int __lcpp_y) _NOEXCEPT {return ::scalbnf(__lcpp_x, __lcpp_y);}
1385inline _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 +00001386
1387template <class _A1>
1388inline _LIBCPP_INLINE_VISIBILITY
1389typename std::enable_if<std::is_integral<_A1>::value, double>::type
Mehdi Aminib3da6322017-02-10 02:44:23 +00001390scalbn(_A1 __lcpp_x, int __lcpp_y) _NOEXCEPT {return ::scalbn((double)__lcpp_x, __lcpp_y);}
Richard Smith081bb592015-10-08 20:40:34 +00001391
1392// tgamma
1393
Mehdi Aminib3da6322017-02-10 02:44:23 +00001394inline _LIBCPP_INLINE_VISIBILITY float tgamma(float __lcpp_x) _NOEXCEPT {return ::tgammaf(__lcpp_x);}
1395inline _LIBCPP_INLINE_VISIBILITY long double tgamma(long double __lcpp_x) _NOEXCEPT {return ::tgammal(__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +00001396
1397template <class _A1>
1398inline _LIBCPP_INLINE_VISIBILITY
1399typename std::enable_if<std::is_integral<_A1>::value, double>::type
Mehdi Aminib3da6322017-02-10 02:44:23 +00001400tgamma(_A1 __lcpp_x) _NOEXCEPT {return ::tgamma((double)__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +00001401
1402// trunc
1403
Mehdi Aminib3da6322017-02-10 02:44:23 +00001404inline _LIBCPP_INLINE_VISIBILITY float trunc(float __lcpp_x) _NOEXCEPT {return ::truncf(__lcpp_x);}
1405inline _LIBCPP_INLINE_VISIBILITY long double trunc(long double __lcpp_x) _NOEXCEPT {return ::truncl(__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +00001406
1407template <class _A1>
1408inline _LIBCPP_INLINE_VISIBILITY
1409typename std::enable_if<std::is_integral<_A1>::value, double>::type
Mehdi Aminib3da6322017-02-10 02:44:23 +00001410trunc(_A1 __lcpp_x) _NOEXCEPT {return ::trunc((double)__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +00001411
Richard Smith081bb592015-10-08 20:40:34 +00001412} // extern "C++"
1413
1414#endif // __cplusplus
1415
1416#endif // _LIBCPP_MATH_H