blob: 1476772351c219cc9987cd767220fe8cb3803ff1 [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
Peter Collingbourne002c67e2018-01-26 01:19:23 +000011// This include lives outside the header guard in order to support an MSVC
12// extension which allows users to do:
13//
14// #define _USE_MATH_DEFINES
15// #include <math.h>
16//
17// and receive the definitions of mathematical constants, even if <math.h>
18// has previously been included.
19#include_next <math.h>
20
Richard Smith081bb592015-10-08 20:40:34 +000021#ifndef _LIBCPP_MATH_H
22#define _LIBCPP_MATH_H
23
24/*
25 math.h synopsis
26
27Macros:
28
29 HUGE_VAL
30 HUGE_VALF // C99
31 HUGE_VALL // C99
32 INFINITY // C99
33 NAN // C99
34 FP_INFINITE // C99
35 FP_NAN // C99
36 FP_NORMAL // C99
37 FP_SUBNORMAL // C99
38 FP_ZERO // C99
39 FP_FAST_FMA // C99
40 FP_FAST_FMAF // C99
41 FP_FAST_FMAL // C99
42 FP_ILOGB0 // C99
43 FP_ILOGBNAN // C99
44 MATH_ERRNO // C99
45 MATH_ERREXCEPT // C99
46 math_errhandling // C99
47
48Types:
49
50 float_t // C99
51 double_t // C99
52
53// C90
54
55floating_point abs(floating_point x);
56
57floating_point acos (arithmetic x);
58float acosf(float x);
59long double acosl(long double x);
60
61floating_point asin (arithmetic x);
62float asinf(float x);
63long double asinl(long double x);
64
65floating_point atan (arithmetic x);
66float atanf(float x);
67long double atanl(long double x);
68
69floating_point atan2 (arithmetic y, arithmetic x);
70float atan2f(float y, float x);
71long double atan2l(long double y, long double x);
72
73floating_point ceil (arithmetic x);
74float ceilf(float x);
75long double ceill(long double x);
76
77floating_point cos (arithmetic x);
78float cosf(float x);
79long double cosl(long double x);
80
81floating_point cosh (arithmetic x);
82float coshf(float x);
83long double coshl(long double x);
84
85floating_point exp (arithmetic x);
86float expf(float x);
87long double expl(long double x);
88
89floating_point fabs (arithmetic x);
90float fabsf(float x);
91long double fabsl(long double x);
92
93floating_point floor (arithmetic x);
94float floorf(float x);
95long double floorl(long double x);
96
97floating_point fmod (arithmetic x, arithmetic y);
98float fmodf(float x, float y);
99long double fmodl(long double x, long double y);
100
101floating_point frexp (arithmetic value, int* exp);
102float frexpf(float value, int* exp);
103long double frexpl(long double value, int* exp);
104
105floating_point ldexp (arithmetic value, int exp);
106float ldexpf(float value, int exp);
107long double ldexpl(long double value, int exp);
108
109floating_point log (arithmetic x);
110float logf(float x);
111long double logl(long double x);
112
113floating_point log10 (arithmetic x);
114float log10f(float x);
115long double log10l(long double x);
116
117floating_point modf (floating_point value, floating_point* iptr);
118float modff(float value, float* iptr);
119long double modfl(long double value, long double* iptr);
120
121floating_point pow (arithmetic x, arithmetic y);
122float powf(float x, float y);
123long double powl(long double x, long double y);
124
125floating_point sin (arithmetic x);
126float sinf(float x);
127long double sinl(long double x);
128
129floating_point sinh (arithmetic x);
130float sinhf(float x);
131long double sinhl(long double x);
132
133floating_point sqrt (arithmetic x);
134float sqrtf(float x);
135long double sqrtl(long double x);
136
137floating_point tan (arithmetic x);
138float tanf(float x);
139long double tanl(long double x);
140
141floating_point tanh (arithmetic x);
142float tanhf(float x);
143long double tanhl(long double x);
144
145// C99
146
147bool signbit(arithmetic x);
148
149int fpclassify(arithmetic x);
150
151bool isfinite(arithmetic x);
152bool isinf(arithmetic x);
153bool isnan(arithmetic x);
154bool isnormal(arithmetic x);
155
156bool isgreater(arithmetic x, arithmetic y);
157bool isgreaterequal(arithmetic x, arithmetic y);
158bool isless(arithmetic x, arithmetic y);
159bool islessequal(arithmetic x, arithmetic y);
160bool islessgreater(arithmetic x, arithmetic y);
161bool isunordered(arithmetic x, arithmetic y);
162
163floating_point acosh (arithmetic x);
164float acoshf(float x);
165long double acoshl(long double x);
166
167floating_point asinh (arithmetic x);
168float asinhf(float x);
169long double asinhl(long double x);
170
171floating_point atanh (arithmetic x);
172float atanhf(float x);
173long double atanhl(long double x);
174
175floating_point cbrt (arithmetic x);
176float cbrtf(float x);
177long double cbrtl(long double x);
178
179floating_point copysign (arithmetic x, arithmetic y);
180float copysignf(float x, float y);
181long double copysignl(long double x, long double y);
182
183floating_point erf (arithmetic x);
184float erff(float x);
185long double erfl(long double x);
186
187floating_point erfc (arithmetic x);
188float erfcf(float x);
189long double erfcl(long double x);
190
191floating_point exp2 (arithmetic x);
192float exp2f(float x);
193long double exp2l(long double x);
194
195floating_point expm1 (arithmetic x);
196float expm1f(float x);
197long double expm1l(long double x);
198
199floating_point fdim (arithmetic x, arithmetic y);
200float fdimf(float x, float y);
201long double fdiml(long double x, long double y);
202
203floating_point fma (arithmetic x, arithmetic y, arithmetic z);
204float fmaf(float x, float y, float z);
205long double fmal(long double x, long double y, long double z);
206
207floating_point fmax (arithmetic x, arithmetic y);
208float fmaxf(float x, float y);
209long double fmaxl(long double x, long double y);
210
211floating_point fmin (arithmetic x, arithmetic y);
212float fminf(float x, float y);
213long double fminl(long double x, long double y);
214
215floating_point hypot (arithmetic x, arithmetic y);
216float hypotf(float x, float y);
217long double hypotl(long double x, long double y);
218
219int ilogb (arithmetic x);
220int ilogbf(float x);
221int ilogbl(long double x);
222
223floating_point lgamma (arithmetic x);
224float lgammaf(float x);
225long double lgammal(long double x);
226
227long long llrint (arithmetic x);
228long long llrintf(float x);
229long long llrintl(long double x);
230
231long long llround (arithmetic x);
232long long llroundf(float x);
233long long llroundl(long double x);
234
235floating_point log1p (arithmetic x);
236float log1pf(float x);
237long double log1pl(long double x);
238
239floating_point log2 (arithmetic x);
240float log2f(float x);
241long double log2l(long double x);
242
243floating_point logb (arithmetic x);
244float logbf(float x);
245long double logbl(long double x);
246
247long lrint (arithmetic x);
248long lrintf(float x);
249long lrintl(long double x);
250
251long lround (arithmetic x);
252long lroundf(float x);
253long lroundl(long double x);
254
255double nan (const char* str);
256float nanf(const char* str);
257long double nanl(const char* str);
258
259floating_point nearbyint (arithmetic x);
260float nearbyintf(float x);
261long double nearbyintl(long double x);
262
263floating_point nextafter (arithmetic x, arithmetic y);
264float nextafterf(float x, float y);
265long double nextafterl(long double x, long double y);
266
267floating_point nexttoward (arithmetic x, long double y);
268float nexttowardf(float x, long double y);
269long double nexttowardl(long double x, long double y);
270
271floating_point remainder (arithmetic x, arithmetic y);
272float remainderf(float x, float y);
273long double remainderl(long double x, long double y);
274
275floating_point remquo (arithmetic x, arithmetic y, int* pquo);
276float remquof(float x, float y, int* pquo);
277long double remquol(long double x, long double y, int* pquo);
278
279floating_point rint (arithmetic x);
280float rintf(float x);
281long double rintl(long double x);
282
283floating_point round (arithmetic x);
284float roundf(float x);
285long double roundl(long double x);
286
287floating_point scalbln (arithmetic x, long ex);
288float scalblnf(float x, long ex);
289long double scalblnl(long double x, long ex);
290
291floating_point scalbn (arithmetic x, int ex);
292float scalbnf(float x, int ex);
293long double scalbnl(long double x, int ex);
294
295floating_point tgamma (arithmetic x);
296float tgammaf(float x);
297long double tgammal(long double x);
298
299floating_point trunc (arithmetic x);
300float truncf(float x);
301long double truncl(long double x);
302
303*/
304
305#include <__config>
Richard Smith081bb592015-10-08 20:40:34 +0000306
307#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
308#pragma GCC system_header
309#endif
310
Richard Smith081bb592015-10-08 20:40:34 +0000311#ifdef __cplusplus
312
313// We support including .h headers inside 'extern "C"' contexts, so switch
314// back to C++ linkage before including these C++ headers.
315extern "C++" {
316
317#include <type_traits>
Duncan P. N. Exon Smith321d6bf2017-04-21 23:14:55 +0000318#include <limits>
Richard Smith081bb592015-10-08 20:40:34 +0000319
Richard Smith081bb592015-10-08 20:40:34 +0000320// signbit
321
322#ifdef signbit
323
324template <class _A1>
325_LIBCPP_ALWAYS_INLINE
326bool
327__libcpp_signbit(_A1 __lcpp_x) _NOEXCEPT
328{
329 return signbit(__lcpp_x);
330}
331
332#undef signbit
333
334template <class _A1>
335inline _LIBCPP_INLINE_VISIBILITY
Duncan P. N. Exon Smith321d6bf2017-04-21 23:14:55 +0000336typename std::enable_if<std::is_floating_point<_A1>::value, bool>::type
Richard Smith081bb592015-10-08 20:40:34 +0000337signbit(_A1 __lcpp_x) _NOEXCEPT
338{
339 return __libcpp_signbit((typename std::__promote<_A1>::type)__lcpp_x);
340}
341
Duncan P. N. Exon Smith321d6bf2017-04-21 23:14:55 +0000342template <class _A1>
343inline _LIBCPP_INLINE_VISIBILITY
344typename std::enable_if<
345 std::is_integral<_A1>::value && std::is_signed<_A1>::value, bool>::type
346signbit(_A1 __lcpp_x) _NOEXCEPT
347{ return __lcpp_x < 0; }
348
349template <class _A1>
350inline _LIBCPP_INLINE_VISIBILITY
351typename std::enable_if<
352 std::is_integral<_A1>::value && !std::is_signed<_A1>::value, bool>::type
353signbit(_A1) _NOEXCEPT
354{ return false; }
355
Shoaib Meenai159375f2017-04-07 02:20:52 +0000356#elif defined(_LIBCPP_MSVCRT)
Saleem Abdulrasool257256b2017-02-18 19:28:38 +0000357
358template <typename _A1>
359inline _LIBCPP_INLINE_VISIBILITY
Duncan P. N. Exon Smith321d6bf2017-04-21 23:14:55 +0000360typename std::enable_if<std::is_floating_point<_A1>::value, bool>::type
Saleem Abdulrasool257256b2017-02-18 19:28:38 +0000361signbit(_A1 __lcpp_x) _NOEXCEPT
362{
363 return ::signbit(static_cast<typename std::__promote<_A1>::type>(__lcpp_x));
364}
365
Duncan P. N. Exon Smith321d6bf2017-04-21 23:14:55 +0000366template <class _A1>
367inline _LIBCPP_INLINE_VISIBILITY
368typename std::enable_if<
369 std::is_integral<_A1>::value && std::is_signed<_A1>::value, bool>::type
370signbit(_A1 __lcpp_x) _NOEXCEPT
371{ return __lcpp_x < 0; }
372
373template <class _A1>
374inline _LIBCPP_INLINE_VISIBILITY
375typename std::enable_if<
376 std::is_integral<_A1>::value && !std::is_signed<_A1>::value, bool>::type
377signbit(_A1) _NOEXCEPT
378{ return false; }
379
Richard Smith081bb592015-10-08 20:40:34 +0000380#endif // signbit
381
382// fpclassify
383
384#ifdef fpclassify
385
386template <class _A1>
387_LIBCPP_ALWAYS_INLINE
388int
389__libcpp_fpclassify(_A1 __lcpp_x) _NOEXCEPT
390{
391 return fpclassify(__lcpp_x);
392}
393
394#undef fpclassify
395
396template <class _A1>
397inline _LIBCPP_INLINE_VISIBILITY
Duncan P. N. Exon Smith321d6bf2017-04-21 23:14:55 +0000398typename std::enable_if<std::is_floating_point<_A1>::value, int>::type
Richard Smith081bb592015-10-08 20:40:34 +0000399fpclassify(_A1 __lcpp_x) _NOEXCEPT
400{
401 return __libcpp_fpclassify((typename std::__promote<_A1>::type)__lcpp_x);
402}
403
Duncan P. N. Exon Smith321d6bf2017-04-21 23:14:55 +0000404template <class _A1>
405inline _LIBCPP_INLINE_VISIBILITY
406typename std::enable_if<std::is_integral<_A1>::value, int>::type
407fpclassify(_A1 __lcpp_x) _NOEXCEPT
408{ return __lcpp_x == 0 ? FP_ZERO : FP_NORMAL; }
409
Shoaib Meenai159375f2017-04-07 02:20:52 +0000410#elif defined(_LIBCPP_MSVCRT)
Saleem Abdulrasool257256b2017-02-18 19:28:38 +0000411
412template <typename _A1>
413inline _LIBCPP_INLINE_VISIBILITY
Duncan P. N. Exon Smith321d6bf2017-04-21 23:14:55 +0000414typename std::enable_if<std::is_floating_point<_A1>::value, bool>::type
Saleem Abdulrasool257256b2017-02-18 19:28:38 +0000415fpclassify(_A1 __lcpp_x) _NOEXCEPT
416{
417 return ::fpclassify(static_cast<typename std::__promote<_A1>::type>(__lcpp_x));
418}
419
Duncan P. N. Exon Smith321d6bf2017-04-21 23:14:55 +0000420template <class _A1>
421inline _LIBCPP_INLINE_VISIBILITY
422typename std::enable_if<std::is_integral<_A1>::value, int>::type
423fpclassify(_A1 __lcpp_x) _NOEXCEPT
424{ return __lcpp_x == 0 ? FP_ZERO : FP_NORMAL; }
425
Richard Smith081bb592015-10-08 20:40:34 +0000426#endif // fpclassify
427
428// isfinite
429
430#ifdef isfinite
431
432template <class _A1>
433_LIBCPP_ALWAYS_INLINE
434bool
435__libcpp_isfinite(_A1 __lcpp_x) _NOEXCEPT
436{
437 return isfinite(__lcpp_x);
438}
439
440#undef isfinite
441
442template <class _A1>
443inline _LIBCPP_INLINE_VISIBILITY
Duncan P. N. Exon Smith321d6bf2017-04-21 23:14:55 +0000444typename std::enable_if<
445 std::is_arithmetic<_A1>::value && std::numeric_limits<_A1>::has_infinity,
446 bool>::type
Richard Smith081bb592015-10-08 20:40:34 +0000447isfinite(_A1 __lcpp_x) _NOEXCEPT
448{
449 return __libcpp_isfinite((typename std::__promote<_A1>::type)__lcpp_x);
450}
451
Duncan P. N. Exon Smith321d6bf2017-04-21 23:14:55 +0000452template <class _A1>
453inline _LIBCPP_INLINE_VISIBILITY
454typename std::enable_if<
455 std::is_arithmetic<_A1>::value && !std::numeric_limits<_A1>::has_infinity,
456 bool>::type
457isfinite(_A1) _NOEXCEPT
458{ return true; }
459
Richard Smith081bb592015-10-08 20:40:34 +0000460#endif // isfinite
461
462// isinf
463
464#ifdef isinf
465
466template <class _A1>
467_LIBCPP_ALWAYS_INLINE
468bool
469__libcpp_isinf(_A1 __lcpp_x) _NOEXCEPT
470{
471 return isinf(__lcpp_x);
472}
473
474#undef isinf
475
476template <class _A1>
477inline _LIBCPP_INLINE_VISIBILITY
Duncan P. N. Exon Smith321d6bf2017-04-21 23:14:55 +0000478typename std::enable_if<
479 std::is_arithmetic<_A1>::value && std::numeric_limits<_A1>::has_infinity,
480 bool>::type
Richard Smith081bb592015-10-08 20:40:34 +0000481isinf(_A1 __lcpp_x) _NOEXCEPT
482{
483 return __libcpp_isinf((typename std::__promote<_A1>::type)__lcpp_x);
484}
485
Duncan P. N. Exon Smith321d6bf2017-04-21 23:14:55 +0000486template <class _A1>
487inline _LIBCPP_INLINE_VISIBILITY
488typename std::enable_if<
489 std::is_arithmetic<_A1>::value && !std::numeric_limits<_A1>::has_infinity,
490 bool>::type
491isinf(_A1) _NOEXCEPT
492{ return false; }
493
Richard Smith081bb592015-10-08 20:40:34 +0000494#endif // isinf
495
496// isnan
497
498#ifdef isnan
499
500template <class _A1>
501_LIBCPP_ALWAYS_INLINE
502bool
503__libcpp_isnan(_A1 __lcpp_x) _NOEXCEPT
504{
505 return isnan(__lcpp_x);
506}
507
508#undef isnan
509
510template <class _A1>
511inline _LIBCPP_INLINE_VISIBILITY
Duncan P. N. Exon Smith321d6bf2017-04-21 23:14:55 +0000512typename std::enable_if<std::is_floating_point<_A1>::value, bool>::type
Richard Smith081bb592015-10-08 20:40:34 +0000513isnan(_A1 __lcpp_x) _NOEXCEPT
514{
515 return __libcpp_isnan((typename std::__promote<_A1>::type)__lcpp_x);
516}
517
Duncan P. N. Exon Smith321d6bf2017-04-21 23:14:55 +0000518template <class _A1>
519inline _LIBCPP_INLINE_VISIBILITY
520typename std::enable_if<std::is_integral<_A1>::value, bool>::type
521isnan(_A1) _NOEXCEPT
522{ return false; }
523
Richard Smith081bb592015-10-08 20:40:34 +0000524#endif // isnan
525
526// isnormal
527
528#ifdef isnormal
529
530template <class _A1>
531_LIBCPP_ALWAYS_INLINE
532bool
533__libcpp_isnormal(_A1 __lcpp_x) _NOEXCEPT
534{
535 return isnormal(__lcpp_x);
536}
537
538#undef isnormal
539
540template <class _A1>
541inline _LIBCPP_INLINE_VISIBILITY
Duncan P. N. Exon Smith321d6bf2017-04-21 23:14:55 +0000542typename std::enable_if<std::is_floating_point<_A1>::value, bool>::type
Richard Smith081bb592015-10-08 20:40:34 +0000543isnormal(_A1 __lcpp_x) _NOEXCEPT
544{
545 return __libcpp_isnormal((typename std::__promote<_A1>::type)__lcpp_x);
546}
547
Duncan P. N. Exon Smith321d6bf2017-04-21 23:14:55 +0000548template <class _A1>
549inline _LIBCPP_INLINE_VISIBILITY
550typename std::enable_if<std::is_integral<_A1>::value, bool>::type
551isnormal(_A1 __lcpp_x) _NOEXCEPT
552{ return __lcpp_x != 0; }
553
Richard Smith081bb592015-10-08 20:40:34 +0000554#endif // isnormal
555
556// isgreater
557
558#ifdef isgreater
559
560template <class _A1, class _A2>
561_LIBCPP_ALWAYS_INLINE
562bool
563__libcpp_isgreater(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
564{
565 return isgreater(__lcpp_x, __lcpp_y);
566}
567
568#undef isgreater
569
570template <class _A1, class _A2>
571inline _LIBCPP_INLINE_VISIBILITY
572typename std::enable_if
573<
574 std::is_arithmetic<_A1>::value &&
575 std::is_arithmetic<_A2>::value,
576 bool
577>::type
578isgreater(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
579{
580 typedef typename std::__promote<_A1, _A2>::type type;
581 return __libcpp_isgreater((type)__lcpp_x, (type)__lcpp_y);
582}
583
584#endif // isgreater
585
586// isgreaterequal
587
588#ifdef isgreaterequal
589
590template <class _A1, class _A2>
591_LIBCPP_ALWAYS_INLINE
592bool
593__libcpp_isgreaterequal(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
594{
595 return isgreaterequal(__lcpp_x, __lcpp_y);
596}
597
598#undef isgreaterequal
599
600template <class _A1, class _A2>
601inline _LIBCPP_INLINE_VISIBILITY
602typename std::enable_if
603<
604 std::is_arithmetic<_A1>::value &&
605 std::is_arithmetic<_A2>::value,
606 bool
607>::type
608isgreaterequal(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
609{
610 typedef typename std::__promote<_A1, _A2>::type type;
611 return __libcpp_isgreaterequal((type)__lcpp_x, (type)__lcpp_y);
612}
613
614#endif // isgreaterequal
615
616// isless
617
618#ifdef isless
619
620template <class _A1, class _A2>
621_LIBCPP_ALWAYS_INLINE
622bool
623__libcpp_isless(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
624{
625 return isless(__lcpp_x, __lcpp_y);
626}
627
628#undef isless
629
630template <class _A1, class _A2>
631inline _LIBCPP_INLINE_VISIBILITY
632typename std::enable_if
633<
634 std::is_arithmetic<_A1>::value &&
635 std::is_arithmetic<_A2>::value,
636 bool
637>::type
638isless(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
639{
640 typedef typename std::__promote<_A1, _A2>::type type;
641 return __libcpp_isless((type)__lcpp_x, (type)__lcpp_y);
642}
643
644#endif // isless
645
646// islessequal
647
648#ifdef islessequal
649
650template <class _A1, class _A2>
651_LIBCPP_ALWAYS_INLINE
652bool
653__libcpp_islessequal(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
654{
655 return islessequal(__lcpp_x, __lcpp_y);
656}
657
658#undef islessequal
659
660template <class _A1, class _A2>
661inline _LIBCPP_INLINE_VISIBILITY
662typename std::enable_if
663<
664 std::is_arithmetic<_A1>::value &&
665 std::is_arithmetic<_A2>::value,
666 bool
667>::type
668islessequal(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
669{
670 typedef typename std::__promote<_A1, _A2>::type type;
671 return __libcpp_islessequal((type)__lcpp_x, (type)__lcpp_y);
672}
673
674#endif // islessequal
675
676// islessgreater
677
678#ifdef islessgreater
679
680template <class _A1, class _A2>
681_LIBCPP_ALWAYS_INLINE
682bool
683__libcpp_islessgreater(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
684{
685 return islessgreater(__lcpp_x, __lcpp_y);
686}
687
688#undef islessgreater
689
690template <class _A1, class _A2>
691inline _LIBCPP_INLINE_VISIBILITY
692typename std::enable_if
693<
694 std::is_arithmetic<_A1>::value &&
695 std::is_arithmetic<_A2>::value,
696 bool
697>::type
698islessgreater(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
699{
700 typedef typename std::__promote<_A1, _A2>::type type;
701 return __libcpp_islessgreater((type)__lcpp_x, (type)__lcpp_y);
702}
703
704#endif // islessgreater
705
706// isunordered
707
708#ifdef isunordered
709
710template <class _A1, class _A2>
711_LIBCPP_ALWAYS_INLINE
712bool
713__libcpp_isunordered(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
714{
715 return isunordered(__lcpp_x, __lcpp_y);
716}
717
718#undef isunordered
719
720template <class _A1, class _A2>
721inline _LIBCPP_INLINE_VISIBILITY
722typename std::enable_if
723<
724 std::is_arithmetic<_A1>::value &&
725 std::is_arithmetic<_A2>::value,
726 bool
727>::type
728isunordered(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
729{
730 typedef typename std::__promote<_A1, _A2>::type type;
731 return __libcpp_isunordered((type)__lcpp_x, (type)__lcpp_y);
732}
733
734#endif // isunordered
735
Richard Smith081bb592015-10-08 20:40:34 +0000736// abs
737
Eric Fiselier7d1aac92016-08-15 18:58:57 +0000738#if !(defined(_AIX) || defined(__sun__))
Richard Smith081bb592015-10-08 20:40:34 +0000739inline _LIBCPP_INLINE_VISIBILITY
740float
Mehdi Aminib3da6322017-02-10 02:44:23 +0000741abs(float __lcpp_x) _NOEXCEPT {return ::fabsf(__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +0000742
743inline _LIBCPP_INLINE_VISIBILITY
744double
Mehdi Aminib3da6322017-02-10 02:44:23 +0000745abs(double __lcpp_x) _NOEXCEPT {return ::fabs(__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +0000746
747inline _LIBCPP_INLINE_VISIBILITY
748long double
Mehdi Aminib3da6322017-02-10 02:44:23 +0000749abs(long double __lcpp_x) _NOEXCEPT {return ::fabsl(__lcpp_x);}
Eric Fiselier7d1aac92016-08-15 18:58:57 +0000750#endif // !(defined(_AIX) || defined(__sun__))
Richard Smith081bb592015-10-08 20:40:34 +0000751
752// acos
753
Shoaib Meenai159375f2017-04-07 02:20:52 +0000754#if !(defined(_AIX) || defined(__sun__))
Mehdi Aminib3da6322017-02-10 02:44:23 +0000755inline _LIBCPP_INLINE_VISIBILITY float acos(float __lcpp_x) _NOEXCEPT {return ::acosf(__lcpp_x);}
756inline _LIBCPP_INLINE_VISIBILITY long double acos(long double __lcpp_x) _NOEXCEPT {return ::acosl(__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +0000757#endif
758
759template <class _A1>
760inline _LIBCPP_INLINE_VISIBILITY
761typename std::enable_if<std::is_integral<_A1>::value, double>::type
Mehdi Aminib3da6322017-02-10 02:44:23 +0000762acos(_A1 __lcpp_x) _NOEXCEPT {return ::acos((double)__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +0000763
764// asin
765
Shoaib Meenai159375f2017-04-07 02:20:52 +0000766#if !(defined(_AIX) || defined(__sun__))
Mehdi Aminib3da6322017-02-10 02:44:23 +0000767inline _LIBCPP_INLINE_VISIBILITY float asin(float __lcpp_x) _NOEXCEPT {return ::asinf(__lcpp_x);}
768inline _LIBCPP_INLINE_VISIBILITY long double asin(long double __lcpp_x) _NOEXCEPT {return ::asinl(__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +0000769#endif
770
771template <class _A1>
772inline _LIBCPP_INLINE_VISIBILITY
773typename std::enable_if<std::is_integral<_A1>::value, double>::type
Mehdi Aminib3da6322017-02-10 02:44:23 +0000774asin(_A1 __lcpp_x) _NOEXCEPT {return ::asin((double)__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +0000775
776// atan
777
Shoaib Meenai159375f2017-04-07 02:20:52 +0000778#if !(defined(_AIX) || defined(__sun__))
Mehdi Aminib3da6322017-02-10 02:44:23 +0000779inline _LIBCPP_INLINE_VISIBILITY float atan(float __lcpp_x) _NOEXCEPT {return ::atanf(__lcpp_x);}
780inline _LIBCPP_INLINE_VISIBILITY long double atan(long double __lcpp_x) _NOEXCEPT {return ::atanl(__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +0000781#endif
782
783template <class _A1>
784inline _LIBCPP_INLINE_VISIBILITY
785typename std::enable_if<std::is_integral<_A1>::value, double>::type
Mehdi Aminib3da6322017-02-10 02:44:23 +0000786atan(_A1 __lcpp_x) _NOEXCEPT {return ::atan((double)__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +0000787
788// atan2
789
Shoaib Meenai159375f2017-04-07 02:20:52 +0000790#if !(defined(_AIX) || defined(__sun__))
Mehdi Aminib3da6322017-02-10 02:44:23 +0000791inline _LIBCPP_INLINE_VISIBILITY float atan2(float __lcpp_y, float __lcpp_x) _NOEXCEPT {return ::atan2f(__lcpp_y, __lcpp_x);}
792inline _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 +0000793#endif
794
795template <class _A1, class _A2>
796inline _LIBCPP_INLINE_VISIBILITY
797typename std::__lazy_enable_if
798<
799 std::is_arithmetic<_A1>::value &&
800 std::is_arithmetic<_A2>::value,
801 std::__promote<_A1, _A2>
802>::type
803atan2(_A1 __lcpp_y, _A2 __lcpp_x) _NOEXCEPT
804{
805 typedef typename std::__promote<_A1, _A2>::type __result_type;
806 static_assert((!(std::is_same<_A1, __result_type>::value &&
807 std::is_same<_A2, __result_type>::value)), "");
Mehdi Aminib3da6322017-02-10 02:44:23 +0000808 return ::atan2((__result_type)__lcpp_y, (__result_type)__lcpp_x);
Richard Smith081bb592015-10-08 20:40:34 +0000809}
810
811// ceil
812
Shoaib Meenai159375f2017-04-07 02:20:52 +0000813#if !(defined(_AIX) || defined(__sun__))
Mehdi Aminib3da6322017-02-10 02:44:23 +0000814inline _LIBCPP_INLINE_VISIBILITY float ceil(float __lcpp_x) _NOEXCEPT {return ::ceilf(__lcpp_x);}
815inline _LIBCPP_INLINE_VISIBILITY long double ceil(long double __lcpp_x) _NOEXCEPT {return ::ceill(__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +0000816#endif
817
818template <class _A1>
819inline _LIBCPP_INLINE_VISIBILITY
820typename std::enable_if<std::is_integral<_A1>::value, double>::type
Mehdi Aminib3da6322017-02-10 02:44:23 +0000821ceil(_A1 __lcpp_x) _NOEXCEPT {return ::ceil((double)__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +0000822
823// cos
824
Shoaib Meenai159375f2017-04-07 02:20:52 +0000825#if !(defined(_AIX) || defined(__sun__))
Mehdi Aminib3da6322017-02-10 02:44:23 +0000826inline _LIBCPP_INLINE_VISIBILITY float cos(float __lcpp_x) _NOEXCEPT {return ::cosf(__lcpp_x);}
827inline _LIBCPP_INLINE_VISIBILITY long double cos(long double __lcpp_x) _NOEXCEPT {return ::cosl(__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +0000828#endif
829
830template <class _A1>
831inline _LIBCPP_INLINE_VISIBILITY
832typename std::enable_if<std::is_integral<_A1>::value, double>::type
Mehdi Aminib3da6322017-02-10 02:44:23 +0000833cos(_A1 __lcpp_x) _NOEXCEPT {return ::cos((double)__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +0000834
835// cosh
836
Shoaib Meenai159375f2017-04-07 02:20:52 +0000837#if !(defined(_AIX) || defined(__sun__))
Mehdi Aminib3da6322017-02-10 02:44:23 +0000838inline _LIBCPP_INLINE_VISIBILITY float cosh(float __lcpp_x) _NOEXCEPT {return ::coshf(__lcpp_x);}
839inline _LIBCPP_INLINE_VISIBILITY long double cosh(long double __lcpp_x) _NOEXCEPT {return ::coshl(__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +0000840#endif
841
842template <class _A1>
843inline _LIBCPP_INLINE_VISIBILITY
844typename std::enable_if<std::is_integral<_A1>::value, double>::type
Mehdi Aminib3da6322017-02-10 02:44:23 +0000845cosh(_A1 __lcpp_x) _NOEXCEPT {return ::cosh((double)__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +0000846
847// exp
848
Shoaib Meenai159375f2017-04-07 02:20:52 +0000849#if !(defined(_AIX) || defined(__sun__))
Mehdi Aminib3da6322017-02-10 02:44:23 +0000850inline _LIBCPP_INLINE_VISIBILITY float exp(float __lcpp_x) _NOEXCEPT {return ::expf(__lcpp_x);}
851inline _LIBCPP_INLINE_VISIBILITY long double exp(long double __lcpp_x) _NOEXCEPT {return ::expl(__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +0000852#endif
853
854template <class _A1>
855inline _LIBCPP_INLINE_VISIBILITY
856typename std::enable_if<std::is_integral<_A1>::value, double>::type
Mehdi Aminib3da6322017-02-10 02:44:23 +0000857exp(_A1 __lcpp_x) _NOEXCEPT {return ::exp((double)__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +0000858
859// fabs
860
Shoaib Meenai159375f2017-04-07 02:20:52 +0000861#if !(defined(_AIX) || defined(__sun__))
Mehdi Aminib3da6322017-02-10 02:44:23 +0000862inline _LIBCPP_INLINE_VISIBILITY float fabs(float __lcpp_x) _NOEXCEPT {return ::fabsf(__lcpp_x);}
863inline _LIBCPP_INLINE_VISIBILITY long double fabs(long double __lcpp_x) _NOEXCEPT {return ::fabsl(__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +0000864#endif
865
866template <class _A1>
867inline _LIBCPP_INLINE_VISIBILITY
868typename std::enable_if<std::is_integral<_A1>::value, double>::type
Mehdi Aminib3da6322017-02-10 02:44:23 +0000869fabs(_A1 __lcpp_x) _NOEXCEPT {return ::fabs((double)__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +0000870
871// floor
872
Shoaib Meenai159375f2017-04-07 02:20:52 +0000873#if !(defined(_AIX) || defined(__sun__))
Mehdi Aminib3da6322017-02-10 02:44:23 +0000874inline _LIBCPP_INLINE_VISIBILITY float floor(float __lcpp_x) _NOEXCEPT {return ::floorf(__lcpp_x);}
875inline _LIBCPP_INLINE_VISIBILITY long double floor(long double __lcpp_x) _NOEXCEPT {return ::floorl(__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +0000876#endif
877
878template <class _A1>
879inline _LIBCPP_INLINE_VISIBILITY
880typename std::enable_if<std::is_integral<_A1>::value, double>::type
Mehdi Aminib3da6322017-02-10 02:44:23 +0000881floor(_A1 __lcpp_x) _NOEXCEPT {return ::floor((double)__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +0000882
883// fmod
884
Shoaib Meenai159375f2017-04-07 02:20:52 +0000885#if !(defined(_AIX) || defined(__sun__))
Mehdi Aminib3da6322017-02-10 02:44:23 +0000886inline _LIBCPP_INLINE_VISIBILITY float fmod(float __lcpp_x, float __lcpp_y) _NOEXCEPT {return ::fmodf(__lcpp_x, __lcpp_y);}
887inline _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 +0000888#endif
889
890template <class _A1, class _A2>
891inline _LIBCPP_INLINE_VISIBILITY
892typename std::__lazy_enable_if
893<
894 std::is_arithmetic<_A1>::value &&
895 std::is_arithmetic<_A2>::value,
896 std::__promote<_A1, _A2>
897>::type
898fmod(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
899{
900 typedef typename std::__promote<_A1, _A2>::type __result_type;
901 static_assert((!(std::is_same<_A1, __result_type>::value &&
902 std::is_same<_A2, __result_type>::value)), "");
Mehdi Aminib3da6322017-02-10 02:44:23 +0000903 return ::fmod((__result_type)__lcpp_x, (__result_type)__lcpp_y);
Richard Smith081bb592015-10-08 20:40:34 +0000904}
905
906// frexp
907
Shoaib Meenai159375f2017-04-07 02:20:52 +0000908#if !(defined(_AIX) || defined(__sun__))
Mehdi Aminib3da6322017-02-10 02:44:23 +0000909inline _LIBCPP_INLINE_VISIBILITY float frexp(float __lcpp_x, int* __lcpp_e) _NOEXCEPT {return ::frexpf(__lcpp_x, __lcpp_e);}
910inline _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 +0000911#endif
912
913template <class _A1>
914inline _LIBCPP_INLINE_VISIBILITY
915typename std::enable_if<std::is_integral<_A1>::value, double>::type
Mehdi Aminib3da6322017-02-10 02:44:23 +0000916frexp(_A1 __lcpp_x, int* __lcpp_e) _NOEXCEPT {return ::frexp((double)__lcpp_x, __lcpp_e);}
Richard Smith081bb592015-10-08 20:40:34 +0000917
918// ldexp
919
Shoaib Meenai159375f2017-04-07 02:20:52 +0000920#if !(defined(_AIX) || defined(__sun__))
Mehdi Aminib3da6322017-02-10 02:44:23 +0000921inline _LIBCPP_INLINE_VISIBILITY float ldexp(float __lcpp_x, int __lcpp_e) _NOEXCEPT {return ::ldexpf(__lcpp_x, __lcpp_e);}
922inline _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 +0000923#endif
924
925template <class _A1>
926inline _LIBCPP_INLINE_VISIBILITY
927typename std::enable_if<std::is_integral<_A1>::value, double>::type
Mehdi Aminib3da6322017-02-10 02:44:23 +0000928ldexp(_A1 __lcpp_x, int __lcpp_e) _NOEXCEPT {return ::ldexp((double)__lcpp_x, __lcpp_e);}
Richard Smith081bb592015-10-08 20:40:34 +0000929
930// log
931
Shoaib Meenai159375f2017-04-07 02:20:52 +0000932#if !(defined(_AIX) || defined(__sun__))
Mehdi Aminib3da6322017-02-10 02:44:23 +0000933inline _LIBCPP_INLINE_VISIBILITY float log(float __lcpp_x) _NOEXCEPT {return ::logf(__lcpp_x);}
934inline _LIBCPP_INLINE_VISIBILITY long double log(long double __lcpp_x) _NOEXCEPT {return ::logl(__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +0000935#endif
936
937template <class _A1>
938inline _LIBCPP_INLINE_VISIBILITY
939typename std::enable_if<std::is_integral<_A1>::value, double>::type
Mehdi Aminib3da6322017-02-10 02:44:23 +0000940log(_A1 __lcpp_x) _NOEXCEPT {return ::log((double)__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +0000941
942// log10
943
Shoaib Meenai159375f2017-04-07 02:20:52 +0000944#if !(defined(_AIX) || defined(__sun__))
Mehdi Aminib3da6322017-02-10 02:44:23 +0000945inline _LIBCPP_INLINE_VISIBILITY float log10(float __lcpp_x) _NOEXCEPT {return ::log10f(__lcpp_x);}
946inline _LIBCPP_INLINE_VISIBILITY long double log10(long double __lcpp_x) _NOEXCEPT {return ::log10l(__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +0000947#endif
948
949template <class _A1>
950inline _LIBCPP_INLINE_VISIBILITY
951typename std::enable_if<std::is_integral<_A1>::value, double>::type
Mehdi Aminib3da6322017-02-10 02:44:23 +0000952log10(_A1 __lcpp_x) _NOEXCEPT {return ::log10((double)__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +0000953
954// modf
955
Shoaib Meenai159375f2017-04-07 02:20:52 +0000956#if !(defined(_AIX) || defined(__sun__))
Mehdi Aminib3da6322017-02-10 02:44:23 +0000957inline _LIBCPP_INLINE_VISIBILITY float modf(float __lcpp_x, float* __lcpp_y) _NOEXCEPT {return ::modff(__lcpp_x, __lcpp_y);}
958inline _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 +0000959#endif
960
961// pow
962
Shoaib Meenai159375f2017-04-07 02:20:52 +0000963#if !(defined(_AIX) || defined(__sun__))
Mehdi Aminib3da6322017-02-10 02:44:23 +0000964inline _LIBCPP_INLINE_VISIBILITY float pow(float __lcpp_x, float __lcpp_y) _NOEXCEPT {return ::powf(__lcpp_x, __lcpp_y);}
965inline _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 +0000966#endif
967
968template <class _A1, class _A2>
969inline _LIBCPP_INLINE_VISIBILITY
970typename std::__lazy_enable_if
971<
972 std::is_arithmetic<_A1>::value &&
973 std::is_arithmetic<_A2>::value,
974 std::__promote<_A1, _A2>
975>::type
976pow(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
977{
978 typedef typename std::__promote<_A1, _A2>::type __result_type;
979 static_assert((!(std::is_same<_A1, __result_type>::value &&
980 std::is_same<_A2, __result_type>::value)), "");
Mehdi Aminib3da6322017-02-10 02:44:23 +0000981 return ::pow((__result_type)__lcpp_x, (__result_type)__lcpp_y);
Richard Smith081bb592015-10-08 20:40:34 +0000982}
983
984// sin
985
Shoaib Meenai159375f2017-04-07 02:20:52 +0000986#if !(defined(_AIX) || defined(__sun__))
Mehdi Aminib3da6322017-02-10 02:44:23 +0000987inline _LIBCPP_INLINE_VISIBILITY float sin(float __lcpp_x) _NOEXCEPT {return ::sinf(__lcpp_x);}
988inline _LIBCPP_INLINE_VISIBILITY long double sin(long double __lcpp_x) _NOEXCEPT {return ::sinl(__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +0000989#endif
990
991template <class _A1>
992inline _LIBCPP_INLINE_VISIBILITY
993typename std::enable_if<std::is_integral<_A1>::value, double>::type
Mehdi Aminib3da6322017-02-10 02:44:23 +0000994sin(_A1 __lcpp_x) _NOEXCEPT {return ::sin((double)__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +0000995
996// sinh
997
Shoaib Meenai159375f2017-04-07 02:20:52 +0000998#if !(defined(_AIX) || defined(__sun__))
Mehdi Aminib3da6322017-02-10 02:44:23 +0000999inline _LIBCPP_INLINE_VISIBILITY float sinh(float __lcpp_x) _NOEXCEPT {return ::sinhf(__lcpp_x);}
1000inline _LIBCPP_INLINE_VISIBILITY long double sinh(long double __lcpp_x) _NOEXCEPT {return ::sinhl(__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +00001001#endif
1002
1003template <class _A1>
1004inline _LIBCPP_INLINE_VISIBILITY
1005typename std::enable_if<std::is_integral<_A1>::value, double>::type
Mehdi Aminib3da6322017-02-10 02:44:23 +00001006sinh(_A1 __lcpp_x) _NOEXCEPT {return ::sinh((double)__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +00001007
1008// sqrt
1009
Shoaib Meenai159375f2017-04-07 02:20:52 +00001010#if !(defined(_AIX) || defined(__sun__))
Mehdi Aminib3da6322017-02-10 02:44:23 +00001011inline _LIBCPP_INLINE_VISIBILITY float sqrt(float __lcpp_x) _NOEXCEPT {return ::sqrtf(__lcpp_x);}
1012inline _LIBCPP_INLINE_VISIBILITY long double sqrt(long double __lcpp_x) _NOEXCEPT {return ::sqrtl(__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +00001013#endif
1014
Richard Smith081bb592015-10-08 20:40:34 +00001015template <class _A1>
1016inline _LIBCPP_INLINE_VISIBILITY
1017typename std::enable_if<std::is_integral<_A1>::value, double>::type
Mehdi Aminib3da6322017-02-10 02:44:23 +00001018sqrt(_A1 __lcpp_x) _NOEXCEPT {return ::sqrt((double)__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +00001019
1020// tan
1021
Shoaib Meenai159375f2017-04-07 02:20:52 +00001022#if !(defined(_AIX) || defined(__sun__))
Mehdi Aminib3da6322017-02-10 02:44:23 +00001023inline _LIBCPP_INLINE_VISIBILITY float tan(float __lcpp_x) _NOEXCEPT {return ::tanf(__lcpp_x);}
1024inline _LIBCPP_INLINE_VISIBILITY long double tan(long double __lcpp_x) _NOEXCEPT {return ::tanl(__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +00001025#endif
1026
1027template <class _A1>
1028inline _LIBCPP_INLINE_VISIBILITY
1029typename std::enable_if<std::is_integral<_A1>::value, double>::type
Mehdi Aminib3da6322017-02-10 02:44:23 +00001030tan(_A1 __lcpp_x) _NOEXCEPT {return ::tan((double)__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +00001031
1032// tanh
1033
Shoaib Meenai159375f2017-04-07 02:20:52 +00001034#if !(defined(_AIX) || defined(__sun__))
Mehdi Aminib3da6322017-02-10 02:44:23 +00001035inline _LIBCPP_INLINE_VISIBILITY float tanh(float __lcpp_x) _NOEXCEPT {return ::tanhf(__lcpp_x);}
1036inline _LIBCPP_INLINE_VISIBILITY long double tanh(long double __lcpp_x) _NOEXCEPT {return ::tanhl(__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +00001037#endif
1038
1039template <class _A1>
1040inline _LIBCPP_INLINE_VISIBILITY
1041typename std::enable_if<std::is_integral<_A1>::value, double>::type
Mehdi Aminib3da6322017-02-10 02:44:23 +00001042tanh(_A1 __lcpp_x) _NOEXCEPT {return ::tanh((double)__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +00001043
1044// acosh
1045
Mehdi Aminib3da6322017-02-10 02:44:23 +00001046inline _LIBCPP_INLINE_VISIBILITY float acosh(float __lcpp_x) _NOEXCEPT {return ::acoshf(__lcpp_x);}
1047inline _LIBCPP_INLINE_VISIBILITY long double acosh(long double __lcpp_x) _NOEXCEPT {return ::acoshl(__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +00001048
1049template <class _A1>
1050inline _LIBCPP_INLINE_VISIBILITY
1051typename std::enable_if<std::is_integral<_A1>::value, double>::type
Mehdi Aminib3da6322017-02-10 02:44:23 +00001052acosh(_A1 __lcpp_x) _NOEXCEPT {return ::acosh((double)__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +00001053
1054// asinh
1055
Mehdi Aminib3da6322017-02-10 02:44:23 +00001056inline _LIBCPP_INLINE_VISIBILITY float asinh(float __lcpp_x) _NOEXCEPT {return ::asinhf(__lcpp_x);}
1057inline _LIBCPP_INLINE_VISIBILITY long double asinh(long double __lcpp_x) _NOEXCEPT {return ::asinhl(__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +00001058
1059template <class _A1>
1060inline _LIBCPP_INLINE_VISIBILITY
1061typename std::enable_if<std::is_integral<_A1>::value, double>::type
Mehdi Aminib3da6322017-02-10 02:44:23 +00001062asinh(_A1 __lcpp_x) _NOEXCEPT {return ::asinh((double)__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +00001063
1064// atanh
1065
Mehdi Aminib3da6322017-02-10 02:44:23 +00001066inline _LIBCPP_INLINE_VISIBILITY float atanh(float __lcpp_x) _NOEXCEPT {return ::atanhf(__lcpp_x);}
1067inline _LIBCPP_INLINE_VISIBILITY long double atanh(long double __lcpp_x) _NOEXCEPT {return ::atanhl(__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +00001068
1069template <class _A1>
1070inline _LIBCPP_INLINE_VISIBILITY
1071typename std::enable_if<std::is_integral<_A1>::value, double>::type
Mehdi Aminib3da6322017-02-10 02:44:23 +00001072atanh(_A1 __lcpp_x) _NOEXCEPT {return ::atanh((double)__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +00001073
1074// cbrt
1075
Mehdi Aminib3da6322017-02-10 02:44:23 +00001076inline _LIBCPP_INLINE_VISIBILITY float cbrt(float __lcpp_x) _NOEXCEPT {return ::cbrtf(__lcpp_x);}
1077inline _LIBCPP_INLINE_VISIBILITY long double cbrt(long double __lcpp_x) _NOEXCEPT {return ::cbrtl(__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +00001078
1079template <class _A1>
1080inline _LIBCPP_INLINE_VISIBILITY
1081typename std::enable_if<std::is_integral<_A1>::value, double>::type
Mehdi Aminib3da6322017-02-10 02:44:23 +00001082cbrt(_A1 __lcpp_x) _NOEXCEPT {return ::cbrt((double)__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +00001083
1084// copysign
1085
Richard Smith081bb592015-10-08 20:40:34 +00001086inline _LIBCPP_INLINE_VISIBILITY float copysign(float __lcpp_x,
1087 float __lcpp_y) _NOEXCEPT {
Mehdi Aminib3da6322017-02-10 02:44:23 +00001088 return ::copysignf(__lcpp_x, __lcpp_y);
Richard Smith081bb592015-10-08 20:40:34 +00001089}
1090inline _LIBCPP_INLINE_VISIBILITY long double
1091copysign(long double __lcpp_x, long double __lcpp_y) _NOEXCEPT {
Mehdi Aminib3da6322017-02-10 02:44:23 +00001092 return ::copysignl(__lcpp_x, __lcpp_y);
Richard Smith081bb592015-10-08 20:40:34 +00001093}
Richard Smith081bb592015-10-08 20:40:34 +00001094
1095template <class _A1, class _A2>
1096inline _LIBCPP_INLINE_VISIBILITY
1097typename std::__lazy_enable_if
1098<
1099 std::is_arithmetic<_A1>::value &&
1100 std::is_arithmetic<_A2>::value,
1101 std::__promote<_A1, _A2>
1102>::type
1103copysign(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
1104{
1105 typedef typename std::__promote<_A1, _A2>::type __result_type;
1106 static_assert((!(std::is_same<_A1, __result_type>::value &&
1107 std::is_same<_A2, __result_type>::value)), "");
Mehdi Aminib3da6322017-02-10 02:44:23 +00001108 return ::copysign((__result_type)__lcpp_x, (__result_type)__lcpp_y);
Richard Smith081bb592015-10-08 20:40:34 +00001109}
1110
Richard Smith081bb592015-10-08 20:40:34 +00001111// erf
1112
Mehdi Aminib3da6322017-02-10 02:44:23 +00001113inline _LIBCPP_INLINE_VISIBILITY float erf(float __lcpp_x) _NOEXCEPT {return ::erff(__lcpp_x);}
1114inline _LIBCPP_INLINE_VISIBILITY long double erf(long double __lcpp_x) _NOEXCEPT {return ::erfl(__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +00001115
1116template <class _A1>
1117inline _LIBCPP_INLINE_VISIBILITY
1118typename std::enable_if<std::is_integral<_A1>::value, double>::type
Mehdi Aminib3da6322017-02-10 02:44:23 +00001119erf(_A1 __lcpp_x) _NOEXCEPT {return ::erf((double)__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +00001120
1121// erfc
1122
Mehdi Aminib3da6322017-02-10 02:44:23 +00001123inline _LIBCPP_INLINE_VISIBILITY float erfc(float __lcpp_x) _NOEXCEPT {return ::erfcf(__lcpp_x);}
1124inline _LIBCPP_INLINE_VISIBILITY long double erfc(long double __lcpp_x) _NOEXCEPT {return ::erfcl(__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +00001125
1126template <class _A1>
1127inline _LIBCPP_INLINE_VISIBILITY
1128typename std::enable_if<std::is_integral<_A1>::value, double>::type
Mehdi Aminib3da6322017-02-10 02:44:23 +00001129erfc(_A1 __lcpp_x) _NOEXCEPT {return ::erfc((double)__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +00001130
1131// exp2
1132
Mehdi Aminib3da6322017-02-10 02:44:23 +00001133inline _LIBCPP_INLINE_VISIBILITY float exp2(float __lcpp_x) _NOEXCEPT {return ::exp2f(__lcpp_x);}
1134inline _LIBCPP_INLINE_VISIBILITY long double exp2(long double __lcpp_x) _NOEXCEPT {return ::exp2l(__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +00001135
1136template <class _A1>
1137inline _LIBCPP_INLINE_VISIBILITY
1138typename std::enable_if<std::is_integral<_A1>::value, double>::type
Mehdi Aminib3da6322017-02-10 02:44:23 +00001139exp2(_A1 __lcpp_x) _NOEXCEPT {return ::exp2((double)__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +00001140
1141// expm1
1142
Mehdi Aminib3da6322017-02-10 02:44:23 +00001143inline _LIBCPP_INLINE_VISIBILITY float expm1(float __lcpp_x) _NOEXCEPT {return ::expm1f(__lcpp_x);}
1144inline _LIBCPP_INLINE_VISIBILITY long double expm1(long double __lcpp_x) _NOEXCEPT {return ::expm1l(__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +00001145
1146template <class _A1>
1147inline _LIBCPP_INLINE_VISIBILITY
1148typename std::enable_if<std::is_integral<_A1>::value, double>::type
Mehdi Aminib3da6322017-02-10 02:44:23 +00001149expm1(_A1 __lcpp_x) _NOEXCEPT {return ::expm1((double)__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +00001150
1151// fdim
1152
Mehdi Aminib3da6322017-02-10 02:44:23 +00001153inline _LIBCPP_INLINE_VISIBILITY float fdim(float __lcpp_x, float __lcpp_y) _NOEXCEPT {return ::fdimf(__lcpp_x, __lcpp_y);}
1154inline _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 +00001155
1156template <class _A1, class _A2>
1157inline _LIBCPP_INLINE_VISIBILITY
1158typename std::__lazy_enable_if
1159<
1160 std::is_arithmetic<_A1>::value &&
1161 std::is_arithmetic<_A2>::value,
1162 std::__promote<_A1, _A2>
1163>::type
1164fdim(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
1165{
1166 typedef typename std::__promote<_A1, _A2>::type __result_type;
1167 static_assert((!(std::is_same<_A1, __result_type>::value &&
1168 std::is_same<_A2, __result_type>::value)), "");
Mehdi Aminib3da6322017-02-10 02:44:23 +00001169 return ::fdim((__result_type)__lcpp_x, (__result_type)__lcpp_y);
Richard Smith081bb592015-10-08 20:40:34 +00001170}
1171
1172// fma
1173
Mehdi Aminib3da6322017-02-10 02:44:23 +00001174inline _LIBCPP_INLINE_VISIBILITY float fma(float __lcpp_x, float __lcpp_y, float __lcpp_z) _NOEXCEPT {return ::fmaf(__lcpp_x, __lcpp_y, __lcpp_z);}
1175inline _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 +00001176
1177template <class _A1, class _A2, class _A3>
1178inline _LIBCPP_INLINE_VISIBILITY
1179typename std::__lazy_enable_if
1180<
1181 std::is_arithmetic<_A1>::value &&
1182 std::is_arithmetic<_A2>::value &&
1183 std::is_arithmetic<_A3>::value,
1184 std::__promote<_A1, _A2, _A3>
1185>::type
1186fma(_A1 __lcpp_x, _A2 __lcpp_y, _A3 __lcpp_z) _NOEXCEPT
1187{
1188 typedef typename std::__promote<_A1, _A2, _A3>::type __result_type;
1189 static_assert((!(std::is_same<_A1, __result_type>::value &&
1190 std::is_same<_A2, __result_type>::value &&
1191 std::is_same<_A3, __result_type>::value)), "");
Mehdi Aminib3da6322017-02-10 02:44:23 +00001192 return ::fma((__result_type)__lcpp_x, (__result_type)__lcpp_y, (__result_type)__lcpp_z);
Richard Smith081bb592015-10-08 20:40:34 +00001193}
1194
1195// fmax
1196
Mehdi Aminib3da6322017-02-10 02:44:23 +00001197inline _LIBCPP_INLINE_VISIBILITY float fmax(float __lcpp_x, float __lcpp_y) _NOEXCEPT {return ::fmaxf(__lcpp_x, __lcpp_y);}
1198inline _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 +00001199
1200template <class _A1, class _A2>
1201inline _LIBCPP_INLINE_VISIBILITY
1202typename std::__lazy_enable_if
1203<
1204 std::is_arithmetic<_A1>::value &&
1205 std::is_arithmetic<_A2>::value,
1206 std::__promote<_A1, _A2>
1207>::type
1208fmax(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
1209{
1210 typedef typename std::__promote<_A1, _A2>::type __result_type;
1211 static_assert((!(std::is_same<_A1, __result_type>::value &&
1212 std::is_same<_A2, __result_type>::value)), "");
Mehdi Aminib3da6322017-02-10 02:44:23 +00001213 return ::fmax((__result_type)__lcpp_x, (__result_type)__lcpp_y);
Richard Smith081bb592015-10-08 20:40:34 +00001214}
1215
1216// fmin
1217
Mehdi Aminib3da6322017-02-10 02:44:23 +00001218inline _LIBCPP_INLINE_VISIBILITY float fmin(float __lcpp_x, float __lcpp_y) _NOEXCEPT {return ::fminf(__lcpp_x, __lcpp_y);}
1219inline _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 +00001220
1221template <class _A1, class _A2>
1222inline _LIBCPP_INLINE_VISIBILITY
1223typename std::__lazy_enable_if
1224<
1225 std::is_arithmetic<_A1>::value &&
1226 std::is_arithmetic<_A2>::value,
1227 std::__promote<_A1, _A2>
1228>::type
1229fmin(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
1230{
1231 typedef typename std::__promote<_A1, _A2>::type __result_type;
1232 static_assert((!(std::is_same<_A1, __result_type>::value &&
1233 std::is_same<_A2, __result_type>::value)), "");
Mehdi Aminib3da6322017-02-10 02:44:23 +00001234 return ::fmin((__result_type)__lcpp_x, (__result_type)__lcpp_y);
Richard Smith081bb592015-10-08 20:40:34 +00001235}
1236
1237// hypot
1238
Mehdi Aminib3da6322017-02-10 02:44:23 +00001239inline _LIBCPP_INLINE_VISIBILITY float hypot(float __lcpp_x, float __lcpp_y) _NOEXCEPT {return ::hypotf(__lcpp_x, __lcpp_y);}
1240inline _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 +00001241
1242template <class _A1, class _A2>
1243inline _LIBCPP_INLINE_VISIBILITY
1244typename std::__lazy_enable_if
1245<
1246 std::is_arithmetic<_A1>::value &&
1247 std::is_arithmetic<_A2>::value,
1248 std::__promote<_A1, _A2>
1249>::type
1250hypot(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
1251{
1252 typedef typename std::__promote<_A1, _A2>::type __result_type;
1253 static_assert((!(std::is_same<_A1, __result_type>::value &&
1254 std::is_same<_A2, __result_type>::value)), "");
Mehdi Aminib3da6322017-02-10 02:44:23 +00001255 return ::hypot((__result_type)__lcpp_x, (__result_type)__lcpp_y);
Richard Smith081bb592015-10-08 20:40:34 +00001256}
1257
1258// ilogb
1259
Mehdi Aminib3da6322017-02-10 02:44:23 +00001260inline _LIBCPP_INLINE_VISIBILITY int ilogb(float __lcpp_x) _NOEXCEPT {return ::ilogbf(__lcpp_x);}
1261inline _LIBCPP_INLINE_VISIBILITY int ilogb(long double __lcpp_x) _NOEXCEPT {return ::ilogbl(__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +00001262
1263template <class _A1>
1264inline _LIBCPP_INLINE_VISIBILITY
1265typename std::enable_if<std::is_integral<_A1>::value, int>::type
Mehdi Aminib3da6322017-02-10 02:44:23 +00001266ilogb(_A1 __lcpp_x) _NOEXCEPT {return ::ilogb((double)__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +00001267
1268// lgamma
1269
Mehdi Aminib3da6322017-02-10 02:44:23 +00001270inline _LIBCPP_INLINE_VISIBILITY float lgamma(float __lcpp_x) _NOEXCEPT {return ::lgammaf(__lcpp_x);}
1271inline _LIBCPP_INLINE_VISIBILITY long double lgamma(long double __lcpp_x) _NOEXCEPT {return ::lgammal(__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +00001272
1273template <class _A1>
1274inline _LIBCPP_INLINE_VISIBILITY
1275typename std::enable_if<std::is_integral<_A1>::value, double>::type
Mehdi Aminib3da6322017-02-10 02:44:23 +00001276lgamma(_A1 __lcpp_x) _NOEXCEPT {return ::lgamma((double)__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +00001277
1278// llrint
1279
Mehdi Aminib3da6322017-02-10 02:44:23 +00001280inline _LIBCPP_INLINE_VISIBILITY long long llrint(float __lcpp_x) _NOEXCEPT {return ::llrintf(__lcpp_x);}
1281inline _LIBCPP_INLINE_VISIBILITY long long llrint(long double __lcpp_x) _NOEXCEPT {return ::llrintl(__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +00001282
1283template <class _A1>
1284inline _LIBCPP_INLINE_VISIBILITY
1285typename std::enable_if<std::is_integral<_A1>::value, long long>::type
Mehdi Aminib3da6322017-02-10 02:44:23 +00001286llrint(_A1 __lcpp_x) _NOEXCEPT {return ::llrint((double)__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +00001287
1288// llround
1289
Mehdi Aminib3da6322017-02-10 02:44:23 +00001290inline _LIBCPP_INLINE_VISIBILITY long long llround(float __lcpp_x) _NOEXCEPT {return ::llroundf(__lcpp_x);}
1291inline _LIBCPP_INLINE_VISIBILITY long long llround(long double __lcpp_x) _NOEXCEPT {return ::llroundl(__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +00001292
1293template <class _A1>
1294inline _LIBCPP_INLINE_VISIBILITY
1295typename std::enable_if<std::is_integral<_A1>::value, long long>::type
Mehdi Aminib3da6322017-02-10 02:44:23 +00001296llround(_A1 __lcpp_x) _NOEXCEPT {return ::llround((double)__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +00001297
1298// log1p
1299
Mehdi Aminib3da6322017-02-10 02:44:23 +00001300inline _LIBCPP_INLINE_VISIBILITY float log1p(float __lcpp_x) _NOEXCEPT {return ::log1pf(__lcpp_x);}
1301inline _LIBCPP_INLINE_VISIBILITY long double log1p(long double __lcpp_x) _NOEXCEPT {return ::log1pl(__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +00001302
1303template <class _A1>
1304inline _LIBCPP_INLINE_VISIBILITY
1305typename std::enable_if<std::is_integral<_A1>::value, double>::type
Mehdi Aminib3da6322017-02-10 02:44:23 +00001306log1p(_A1 __lcpp_x) _NOEXCEPT {return ::log1p((double)__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +00001307
1308// log2
1309
Mehdi Aminib3da6322017-02-10 02:44:23 +00001310inline _LIBCPP_INLINE_VISIBILITY float log2(float __lcpp_x) _NOEXCEPT {return ::log2f(__lcpp_x);}
1311inline _LIBCPP_INLINE_VISIBILITY long double log2(long double __lcpp_x) _NOEXCEPT {return ::log2l(__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +00001312
1313template <class _A1>
1314inline _LIBCPP_INLINE_VISIBILITY
1315typename std::enable_if<std::is_integral<_A1>::value, double>::type
Mehdi Aminib3da6322017-02-10 02:44:23 +00001316log2(_A1 __lcpp_x) _NOEXCEPT {return ::log2((double)__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +00001317
1318// logb
1319
Mehdi Aminib3da6322017-02-10 02:44:23 +00001320inline _LIBCPP_INLINE_VISIBILITY float logb(float __lcpp_x) _NOEXCEPT {return ::logbf(__lcpp_x);}
1321inline _LIBCPP_INLINE_VISIBILITY long double logb(long double __lcpp_x) _NOEXCEPT {return ::logbl(__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +00001322
1323template <class _A1>
1324inline _LIBCPP_INLINE_VISIBILITY
1325typename std::enable_if<std::is_integral<_A1>::value, double>::type
Mehdi Aminib3da6322017-02-10 02:44:23 +00001326logb(_A1 __lcpp_x) _NOEXCEPT {return ::logb((double)__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +00001327
1328// lrint
1329
Mehdi Aminib3da6322017-02-10 02:44:23 +00001330inline _LIBCPP_INLINE_VISIBILITY long lrint(float __lcpp_x) _NOEXCEPT {return ::lrintf(__lcpp_x);}
1331inline _LIBCPP_INLINE_VISIBILITY long lrint(long double __lcpp_x) _NOEXCEPT {return ::lrintl(__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +00001332
1333template <class _A1>
1334inline _LIBCPP_INLINE_VISIBILITY
1335typename std::enable_if<std::is_integral<_A1>::value, long>::type
Mehdi Aminib3da6322017-02-10 02:44:23 +00001336lrint(_A1 __lcpp_x) _NOEXCEPT {return ::lrint((double)__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +00001337
1338// lround
1339
Mehdi Aminib3da6322017-02-10 02:44:23 +00001340inline _LIBCPP_INLINE_VISIBILITY long lround(float __lcpp_x) _NOEXCEPT {return ::lroundf(__lcpp_x);}
1341inline _LIBCPP_INLINE_VISIBILITY long lround(long double __lcpp_x) _NOEXCEPT {return ::lroundl(__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +00001342
1343template <class _A1>
1344inline _LIBCPP_INLINE_VISIBILITY
1345typename std::enable_if<std::is_integral<_A1>::value, long>::type
Mehdi Aminib3da6322017-02-10 02:44:23 +00001346lround(_A1 __lcpp_x) _NOEXCEPT {return ::lround((double)__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +00001347
1348// nan
1349
1350// nearbyint
1351
Mehdi Aminib3da6322017-02-10 02:44:23 +00001352inline _LIBCPP_INLINE_VISIBILITY float nearbyint(float __lcpp_x) _NOEXCEPT {return ::nearbyintf(__lcpp_x);}
1353inline _LIBCPP_INLINE_VISIBILITY long double nearbyint(long double __lcpp_x) _NOEXCEPT {return ::nearbyintl(__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +00001354
1355template <class _A1>
1356inline _LIBCPP_INLINE_VISIBILITY
1357typename std::enable_if<std::is_integral<_A1>::value, double>::type
Mehdi Aminib3da6322017-02-10 02:44:23 +00001358nearbyint(_A1 __lcpp_x) _NOEXCEPT {return ::nearbyint((double)__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +00001359
1360// nextafter
1361
Mehdi Aminib3da6322017-02-10 02:44:23 +00001362inline _LIBCPP_INLINE_VISIBILITY float nextafter(float __lcpp_x, float __lcpp_y) _NOEXCEPT {return ::nextafterf(__lcpp_x, __lcpp_y);}
1363inline _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 +00001364
1365template <class _A1, class _A2>
1366inline _LIBCPP_INLINE_VISIBILITY
1367typename std::__lazy_enable_if
1368<
1369 std::is_arithmetic<_A1>::value &&
1370 std::is_arithmetic<_A2>::value,
1371 std::__promote<_A1, _A2>
1372>::type
1373nextafter(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
1374{
1375 typedef typename std::__promote<_A1, _A2>::type __result_type;
1376 static_assert((!(std::is_same<_A1, __result_type>::value &&
1377 std::is_same<_A2, __result_type>::value)), "");
Mehdi Aminib3da6322017-02-10 02:44:23 +00001378 return ::nextafter((__result_type)__lcpp_x, (__result_type)__lcpp_y);
Richard Smith081bb592015-10-08 20:40:34 +00001379}
1380
1381// nexttoward
1382
Mehdi Aminib3da6322017-02-10 02:44:23 +00001383inline _LIBCPP_INLINE_VISIBILITY float nexttoward(float __lcpp_x, long double __lcpp_y) _NOEXCEPT {return ::nexttowardf(__lcpp_x, __lcpp_y);}
1384inline _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 +00001385
1386template <class _A1>
1387inline _LIBCPP_INLINE_VISIBILITY
1388typename std::enable_if<std::is_integral<_A1>::value, double>::type
Mehdi Aminib3da6322017-02-10 02:44:23 +00001389nexttoward(_A1 __lcpp_x, long double __lcpp_y) _NOEXCEPT {return ::nexttoward((double)__lcpp_x, __lcpp_y);}
Richard Smith081bb592015-10-08 20:40:34 +00001390
1391// remainder
1392
Mehdi Aminib3da6322017-02-10 02:44:23 +00001393inline _LIBCPP_INLINE_VISIBILITY float remainder(float __lcpp_x, float __lcpp_y) _NOEXCEPT {return ::remainderf(__lcpp_x, __lcpp_y);}
1394inline _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 +00001395
1396template <class _A1, class _A2>
1397inline _LIBCPP_INLINE_VISIBILITY
1398typename std::__lazy_enable_if
1399<
1400 std::is_arithmetic<_A1>::value &&
1401 std::is_arithmetic<_A2>::value,
1402 std::__promote<_A1, _A2>
1403>::type
1404remainder(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
1405{
1406 typedef typename std::__promote<_A1, _A2>::type __result_type;
1407 static_assert((!(std::is_same<_A1, __result_type>::value &&
1408 std::is_same<_A2, __result_type>::value)), "");
Mehdi Aminib3da6322017-02-10 02:44:23 +00001409 return ::remainder((__result_type)__lcpp_x, (__result_type)__lcpp_y);
Richard Smith081bb592015-10-08 20:40:34 +00001410}
1411
1412// remquo
1413
Mehdi Aminib3da6322017-02-10 02:44:23 +00001414inline _LIBCPP_INLINE_VISIBILITY float remquo(float __lcpp_x, float __lcpp_y, int* __lcpp_z) _NOEXCEPT {return ::remquof(__lcpp_x, __lcpp_y, __lcpp_z);}
1415inline _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 +00001416
1417template <class _A1, class _A2>
1418inline _LIBCPP_INLINE_VISIBILITY
1419typename std::__lazy_enable_if
1420<
1421 std::is_arithmetic<_A1>::value &&
1422 std::is_arithmetic<_A2>::value,
1423 std::__promote<_A1, _A2>
1424>::type
1425remquo(_A1 __lcpp_x, _A2 __lcpp_y, int* __lcpp_z) _NOEXCEPT
1426{
1427 typedef typename std::__promote<_A1, _A2>::type __result_type;
1428 static_assert((!(std::is_same<_A1, __result_type>::value &&
1429 std::is_same<_A2, __result_type>::value)), "");
Mehdi Aminib3da6322017-02-10 02:44:23 +00001430 return ::remquo((__result_type)__lcpp_x, (__result_type)__lcpp_y, __lcpp_z);
Richard Smith081bb592015-10-08 20:40:34 +00001431}
1432
1433// rint
1434
Mehdi Aminib3da6322017-02-10 02:44:23 +00001435inline _LIBCPP_INLINE_VISIBILITY float rint(float __lcpp_x) _NOEXCEPT {return ::rintf(__lcpp_x);}
1436inline _LIBCPP_INLINE_VISIBILITY long double rint(long double __lcpp_x) _NOEXCEPT {return ::rintl(__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +00001437
1438template <class _A1>
1439inline _LIBCPP_INLINE_VISIBILITY
1440typename std::enable_if<std::is_integral<_A1>::value, double>::type
Mehdi Aminib3da6322017-02-10 02:44:23 +00001441rint(_A1 __lcpp_x) _NOEXCEPT {return ::rint((double)__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +00001442
1443// round
1444
Mehdi Aminib3da6322017-02-10 02:44:23 +00001445inline _LIBCPP_INLINE_VISIBILITY float round(float __lcpp_x) _NOEXCEPT {return ::roundf(__lcpp_x);}
1446inline _LIBCPP_INLINE_VISIBILITY long double round(long double __lcpp_x) _NOEXCEPT {return ::roundl(__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +00001447
1448template <class _A1>
1449inline _LIBCPP_INLINE_VISIBILITY
1450typename std::enable_if<std::is_integral<_A1>::value, double>::type
Mehdi Aminib3da6322017-02-10 02:44:23 +00001451round(_A1 __lcpp_x) _NOEXCEPT {return ::round((double)__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +00001452
1453// scalbln
1454
Mehdi Aminib3da6322017-02-10 02:44:23 +00001455inline _LIBCPP_INLINE_VISIBILITY float scalbln(float __lcpp_x, long __lcpp_y) _NOEXCEPT {return ::scalblnf(__lcpp_x, __lcpp_y);}
1456inline _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 +00001457
1458template <class _A1>
1459inline _LIBCPP_INLINE_VISIBILITY
1460typename std::enable_if<std::is_integral<_A1>::value, double>::type
Mehdi Aminib3da6322017-02-10 02:44:23 +00001461scalbln(_A1 __lcpp_x, long __lcpp_y) _NOEXCEPT {return ::scalbln((double)__lcpp_x, __lcpp_y);}
Richard Smith081bb592015-10-08 20:40:34 +00001462
1463// scalbn
1464
Mehdi Aminib3da6322017-02-10 02:44:23 +00001465inline _LIBCPP_INLINE_VISIBILITY float scalbn(float __lcpp_x, int __lcpp_y) _NOEXCEPT {return ::scalbnf(__lcpp_x, __lcpp_y);}
1466inline _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 +00001467
1468template <class _A1>
1469inline _LIBCPP_INLINE_VISIBILITY
1470typename std::enable_if<std::is_integral<_A1>::value, double>::type
Mehdi Aminib3da6322017-02-10 02:44:23 +00001471scalbn(_A1 __lcpp_x, int __lcpp_y) _NOEXCEPT {return ::scalbn((double)__lcpp_x, __lcpp_y);}
Richard Smith081bb592015-10-08 20:40:34 +00001472
1473// tgamma
1474
Mehdi Aminib3da6322017-02-10 02:44:23 +00001475inline _LIBCPP_INLINE_VISIBILITY float tgamma(float __lcpp_x) _NOEXCEPT {return ::tgammaf(__lcpp_x);}
1476inline _LIBCPP_INLINE_VISIBILITY long double tgamma(long double __lcpp_x) _NOEXCEPT {return ::tgammal(__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +00001477
1478template <class _A1>
1479inline _LIBCPP_INLINE_VISIBILITY
1480typename std::enable_if<std::is_integral<_A1>::value, double>::type
Mehdi Aminib3da6322017-02-10 02:44:23 +00001481tgamma(_A1 __lcpp_x) _NOEXCEPT {return ::tgamma((double)__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +00001482
1483// trunc
1484
Mehdi Aminib3da6322017-02-10 02:44:23 +00001485inline _LIBCPP_INLINE_VISIBILITY float trunc(float __lcpp_x) _NOEXCEPT {return ::truncf(__lcpp_x);}
1486inline _LIBCPP_INLINE_VISIBILITY long double trunc(long double __lcpp_x) _NOEXCEPT {return ::truncl(__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +00001487
1488template <class _A1>
1489inline _LIBCPP_INLINE_VISIBILITY
1490typename std::enable_if<std::is_integral<_A1>::value, double>::type
Mehdi Aminib3da6322017-02-10 02:44:23 +00001491trunc(_A1 __lcpp_x) _NOEXCEPT {return ::trunc((double)__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +00001492
Richard Smith081bb592015-10-08 20:40:34 +00001493} // extern "C++"
1494
1495#endif // __cplusplus
1496
1497#endif // _LIBCPP_MATH_H