blob: 4f279783a909a793591465fe6f37b3e723ad2d2b [file] [log] [blame]
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001// -*- C++ -*-
2//===---------------------------- cmath -----------------------------------===//
3//
Howard Hinnantf5256e12010-05-11 21:36:01 +00004// The LLVM Compiler Infrastructure
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00005//
Howard Hinnantb64f8b02010-11-16 22:09:02 +00006// This file is dual licensed under the MIT and the University of Illinois Open
7// Source Licenses. See LICENSE.TXT for details.
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00008//
9//===----------------------------------------------------------------------===//
10
11#ifndef _LIBCPP_CMATH
12#define _LIBCPP_CMATH
13
14/*
15 cmath 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
38namespace std
39{
40
41Types:
42
43 float_t // C99
44 double_t // C99
45
46// C90
47
48floating_point abs(floating_point x);
49
50floating_point acos (arithmetic x);
51float acosf(float x);
52long double acosl(long double x);
53
54floating_point asin (arithmetic x);
55float asinf(float x);
56long double asinl(long double x);
57
58floating_point atan (arithmetic x);
59float atanf(float x);
60long double atanl(long double x);
61
62floating_point atan2 (arithmetic y, arithmetic x);
63float atan2f(float y, float x);
64long double atan2l(long double y, long double x);
65
66floating_point ceil (arithmetic x);
67float ceilf(float x);
68long double ceill(long double x);
69
70floating_point cos (arithmetic x);
71float cosf(float x);
72long double cosl(long double x);
73
74floating_point cosh (arithmetic x);
75float coshf(float x);
76long double coshl(long double x);
77
78floating_point exp (arithmetic x);
79float expf(float x);
80long double expl(long double x);
81
82floating_point fabs (arithmetic x);
83float fabsf(float x);
84long double fabsl(long double x);
85
86floating_point floor (arithmetic x);
87float floorf(float x);
88long double floorl(long double x);
89
90floating_point fmod (arithmetic x, arithmetic y);
91float fmodf(float x, float y);
92long double fmodl(long double x, long double y);
93
94floating_point frexp (arithmetic value, int* exp);
95float frexpf(float value, int* exp);
96long double frexpl(long double value, int* exp);
97
98floating_point ldexp (arithmetic value, int exp);
99float ldexpf(float value, int exp);
100long double ldexpl(long double value, int exp);
101
102floating_point log (arithmetic x);
103float logf(float x);
104long double logl(long double x);
105
106floating_point log10 (arithmetic x);
107float log10f(float x);
108long double log10l(long double x);
109
110floating_point modf (floating_point value, floating_point* iptr);
111float modff(float value, float* iptr);
112long double modfl(long double value, long double* iptr);
113
114floating_point pow (arithmetic x, arithmetic y);
115float powf(float x, float y);
116long double powl(long double x, long double y);
117
118floating_point sin (arithmetic x);
119float sinf(float x);
120long double sinl(long double x);
121
122floating_point sinh (arithmetic x);
123float sinhf(float x);
124long double sinhl(long double x);
125
126floating_point sqrt (arithmetic x);
127float sqrtf(float x);
128long double sqrtl(long double x);
129
130floating_point tan (arithmetic x);
131float tanf(float x);
132long double tanl(long double x);
133
134floating_point tanh (arithmetic x);
135float tanhf(float x);
136long double tanhl(long double x);
137
138// C99
139
Howard Hinnantb05a5562013-01-14 20:56:22 +0000140bool signbit(arithmetic x);
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000141
Howard Hinnantb05a5562013-01-14 20:56:22 +0000142int fpclassify(arithmetic x);
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000143
Howard Hinnantb05a5562013-01-14 20:56:22 +0000144bool isfinite(arithmetic x);
145bool isinf(arithmetic x);
146bool isnan(arithmetic x);
147bool isnormal(arithmetic x);
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000148
Howard Hinnantb05a5562013-01-14 20:56:22 +0000149bool isgreater(arithmetic x, arithmetic y);
150bool isgreaterequal(arithmetic x, arithmetic y);
151bool isless(arithmetic x, arithmetic y);
152bool islessequal(arithmetic x, arithmetic y);
153bool islessgreater(arithmetic x, arithmetic y);
154bool isunordered(arithmetic x, arithmetic y);
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000155
156floating_point acosh (arithmetic x);
157float acoshf(float x);
158long double acoshl(long double x);
159
160floating_point asinh (arithmetic x);
161float asinhf(float x);
162long double asinhl(long double x);
163
164floating_point atanh (arithmetic x);
165float atanhf(float x);
166long double atanhl(long double x);
167
168floating_point cbrt (arithmetic x);
169float cbrtf(float x);
170long double cbrtl(long double x);
171
172floating_point copysign (arithmetic x, arithmetic y);
173float copysignf(float x, float y);
174long double copysignl(long double x, long double y);
175
176floating_point erf (arithmetic x);
177float erff(float x);
178long double erfl(long double x);
179
180floating_point erfc (arithmetic x);
181float erfcf(float x);
182long double erfcl(long double x);
183
184floating_point exp2 (arithmetic x);
185float exp2f(float x);
186long double exp2l(long double x);
187
188floating_point expm1 (arithmetic x);
189float expm1f(float x);
190long double expm1l(long double x);
191
192floating_point fdim (arithmetic x, arithmetic y);
193float fdimf(float x, float y);
194long double fdiml(long double x, long double y);
195
196floating_point fma (arithmetic x, arithmetic y, arithmetic z);
197float fmaf(float x, float y, float z);
198long double fmal(long double x, long double y, long double z);
199
200floating_point fmax (arithmetic x, arithmetic y);
201float fmaxf(float x, float y);
202long double fmaxl(long double x, long double y);
203
204floating_point fmin (arithmetic x, arithmetic y);
205float fminf(float x, float y);
206long double fminl(long double x, long double y);
207
208floating_point hypot (arithmetic x, arithmetic y);
209float hypotf(float x, float y);
210long double hypotl(long double x, long double y);
211
212int ilogb (arithmetic x);
213int ilogbf(float x);
214int ilogbl(long double x);
215
216floating_point lgamma (arithmetic x);
217float lgammaf(float x);
218long double lgammal(long double x);
219
220long long llrint (arithmetic x);
221long long llrintf(float x);
222long long llrintl(long double x);
223
224long long llround (arithmetic x);
225long long llroundf(float x);
226long long llroundl(long double x);
227
228floating_point log1p (arithmetic x);
229float log1pf(float x);
230long double log1pl(long double x);
231
232floating_point log2 (arithmetic x);
233float log2f(float x);
234long double log2l(long double x);
235
236floating_point logb (arithmetic x);
237float logbf(float x);
238long double logbl(long double x);
239
240long lrint (arithmetic x);
241long lrintf(float x);
242long lrintl(long double x);
243
244long lround (arithmetic x);
245long lroundf(float x);
246long lroundl(long double x);
247
248double nan (const char* str);
249float nanf(const char* str);
250long double nanl(const char* str);
251
252floating_point nearbyint (arithmetic x);
253float nearbyintf(float x);
254long double nearbyintl(long double x);
255
256floating_point nextafter (arithmetic x, arithmetic y);
257float nextafterf(float x, float y);
258long double nextafterl(long double x, long double y);
259
260floating_point nexttoward (arithmetic x, long double y);
261float nexttowardf(float x, long double y);
262long double nexttowardl(long double x, long double y);
263
264floating_point remainder (arithmetic x, arithmetic y);
265float remainderf(float x, float y);
266long double remainderl(long double x, long double y);
267
268floating_point remquo (arithmetic x, arithmetic y, int* pquo);
269float remquof(float x, float y, int* pquo);
270long double remquol(long double x, long double y, int* pquo);
271
272floating_point rint (arithmetic x);
273float rintf(float x);
274long double rintl(long double x);
275
276floating_point round (arithmetic x);
277float roundf(float x);
278long double roundl(long double x);
279
280floating_point scalbln (arithmetic x, long ex);
281float scalblnf(float x, long ex);
282long double scalblnl(long double x, long ex);
283
284floating_point scalbn (arithmetic x, int ex);
285float scalbnf(float x, int ex);
286long double scalbnl(long double x, int ex);
287
288floating_point tgamma (arithmetic x);
289float tgammaf(float x);
290long double tgammal(long double x);
291
292floating_point trunc (arithmetic x);
293float truncf(float x);
294long double truncl(long double x);
295
296} // std
297
298*/
299
300#include <__config>
301#include <math.h>
302#include <type_traits>
303
Howard Hinnante9df0a52013-08-01 18:17:34 +0000304#ifdef _LIBCPP_MSVCRT
Howard Hinnant9f8884e2011-10-27 16:24:42 +0000305#include "support/win32/math_win32.h"
306#endif
307
Howard Hinnant08e17472011-10-17 20:05:10 +0000308#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000309#pragma GCC system_header
Howard Hinnant08e17472011-10-17 20:05:10 +0000310#endif
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000311
Howard Hinnant0a111112011-05-13 21:52:40 +0000312// signbit
313
314#ifdef signbit
315
316template <class _A1>
317_LIBCPP_ALWAYS_INLINE
318bool
Howard Hinnantcac0c462012-07-06 19:13:50 +0000319__libcpp_signbit(_A1 __x) _NOEXCEPT
Howard Hinnant0a111112011-05-13 21:52:40 +0000320{
321 return signbit(__x);
322}
323
324#undef signbit
325
326template <class _A1>
327inline _LIBCPP_INLINE_VISIBILITY
Howard Hinnantb05a5562013-01-14 20:56:22 +0000328typename std::enable_if<std::is_arithmetic<_A1>::value, bool>::type
Howard Hinnantcac0c462012-07-06 19:13:50 +0000329signbit(_A1 __x) _NOEXCEPT
Howard Hinnant0a111112011-05-13 21:52:40 +0000330{
Howard Hinnantb05a5562013-01-14 20:56:22 +0000331 return __libcpp_signbit((typename std::__promote<_A1>::type)__x);
Howard Hinnant0a111112011-05-13 21:52:40 +0000332}
333
334#endif // signbit
335
336// fpclassify
337
338#ifdef fpclassify
339
340template <class _A1>
341_LIBCPP_ALWAYS_INLINE
342int
Howard Hinnantcac0c462012-07-06 19:13:50 +0000343__libcpp_fpclassify(_A1 __x) _NOEXCEPT
Howard Hinnant0a111112011-05-13 21:52:40 +0000344{
345 return fpclassify(__x);
346}
347
348#undef fpclassify
349
350template <class _A1>
351inline _LIBCPP_INLINE_VISIBILITY
Howard Hinnantb05a5562013-01-14 20:56:22 +0000352typename std::enable_if<std::is_arithmetic<_A1>::value, int>::type
Howard Hinnantcac0c462012-07-06 19:13:50 +0000353fpclassify(_A1 __x) _NOEXCEPT
Howard Hinnant0a111112011-05-13 21:52:40 +0000354{
Howard Hinnantb05a5562013-01-14 20:56:22 +0000355 return __libcpp_fpclassify((typename std::__promote<_A1>::type)__x);
Howard Hinnant0a111112011-05-13 21:52:40 +0000356}
357
358#endif // fpclassify
359
360// isfinite
361
362#ifdef isfinite
363
364template <class _A1>
365_LIBCPP_ALWAYS_INLINE
366bool
Howard Hinnantcac0c462012-07-06 19:13:50 +0000367__libcpp_isfinite(_A1 __x) _NOEXCEPT
Howard Hinnant0a111112011-05-13 21:52:40 +0000368{
369 return isfinite(__x);
370}
371
372#undef isfinite
373
374template <class _A1>
375inline _LIBCPP_INLINE_VISIBILITY
Howard Hinnantb05a5562013-01-14 20:56:22 +0000376typename std::enable_if<std::is_arithmetic<_A1>::value, bool>::type
Howard Hinnantcac0c462012-07-06 19:13:50 +0000377isfinite(_A1 __x) _NOEXCEPT
Howard Hinnant0a111112011-05-13 21:52:40 +0000378{
Howard Hinnantb05a5562013-01-14 20:56:22 +0000379 return __libcpp_isfinite((typename std::__promote<_A1>::type)__x);
Howard Hinnant0a111112011-05-13 21:52:40 +0000380}
381
382#endif // isfinite
383
384// isinf
385
386#ifdef isinf
387
388template <class _A1>
389_LIBCPP_ALWAYS_INLINE
390bool
Howard Hinnantcac0c462012-07-06 19:13:50 +0000391__libcpp_isinf(_A1 __x) _NOEXCEPT
Howard Hinnant0a111112011-05-13 21:52:40 +0000392{
393 return isinf(__x);
394}
395
396#undef isinf
397
398template <class _A1>
399inline _LIBCPP_INLINE_VISIBILITY
Howard Hinnantb05a5562013-01-14 20:56:22 +0000400typename std::enable_if<std::is_arithmetic<_A1>::value, bool>::type
Howard Hinnantcac0c462012-07-06 19:13:50 +0000401isinf(_A1 __x) _NOEXCEPT
Howard Hinnant0a111112011-05-13 21:52:40 +0000402{
Howard Hinnantb05a5562013-01-14 20:56:22 +0000403 return __libcpp_isinf((typename std::__promote<_A1>::type)__x);
Howard Hinnant0a111112011-05-13 21:52:40 +0000404}
405
406#endif // isinf
407
408// isnan
409
410#ifdef isnan
411
412template <class _A1>
413_LIBCPP_ALWAYS_INLINE
414bool
Howard Hinnantcac0c462012-07-06 19:13:50 +0000415__libcpp_isnan(_A1 __x) _NOEXCEPT
Howard Hinnant0a111112011-05-13 21:52:40 +0000416{
417 return isnan(__x);
418}
419
420#undef isnan
421
Howard Hinnant0a111112011-05-13 21:52:40 +0000422inline _LIBCPP_INLINE_VISIBILITY
Marshall Clow854a7a02014-01-03 18:21:14 +0000423bool
424isnan(float __x) _NOEXCEPT
Howard Hinnant0a111112011-05-13 21:52:40 +0000425{
Marshall Clow854a7a02014-01-03 18:21:14 +0000426 return __libcpp_isnan(__x);
427}
428
429inline _LIBCPP_INLINE_VISIBILITY
430bool
431isnan(double __x) _NOEXCEPT
432{
433 return __libcpp_isnan(__x);
434}
435
436inline _LIBCPP_INLINE_VISIBILITY
437bool
438isnan(long double __x) _NOEXCEPT
439{
440 return __libcpp_isnan(__x);
Howard Hinnant0a111112011-05-13 21:52:40 +0000441}
442
443#endif // isnan
444
445// isnormal
446
447#ifdef isnormal
448
449template <class _A1>
450_LIBCPP_ALWAYS_INLINE
451bool
Howard Hinnantcac0c462012-07-06 19:13:50 +0000452__libcpp_isnormal(_A1 __x) _NOEXCEPT
Howard Hinnant0a111112011-05-13 21:52:40 +0000453{
454 return isnormal(__x);
455}
456
457#undef isnormal
458
459template <class _A1>
460inline _LIBCPP_INLINE_VISIBILITY
Howard Hinnantb05a5562013-01-14 20:56:22 +0000461typename std::enable_if<std::is_arithmetic<_A1>::value, bool>::type
Howard Hinnantcac0c462012-07-06 19:13:50 +0000462isnormal(_A1 __x) _NOEXCEPT
Howard Hinnant0a111112011-05-13 21:52:40 +0000463{
Howard Hinnantb05a5562013-01-14 20:56:22 +0000464 return __libcpp_isnormal((typename std::__promote<_A1>::type)__x);
Howard Hinnant0a111112011-05-13 21:52:40 +0000465}
466
467#endif // isnormal
468
469// isgreater
470
471#ifdef isgreater
472
473template <class _A1, class _A2>
474_LIBCPP_ALWAYS_INLINE
475bool
Howard Hinnantcac0c462012-07-06 19:13:50 +0000476__libcpp_isgreater(_A1 __x, _A2 __y) _NOEXCEPT
Howard Hinnant0a111112011-05-13 21:52:40 +0000477{
478 return isgreater(__x, __y);
479}
480
481#undef isgreater
482
483template <class _A1, class _A2>
484inline _LIBCPP_INLINE_VISIBILITY
485typename std::enable_if
486<
Howard Hinnantb05a5562013-01-14 20:56:22 +0000487 std::is_arithmetic<_A1>::value &&
488 std::is_arithmetic<_A2>::value,
Howard Hinnant0a111112011-05-13 21:52:40 +0000489 bool
490>::type
Howard Hinnantcac0c462012-07-06 19:13:50 +0000491isgreater(_A1 __x, _A2 __y) _NOEXCEPT
Howard Hinnant0a111112011-05-13 21:52:40 +0000492{
Howard Hinnantb05a5562013-01-14 20:56:22 +0000493 typedef typename std::__promote<_A1, _A2>::type type;
494 return __libcpp_isgreater((type)__x, (type)__y);
Howard Hinnant0a111112011-05-13 21:52:40 +0000495}
496
497#endif // isgreater
498
499// isgreaterequal
500
501#ifdef isgreaterequal
502
503template <class _A1, class _A2>
504_LIBCPP_ALWAYS_INLINE
505bool
Howard Hinnantcac0c462012-07-06 19:13:50 +0000506__libcpp_isgreaterequal(_A1 __x, _A2 __y) _NOEXCEPT
Howard Hinnant0a111112011-05-13 21:52:40 +0000507{
508 return isgreaterequal(__x, __y);
509}
510
511#undef isgreaterequal
512
513template <class _A1, class _A2>
514inline _LIBCPP_INLINE_VISIBILITY
515typename std::enable_if
516<
Howard Hinnantb05a5562013-01-14 20:56:22 +0000517 std::is_arithmetic<_A1>::value &&
518 std::is_arithmetic<_A2>::value,
Howard Hinnant0a111112011-05-13 21:52:40 +0000519 bool
520>::type
Howard Hinnantcac0c462012-07-06 19:13:50 +0000521isgreaterequal(_A1 __x, _A2 __y) _NOEXCEPT
Howard Hinnant0a111112011-05-13 21:52:40 +0000522{
Howard Hinnantb05a5562013-01-14 20:56:22 +0000523 typedef typename std::__promote<_A1, _A2>::type type;
524 return __libcpp_isgreaterequal((type)__x, (type)__y);
Howard Hinnant0a111112011-05-13 21:52:40 +0000525}
526
527#endif // isgreaterequal
528
529// isless
530
531#ifdef isless
532
533template <class _A1, class _A2>
534_LIBCPP_ALWAYS_INLINE
535bool
Howard Hinnantcac0c462012-07-06 19:13:50 +0000536__libcpp_isless(_A1 __x, _A2 __y) _NOEXCEPT
Howard Hinnant0a111112011-05-13 21:52:40 +0000537{
538 return isless(__x, __y);
539}
540
541#undef isless
542
543template <class _A1, class _A2>
544inline _LIBCPP_INLINE_VISIBILITY
545typename std::enable_if
546<
Howard Hinnantb05a5562013-01-14 20:56:22 +0000547 std::is_arithmetic<_A1>::value &&
548 std::is_arithmetic<_A2>::value,
Howard Hinnant0a111112011-05-13 21:52:40 +0000549 bool
550>::type
Howard Hinnantcac0c462012-07-06 19:13:50 +0000551isless(_A1 __x, _A2 __y) _NOEXCEPT
Howard Hinnant0a111112011-05-13 21:52:40 +0000552{
Howard Hinnantb05a5562013-01-14 20:56:22 +0000553 typedef typename std::__promote<_A1, _A2>::type type;
554 return __libcpp_isless((type)__x, (type)__y);
Howard Hinnant0a111112011-05-13 21:52:40 +0000555}
556
557#endif // isless
558
559// islessequal
560
561#ifdef islessequal
562
563template <class _A1, class _A2>
564_LIBCPP_ALWAYS_INLINE
565bool
Howard Hinnantcac0c462012-07-06 19:13:50 +0000566__libcpp_islessequal(_A1 __x, _A2 __y) _NOEXCEPT
Howard Hinnant0a111112011-05-13 21:52:40 +0000567{
568 return islessequal(__x, __y);
569}
570
571#undef islessequal
572
573template <class _A1, class _A2>
574inline _LIBCPP_INLINE_VISIBILITY
575typename std::enable_if
576<
Howard Hinnantb05a5562013-01-14 20:56:22 +0000577 std::is_arithmetic<_A1>::value &&
578 std::is_arithmetic<_A2>::value,
Howard Hinnant0a111112011-05-13 21:52:40 +0000579 bool
580>::type
Howard Hinnantcac0c462012-07-06 19:13:50 +0000581islessequal(_A1 __x, _A2 __y) _NOEXCEPT
Howard Hinnant0a111112011-05-13 21:52:40 +0000582{
Howard Hinnantb05a5562013-01-14 20:56:22 +0000583 typedef typename std::__promote<_A1, _A2>::type type;
584 return __libcpp_islessequal((type)__x, (type)__y);
Howard Hinnant0a111112011-05-13 21:52:40 +0000585}
586
587#endif // islessequal
588
589// islessgreater
590
591#ifdef islessgreater
592
593template <class _A1, class _A2>
594_LIBCPP_ALWAYS_INLINE
595bool
Howard Hinnantcac0c462012-07-06 19:13:50 +0000596__libcpp_islessgreater(_A1 __x, _A2 __y) _NOEXCEPT
Howard Hinnant0a111112011-05-13 21:52:40 +0000597{
598 return islessgreater(__x, __y);
599}
600
601#undef islessgreater
602
603template <class _A1, class _A2>
604inline _LIBCPP_INLINE_VISIBILITY
605typename std::enable_if
606<
Howard Hinnantb05a5562013-01-14 20:56:22 +0000607 std::is_arithmetic<_A1>::value &&
608 std::is_arithmetic<_A2>::value,
Howard Hinnant0a111112011-05-13 21:52:40 +0000609 bool
610>::type
Howard Hinnantcac0c462012-07-06 19:13:50 +0000611islessgreater(_A1 __x, _A2 __y) _NOEXCEPT
Howard Hinnant0a111112011-05-13 21:52:40 +0000612{
Howard Hinnantb05a5562013-01-14 20:56:22 +0000613 typedef typename std::__promote<_A1, _A2>::type type;
614 return __libcpp_islessgreater((type)__x, (type)__y);
Howard Hinnant0a111112011-05-13 21:52:40 +0000615}
616
617#endif // islessgreater
618
619// isunordered
620
621#ifdef isunordered
622
623template <class _A1, class _A2>
624_LIBCPP_ALWAYS_INLINE
625bool
Howard Hinnantcac0c462012-07-06 19:13:50 +0000626__libcpp_isunordered(_A1 __x, _A2 __y) _NOEXCEPT
Howard Hinnant0a111112011-05-13 21:52:40 +0000627{
628 return isunordered(__x, __y);
629}
630
631#undef isunordered
632
633template <class _A1, class _A2>
634inline _LIBCPP_INLINE_VISIBILITY
635typename std::enable_if
636<
Howard Hinnantb05a5562013-01-14 20:56:22 +0000637 std::is_arithmetic<_A1>::value &&
638 std::is_arithmetic<_A2>::value,
Howard Hinnant0a111112011-05-13 21:52:40 +0000639 bool
640>::type
Howard Hinnantcac0c462012-07-06 19:13:50 +0000641isunordered(_A1 __x, _A2 __y) _NOEXCEPT
Howard Hinnant0a111112011-05-13 21:52:40 +0000642{
Howard Hinnantb05a5562013-01-14 20:56:22 +0000643 typedef typename std::__promote<_A1, _A2>::type type;
644 return __libcpp_isunordered((type)__x, (type)__y);
Howard Hinnant0a111112011-05-13 21:52:40 +0000645}
646
647#endif // isunordered
648
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000649_LIBCPP_BEGIN_NAMESPACE_STD
650
Howard Hinnant0a111112011-05-13 21:52:40 +0000651using ::signbit;
652using ::fpclassify;
653using ::isfinite;
654using ::isinf;
655using ::isnan;
656using ::isnormal;
657using ::isgreater;
658using ::isgreaterequal;
659using ::isless;
660using ::islessequal;
661using ::islessgreater;
662using ::isunordered;
663using ::isunordered;
664
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000665using ::float_t;
666using ::double_t;
667
Marshall Clow854a7a02014-01-03 18:21:14 +0000668// isnan
669
670template <class _A1>
671inline _LIBCPP_INLINE_VISIBILITY
672typename std::enable_if<__promote<_A1>::value, bool>::type
673#ifdef _LIBCPP_HAS_NO_RVALUE_REFERENCES
674isnan(_A1 __x)
675#else
676isnan(_A1&& __x)
677 _NOEXCEPT_
678 (
679 _NOEXCEPT_(__promote<_A1>::__does_not_throw)
680 )
681#endif
682{
683 typedef typename __promote<_A1>::type type;
684 static_assert(!(is_same<typename remove_reference<_A1>::type, type>::value), "");
685 return __libcpp_isnan(static_cast<type>(_VSTD::forward<_A1>(__x)));
686}
687
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000688// abs
689
Howard Hinnant7f764502013-08-14 18:00:20 +0000690#if !defined(_AIX)
Howard Hinnant422a53f2010-09-21 21:28:23 +0000691inline _LIBCPP_INLINE_VISIBILITY
Howard Hinnantf07a5292012-05-03 14:58:34 +0000692float
Howard Hinnantcac0c462012-07-06 19:13:50 +0000693abs(float __x) _NOEXCEPT {return fabsf(__x);}
Howard Hinnantf07a5292012-05-03 14:58:34 +0000694
695inline _LIBCPP_INLINE_VISIBILITY
696double
Howard Hinnantcac0c462012-07-06 19:13:50 +0000697abs(double __x) _NOEXCEPT {return fabs(__x);}
Howard Hinnantf07a5292012-05-03 14:58:34 +0000698
699inline _LIBCPP_INLINE_VISIBILITY
700long double
Howard Hinnantcac0c462012-07-06 19:13:50 +0000701abs(long double __x) _NOEXCEPT {return fabsl(__x);}
Howard Hinnant7f764502013-08-14 18:00:20 +0000702#endif // !defined(_AIX)
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000703
David Chisnall997e4542012-02-29 13:05:08 +0000704#ifndef __sun__
705
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000706// acos
707
708using ::acos;
709using ::acosf;
710
Howard Hinnant7f764502013-08-14 18:00:20 +0000711#if !(defined(_LIBCPP_MSVCRT) || defined(_AIX))
Howard Hinnantcac0c462012-07-06 19:13:50 +0000712inline _LIBCPP_INLINE_VISIBILITY float acos(float __x) _NOEXCEPT {return acosf(__x);}
713inline _LIBCPP_INLINE_VISIBILITY long double acos(long double __x) _NOEXCEPT {return acosl(__x);}
Howard Hinnant9f8884e2011-10-27 16:24:42 +0000714#endif
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000715
716template <class _A1>
Howard Hinnant422a53f2010-09-21 21:28:23 +0000717inline _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000718typename enable_if<is_integral<_A1>::value, double>::type
Howard Hinnantcac0c462012-07-06 19:13:50 +0000719acos(_A1 __x) _NOEXCEPT {return acos((double)__x);}
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000720
721// asin
722
723using ::asin;
724using ::asinf;
725
Howard Hinnant7f764502013-08-14 18:00:20 +0000726#if !(defined(_LIBCPP_MSVCRT) || defined(_AIX))
Howard Hinnantcac0c462012-07-06 19:13:50 +0000727inline _LIBCPP_INLINE_VISIBILITY float asin(float __x) _NOEXCEPT {return asinf(__x);}
728inline _LIBCPP_INLINE_VISIBILITY long double asin(long double __x) _NOEXCEPT {return asinl(__x);}
Howard Hinnant9f8884e2011-10-27 16:24:42 +0000729#endif
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000730
731template <class _A1>
Howard Hinnant422a53f2010-09-21 21:28:23 +0000732inline _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000733typename enable_if<is_integral<_A1>::value, double>::type
Howard Hinnantcac0c462012-07-06 19:13:50 +0000734asin(_A1 __x) _NOEXCEPT {return asin((double)__x);}
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000735
736// atan
737
738using ::atan;
739using ::atanf;
740
Howard Hinnant7f764502013-08-14 18:00:20 +0000741#if !(defined(_LIBCPP_MSVCRT) || defined(_AIX))
Howard Hinnantcac0c462012-07-06 19:13:50 +0000742inline _LIBCPP_INLINE_VISIBILITY float atan(float __x) _NOEXCEPT {return atanf(__x);}
743inline _LIBCPP_INLINE_VISIBILITY long double atan(long double __x) _NOEXCEPT {return atanl(__x);}
Howard Hinnant9f8884e2011-10-27 16:24:42 +0000744#endif
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000745
746template <class _A1>
Howard Hinnant422a53f2010-09-21 21:28:23 +0000747inline _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000748typename enable_if<is_integral<_A1>::value, double>::type
Howard Hinnantcac0c462012-07-06 19:13:50 +0000749atan(_A1 __x) _NOEXCEPT {return atan((double)__x);}
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000750
751// atan2
752
753using ::atan2;
754using ::atan2f;
755
Howard Hinnant7f764502013-08-14 18:00:20 +0000756#if !(defined(_LIBCPP_MSVCRT) || defined(_AIX))
Howard Hinnantcac0c462012-07-06 19:13:50 +0000757inline _LIBCPP_INLINE_VISIBILITY float atan2(float __y, float __x) _NOEXCEPT {return atan2f(__y, __x);}
758inline _LIBCPP_INLINE_VISIBILITY long double atan2(long double __y, long double __x) _NOEXCEPT {return atan2l(__y, __x);}
Howard Hinnant9f8884e2011-10-27 16:24:42 +0000759#endif
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000760
761template <class _A1, class _A2>
Howard Hinnant422a53f2010-09-21 21:28:23 +0000762inline _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000763typename enable_if
764<
765 is_arithmetic<_A1>::value &&
766 is_arithmetic<_A2>::value,
767 typename __promote<_A1, _A2>::type
768>::type
Howard Hinnantcac0c462012-07-06 19:13:50 +0000769atan2(_A1 __y, _A2 __x) _NOEXCEPT
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000770{
771 typedef typename __promote<_A1, _A2>::type __result_type;
772 static_assert((!(is_same<_A1, __result_type>::value &&
773 is_same<_A2, __result_type>::value)), "");
774 return atan2((__result_type)__y, (__result_type)__x);
775}
776
777// ceil
778
779using ::ceil;
780using ::ceilf;
781
Howard Hinnant7f764502013-08-14 18:00:20 +0000782#if !(defined(_LIBCPP_MSVCRT) || defined(_AIX))
Howard Hinnantcac0c462012-07-06 19:13:50 +0000783inline _LIBCPP_INLINE_VISIBILITY float ceil(float __x) _NOEXCEPT {return ceilf(__x);}
784inline _LIBCPP_INLINE_VISIBILITY long double ceil(long double __x) _NOEXCEPT {return ceill(__x);}
Howard Hinnant9f8884e2011-10-27 16:24:42 +0000785#endif
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000786
787template <class _A1>
Howard Hinnant422a53f2010-09-21 21:28:23 +0000788inline _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000789typename enable_if<is_integral<_A1>::value, double>::type
Howard Hinnantcac0c462012-07-06 19:13:50 +0000790ceil(_A1 __x) _NOEXCEPT {return ceil((double)__x);}
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000791
792// cos
793
794using ::cos;
795using ::cosf;
796
Howard Hinnant7f764502013-08-14 18:00:20 +0000797#if !(defined(_LIBCPP_MSVCRT) || defined(_AIX))
Howard Hinnantcac0c462012-07-06 19:13:50 +0000798inline _LIBCPP_INLINE_VISIBILITY float cos(float __x) _NOEXCEPT {return cosf(__x);}
799inline _LIBCPP_INLINE_VISIBILITY long double cos(long double __x) _NOEXCEPT {return cosl(__x);}
Howard Hinnant9f8884e2011-10-27 16:24:42 +0000800#endif
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000801
802template <class _A1>
Howard Hinnant161a9bf2013-08-29 23:50:48 +0000803inline _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000804typename enable_if<is_integral<_A1>::value, double>::type
Howard Hinnantcac0c462012-07-06 19:13:50 +0000805cos(_A1 __x) _NOEXCEPT {return cos((double)__x);}
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000806
807// cosh
808
809using ::cosh;
810using ::coshf;
811
Howard Hinnant7f764502013-08-14 18:00:20 +0000812#if !(defined(_LIBCPP_MSVCRT) || defined(_AIX))
Howard Hinnantcac0c462012-07-06 19:13:50 +0000813inline _LIBCPP_INLINE_VISIBILITY float cosh(float __x) _NOEXCEPT {return coshf(__x);}
814inline _LIBCPP_INLINE_VISIBILITY long double cosh(long double __x) _NOEXCEPT {return coshl(__x);}
Howard Hinnant9f8884e2011-10-27 16:24:42 +0000815#endif
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000816
817template <class _A1>
Howard Hinnant422a53f2010-09-21 21:28:23 +0000818inline _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000819typename enable_if<is_integral<_A1>::value, double>::type
Howard Hinnantcac0c462012-07-06 19:13:50 +0000820cosh(_A1 __x) _NOEXCEPT {return cosh((double)__x);}
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000821
David Chisnall997e4542012-02-29 13:05:08 +0000822#endif // __sun__
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000823// exp
824
825using ::exp;
826using ::expf;
827
David Chisnall997e4542012-02-29 13:05:08 +0000828#ifndef __sun__
829
Howard Hinnant7f764502013-08-14 18:00:20 +0000830#if !(defined(_LIBCPP_MSVCRT) || defined(_AIX))
Howard Hinnantcac0c462012-07-06 19:13:50 +0000831inline _LIBCPP_INLINE_VISIBILITY float exp(float __x) _NOEXCEPT {return expf(__x);}
832inline _LIBCPP_INLINE_VISIBILITY long double exp(long double __x) _NOEXCEPT {return expl(__x);}
Howard Hinnant9f8884e2011-10-27 16:24:42 +0000833#endif
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000834
David Chisnall997e4542012-02-29 13:05:08 +0000835
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000836template <class _A1>
Howard Hinnant422a53f2010-09-21 21:28:23 +0000837inline _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000838typename enable_if<is_integral<_A1>::value, double>::type
Howard Hinnantcac0c462012-07-06 19:13:50 +0000839exp(_A1 __x) _NOEXCEPT {return exp((double)__x);}
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000840
841// fabs
842
843using ::fabs;
844using ::fabsf;
845
Howard Hinnant7f764502013-08-14 18:00:20 +0000846#if !(defined(_LIBCPP_MSVCRT) || defined(_AIX))
Howard Hinnantcac0c462012-07-06 19:13:50 +0000847inline _LIBCPP_INLINE_VISIBILITY float fabs(float __x) _NOEXCEPT {return fabsf(__x);}
848inline _LIBCPP_INLINE_VISIBILITY long double fabs(long double __x) _NOEXCEPT {return fabsl(__x);}
Howard Hinnant9f8884e2011-10-27 16:24:42 +0000849#endif
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000850
851template <class _A1>
Howard Hinnant422a53f2010-09-21 21:28:23 +0000852inline _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000853typename enable_if<is_integral<_A1>::value, double>::type
Howard Hinnantcac0c462012-07-06 19:13:50 +0000854fabs(_A1 __x) _NOEXCEPT {return fabs((double)__x);}
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000855
856// floor
857
858using ::floor;
859using ::floorf;
860
Howard Hinnant7f764502013-08-14 18:00:20 +0000861#if !(defined(_LIBCPP_MSVCRT) || defined(_AIX))
Howard Hinnantcac0c462012-07-06 19:13:50 +0000862inline _LIBCPP_INLINE_VISIBILITY float floor(float __x) _NOEXCEPT {return floorf(__x);}
863inline _LIBCPP_INLINE_VISIBILITY long double floor(long double __x) _NOEXCEPT {return floorl(__x);}
Howard Hinnant9f8884e2011-10-27 16:24:42 +0000864#endif
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000865
866template <class _A1>
Howard Hinnant422a53f2010-09-21 21:28:23 +0000867inline _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000868typename enable_if<is_integral<_A1>::value, double>::type
Howard Hinnantcac0c462012-07-06 19:13:50 +0000869floor(_A1 __x) _NOEXCEPT {return floor((double)__x);}
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000870
871// fmod
872
David Chisnall997e4542012-02-29 13:05:08 +0000873#endif //__sun__
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000874using ::fmod;
875using ::fmodf;
David Chisnall997e4542012-02-29 13:05:08 +0000876#ifndef __sun__
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000877
Howard Hinnant7f764502013-08-14 18:00:20 +0000878#if !(defined(_LIBCPP_MSVCRT) || defined(_AIX))
Howard Hinnantcac0c462012-07-06 19:13:50 +0000879inline _LIBCPP_INLINE_VISIBILITY float fmod(float __x, float __y) _NOEXCEPT {return fmodf(__x, __y);}
880inline _LIBCPP_INLINE_VISIBILITY long double fmod(long double __x, long double __y) _NOEXCEPT {return fmodl(__x, __y);}
Howard Hinnant9f8884e2011-10-27 16:24:42 +0000881#endif
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000882
883template <class _A1, class _A2>
Howard Hinnant422a53f2010-09-21 21:28:23 +0000884inline _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000885typename enable_if
886<
887 is_arithmetic<_A1>::value &&
888 is_arithmetic<_A2>::value,
889 typename __promote<_A1, _A2>::type
890>::type
Howard Hinnantcac0c462012-07-06 19:13:50 +0000891fmod(_A1 __x, _A2 __y) _NOEXCEPT
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000892{
893 typedef typename __promote<_A1, _A2>::type __result_type;
894 static_assert((!(is_same<_A1, __result_type>::value &&
895 is_same<_A2, __result_type>::value)), "");
896 return fmod((__result_type)__x, (__result_type)__y);
897}
898
David Chisnall997e4542012-02-29 13:05:08 +0000899
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000900// frexp
901
902using ::frexp;
903using ::frexpf;
904
Howard Hinnant7f764502013-08-14 18:00:20 +0000905#if !(defined(_LIBCPP_MSVCRT) || defined(_AIX))
Howard Hinnantcac0c462012-07-06 19:13:50 +0000906inline _LIBCPP_INLINE_VISIBILITY float frexp(float __x, int* __e) _NOEXCEPT {return frexpf(__x, __e);}
907inline _LIBCPP_INLINE_VISIBILITY long double frexp(long double __x, int* __e) _NOEXCEPT {return frexpl(__x, __e);}
Howard Hinnant9f8884e2011-10-27 16:24:42 +0000908#endif
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000909
910template <class _A1>
Howard Hinnant422a53f2010-09-21 21:28:23 +0000911inline _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000912typename enable_if<is_integral<_A1>::value, double>::type
Howard Hinnantcac0c462012-07-06 19:13:50 +0000913frexp(_A1 __x, int* __e) _NOEXCEPT {return frexp((double)__x, __e);}
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000914
915// ldexp
916
917using ::ldexp;
918using ::ldexpf;
919
Howard Hinnant7f764502013-08-14 18:00:20 +0000920#if !(defined(_LIBCPP_MSVCRT) || defined(_AIX))
Howard Hinnantcac0c462012-07-06 19:13:50 +0000921inline _LIBCPP_INLINE_VISIBILITY float ldexp(float __x, int __e) _NOEXCEPT {return ldexpf(__x, __e);}
922inline _LIBCPP_INLINE_VISIBILITY long double ldexp(long double __x, int __e) _NOEXCEPT {return ldexpl(__x, __e);}
Howard Hinnant9f8884e2011-10-27 16:24:42 +0000923#endif
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000924
925template <class _A1>
Howard Hinnant422a53f2010-09-21 21:28:23 +0000926inline _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000927typename enable_if<is_integral<_A1>::value, double>::type
Howard Hinnantcac0c462012-07-06 19:13:50 +0000928ldexp(_A1 __x, int __e) _NOEXCEPT {return ldexp((double)__x, __e);}
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000929
930// log
931
David Chisnall997e4542012-02-29 13:05:08 +0000932#endif // __sun__
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000933using ::log;
934using ::logf;
David Chisnall997e4542012-02-29 13:05:08 +0000935#ifndef __sun__
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000936
Howard Hinnant7f764502013-08-14 18:00:20 +0000937#if !(defined(_LIBCPP_MSVCRT) || defined(_AIX))
Howard Hinnantcac0c462012-07-06 19:13:50 +0000938inline _LIBCPP_INLINE_VISIBILITY float log(float __x) _NOEXCEPT {return logf(__x);}
939inline _LIBCPP_INLINE_VISIBILITY long double log(long double __x) _NOEXCEPT {return logl(__x);}
Howard Hinnant9f8884e2011-10-27 16:24:42 +0000940#endif
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000941
942template <class _A1>
Howard Hinnant422a53f2010-09-21 21:28:23 +0000943inline _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000944typename enable_if<is_integral<_A1>::value, double>::type
Howard Hinnantcac0c462012-07-06 19:13:50 +0000945log(_A1 __x) _NOEXCEPT {return log((double)__x);}
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000946
David Chisnall997e4542012-02-29 13:05:08 +0000947
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000948// log10
949
950using ::log10;
951using ::log10f;
952
Howard Hinnant7f764502013-08-14 18:00:20 +0000953#if !(defined(_LIBCPP_MSVCRT) || defined(_AIX))
Howard Hinnantcac0c462012-07-06 19:13:50 +0000954inline _LIBCPP_INLINE_VISIBILITY float log10(float __x) _NOEXCEPT {return log10f(__x);}
955inline _LIBCPP_INLINE_VISIBILITY long double log10(long double __x) _NOEXCEPT {return log10l(__x);}
Howard Hinnant9f8884e2011-10-27 16:24:42 +0000956#endif
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000957
958template <class _A1>
Howard Hinnant422a53f2010-09-21 21:28:23 +0000959inline _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000960typename enable_if<is_integral<_A1>::value, double>::type
Howard Hinnantcac0c462012-07-06 19:13:50 +0000961log10(_A1 __x) _NOEXCEPT {return log10((double)__x);}
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000962
963// modf
964
965using ::modf;
966using ::modff;
967
Howard Hinnant7f764502013-08-14 18:00:20 +0000968#if !(defined(_LIBCPP_MSVCRT) || defined(_AIX))
Howard Hinnantcac0c462012-07-06 19:13:50 +0000969inline _LIBCPP_INLINE_VISIBILITY float modf(float __x, float* __y) _NOEXCEPT {return modff(__x, __y);}
970inline _LIBCPP_INLINE_VISIBILITY long double modf(long double __x, long double* __y) _NOEXCEPT {return modfl(__x, __y);}
Howard Hinnant9f8884e2011-10-27 16:24:42 +0000971#endif
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000972
973// pow
974
David Chisnall997e4542012-02-29 13:05:08 +0000975#endif // __sun__
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000976using ::pow;
977using ::powf;
978
David Chisnall997e4542012-02-29 13:05:08 +0000979#ifndef __sun__
980
Howard Hinnant7f764502013-08-14 18:00:20 +0000981#if !(defined(_LIBCPP_MSVCRT) || defined(_AIX))
Howard Hinnantcac0c462012-07-06 19:13:50 +0000982inline _LIBCPP_INLINE_VISIBILITY float pow(float __x, float __y) _NOEXCEPT {return powf(__x, __y);}
983inline _LIBCPP_INLINE_VISIBILITY long double pow(long double __x, long double __y) _NOEXCEPT {return powl(__x, __y);}
Howard Hinnant9f8884e2011-10-27 16:24:42 +0000984#endif
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000985
986template <class _A1, class _A2>
Howard Hinnant422a53f2010-09-21 21:28:23 +0000987inline _LIBCPP_INLINE_VISIBILITY
Marshall Clow854a7a02014-01-03 18:21:14 +0000988typename __promote<_A1, _A2>::type
989#ifdef _LIBCPP_HAS_NO_RVALUE_REFERENCES
990pow(_A1 __x, _A2 __y)
991#else
992pow(_A1&& __x, _A2&& __y)
993 _NOEXCEPT_
994 (
995 _NOEXCEPT_(__promote<_A1>::__does_not_throw) &&
996 _NOEXCEPT_(__promote<_A2>::__does_not_throw)
997 )
998#endif
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000999{
Marshall Clow854a7a02014-01-03 18:21:14 +00001000 typedef typename __promote<_A1>::type _D1;
1001 typedef typename __promote<_A2>::type _D2;
1002 typedef typename __promote<_D1, _D2>::type type;
1003 static_assert((!(is_same<typename remove_reference<_A1>::type, type>::value &&
1004 is_same<typename remove_reference<_A2>::type, type>::value)), "");
1005 return pow(static_cast<type>(static_cast<_D1>(_VSTD::forward<_A1>(__x))),
1006 static_cast<type>(static_cast<_D2>(_VSTD::forward<_A2>(__y))));
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001007}
1008
1009// sin
1010
1011using ::sin;
1012using ::sinf;
1013
Howard Hinnant7f764502013-08-14 18:00:20 +00001014#if !(defined(_LIBCPP_MSVCRT) || defined(_AIX))
Howard Hinnantcac0c462012-07-06 19:13:50 +00001015inline _LIBCPP_INLINE_VISIBILITY float sin(float __x) _NOEXCEPT {return sinf(__x);}
1016inline _LIBCPP_INLINE_VISIBILITY long double sin(long double __x) _NOEXCEPT {return sinl(__x);}
Howard Hinnant9f8884e2011-10-27 16:24:42 +00001017#endif
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001018
1019template <class _A1>
Howard Hinnant422a53f2010-09-21 21:28:23 +00001020inline _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001021typename enable_if<is_integral<_A1>::value, double>::type
Howard Hinnantcac0c462012-07-06 19:13:50 +00001022sin(_A1 __x) _NOEXCEPT {return sin((double)__x);}
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001023
1024// sinh
1025
1026using ::sinh;
1027using ::sinhf;
1028
Howard Hinnant7f764502013-08-14 18:00:20 +00001029#if !(defined(_LIBCPP_MSVCRT) || defined(_AIX))
Howard Hinnantcac0c462012-07-06 19:13:50 +00001030inline _LIBCPP_INLINE_VISIBILITY float sinh(float __x) _NOEXCEPT {return sinhf(__x);}
1031inline _LIBCPP_INLINE_VISIBILITY long double sinh(long double __x) _NOEXCEPT {return sinhl(__x);}
Howard Hinnant9f8884e2011-10-27 16:24:42 +00001032#endif
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001033
1034template <class _A1>
Howard Hinnant422a53f2010-09-21 21:28:23 +00001035inline _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001036typename enable_if<is_integral<_A1>::value, double>::type
Howard Hinnantcac0c462012-07-06 19:13:50 +00001037sinh(_A1 __x) _NOEXCEPT {return sinh((double)__x);}
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001038
1039// sqrt
1040
David Chisnall997e4542012-02-29 13:05:08 +00001041#endif // __sun__
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001042using ::sqrt;
1043using ::sqrtf;
1044
David Chisnall997e4542012-02-29 13:05:08 +00001045
Howard Hinnant7f764502013-08-14 18:00:20 +00001046#if !(defined(_LIBCPP_MSVCRT) || defined(__sun__) || defined(_AIX))
Howard Hinnantcac0c462012-07-06 19:13:50 +00001047inline _LIBCPP_INLINE_VISIBILITY float sqrt(float __x) _NOEXCEPT {return sqrtf(__x);}
1048inline _LIBCPP_INLINE_VISIBILITY long double sqrt(long double __x) _NOEXCEPT {return sqrtl(__x);}
Howard Hinnant9f8884e2011-10-27 16:24:42 +00001049#endif
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001050
1051template <class _A1>
Howard Hinnant422a53f2010-09-21 21:28:23 +00001052inline _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001053typename enable_if<is_integral<_A1>::value, double>::type
Howard Hinnantcac0c462012-07-06 19:13:50 +00001054sqrt(_A1 __x) _NOEXCEPT {return sqrt((double)__x);}
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001055
1056// tan
1057
1058using ::tan;
1059using ::tanf;
David Chisnall997e4542012-02-29 13:05:08 +00001060#ifndef __sun__
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001061
Howard Hinnant7f764502013-08-14 18:00:20 +00001062#if !(defined(_LIBCPP_MSVCRT) || defined(_AIX))
Howard Hinnantcac0c462012-07-06 19:13:50 +00001063inline _LIBCPP_INLINE_VISIBILITY float tan(float __x) _NOEXCEPT {return tanf(__x);}
1064inline _LIBCPP_INLINE_VISIBILITY long double tan(long double __x) _NOEXCEPT {return tanl(__x);}
Howard Hinnant9f8884e2011-10-27 16:24:42 +00001065#endif
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001066
1067template <class _A1>
Howard Hinnant422a53f2010-09-21 21:28:23 +00001068inline _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001069typename enable_if<is_integral<_A1>::value, double>::type
Howard Hinnantcac0c462012-07-06 19:13:50 +00001070tan(_A1 __x) _NOEXCEPT {return tan((double)__x);}
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001071
1072// tanh
1073
1074using ::tanh;
1075using ::tanhf;
1076
Howard Hinnant7f764502013-08-14 18:00:20 +00001077#if !(defined(_LIBCPP_MSVCRT) || defined(_AIX))
Howard Hinnantcac0c462012-07-06 19:13:50 +00001078inline _LIBCPP_INLINE_VISIBILITY float tanh(float __x) _NOEXCEPT {return tanhf(__x);}
1079inline _LIBCPP_INLINE_VISIBILITY long double tanh(long double __x) _NOEXCEPT {return tanhl(__x);}
Howard Hinnant9f8884e2011-10-27 16:24:42 +00001080#endif
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001081
1082template <class _A1>
Howard Hinnant422a53f2010-09-21 21:28:23 +00001083inline _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001084typename enable_if<is_integral<_A1>::value, double>::type
Howard Hinnantcac0c462012-07-06 19:13:50 +00001085tanh(_A1 __x) _NOEXCEPT {return tanh((double)__x);}
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001086
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001087// acosh
1088
Howard Hinnante9df0a52013-08-01 18:17:34 +00001089#ifndef _LIBCPP_MSVCRT
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001090using ::acosh;
1091using ::acoshf;
1092
Howard Hinnantcac0c462012-07-06 19:13:50 +00001093inline _LIBCPP_INLINE_VISIBILITY float acosh(float __x) _NOEXCEPT {return acoshf(__x);}
1094inline _LIBCPP_INLINE_VISIBILITY long double acosh(long double __x) _NOEXCEPT {return acoshl(__x);}
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001095
1096template <class _A1>
Howard Hinnant422a53f2010-09-21 21:28:23 +00001097inline _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001098typename enable_if<is_integral<_A1>::value, double>::type
Howard Hinnantcac0c462012-07-06 19:13:50 +00001099acosh(_A1 __x) _NOEXCEPT {return acosh((double)__x);}
Howard Hinnant9f8884e2011-10-27 16:24:42 +00001100#endif
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001101
1102// asinh
1103
Howard Hinnante9df0a52013-08-01 18:17:34 +00001104#ifndef _LIBCPP_MSVCRT
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001105using ::asinh;
1106using ::asinhf;
1107
Howard Hinnantcac0c462012-07-06 19:13:50 +00001108inline _LIBCPP_INLINE_VISIBILITY float asinh(float __x) _NOEXCEPT {return asinhf(__x);}
1109inline _LIBCPP_INLINE_VISIBILITY long double asinh(long double __x) _NOEXCEPT {return asinhl(__x);}
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001110
1111template <class _A1>
Howard Hinnant422a53f2010-09-21 21:28:23 +00001112inline _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001113typename enable_if<is_integral<_A1>::value, double>::type
Howard Hinnantcac0c462012-07-06 19:13:50 +00001114asinh(_A1 __x) _NOEXCEPT {return asinh((double)__x);}
Howard Hinnant9f8884e2011-10-27 16:24:42 +00001115#endif
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001116
1117// atanh
1118
Howard Hinnante9df0a52013-08-01 18:17:34 +00001119#ifndef _LIBCPP_MSVCRT
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001120using ::atanh;
1121using ::atanhf;
1122
Howard Hinnantcac0c462012-07-06 19:13:50 +00001123inline _LIBCPP_INLINE_VISIBILITY float atanh(float __x) _NOEXCEPT {return atanhf(__x);}
1124inline _LIBCPP_INLINE_VISIBILITY long double atanh(long double __x) _NOEXCEPT {return atanhl(__x);}
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001125
1126template <class _A1>
Howard Hinnant422a53f2010-09-21 21:28:23 +00001127inline _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001128typename enable_if<is_integral<_A1>::value, double>::type
Howard Hinnantcac0c462012-07-06 19:13:50 +00001129atanh(_A1 __x) _NOEXCEPT {return atanh((double)__x);}
Howard Hinnant9f8884e2011-10-27 16:24:42 +00001130#endif
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001131
1132// cbrt
1133
Howard Hinnante9df0a52013-08-01 18:17:34 +00001134#ifndef _LIBCPP_MSVCRT
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001135using ::cbrt;
1136using ::cbrtf;
1137
Howard Hinnantcac0c462012-07-06 19:13:50 +00001138inline _LIBCPP_INLINE_VISIBILITY float cbrt(float __x) _NOEXCEPT {return cbrtf(__x);}
1139inline _LIBCPP_INLINE_VISIBILITY long double cbrt(long double __x) _NOEXCEPT {return cbrtl(__x);}
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001140
1141template <class _A1>
Howard Hinnant422a53f2010-09-21 21:28:23 +00001142inline _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001143typename enable_if<is_integral<_A1>::value, double>::type
Howard Hinnantcac0c462012-07-06 19:13:50 +00001144cbrt(_A1 __x) _NOEXCEPT {return cbrt((double)__x);}
Howard Hinnant9f8884e2011-10-27 16:24:42 +00001145#endif
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001146
1147// copysign
1148
1149using ::copysign;
1150using ::copysignf;
1151
Howard Hinnantcac0c462012-07-06 19:13:50 +00001152inline _LIBCPP_INLINE_VISIBILITY float copysign(float __x, float __y) _NOEXCEPT {return copysignf(__x, __y);}
1153inline _LIBCPP_INLINE_VISIBILITY long double copysign(long double __x, long double __y) _NOEXCEPT {return copysignl(__x, __y);}
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001154
1155template <class _A1, class _A2>
Howard Hinnant422a53f2010-09-21 21:28:23 +00001156inline _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001157typename enable_if
1158<
1159 is_arithmetic<_A1>::value &&
1160 is_arithmetic<_A2>::value,
1161 typename __promote<_A1, _A2>::type
1162>::type
Howard Hinnantcac0c462012-07-06 19:13:50 +00001163copysign(_A1 __x, _A2 __y) _NOEXCEPT
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001164{
1165 typedef typename __promote<_A1, _A2>::type __result_type;
1166 static_assert((!(is_same<_A1, __result_type>::value &&
1167 is_same<_A2, __result_type>::value)), "");
1168 return copysign((__result_type)__x, (__result_type)__y);
1169}
1170
Howard Hinnante9df0a52013-08-01 18:17:34 +00001171#ifndef _LIBCPP_MSVCRT
Howard Hinnant9f8884e2011-10-27 16:24:42 +00001172
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001173// erf
1174
1175using ::erf;
1176using ::erff;
1177
Howard Hinnantcac0c462012-07-06 19:13:50 +00001178inline _LIBCPP_INLINE_VISIBILITY float erf(float __x) _NOEXCEPT {return erff(__x);}
1179inline _LIBCPP_INLINE_VISIBILITY long double erf(long double __x) _NOEXCEPT {return erfl(__x);}
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001180
1181template <class _A1>
Howard Hinnant422a53f2010-09-21 21:28:23 +00001182inline _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001183typename enable_if<is_integral<_A1>::value, double>::type
Howard Hinnantcac0c462012-07-06 19:13:50 +00001184erf(_A1 __x) _NOEXCEPT {return erf((double)__x);}
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001185
1186// erfc
1187
1188using ::erfc;
1189using ::erfcf;
1190
Howard Hinnantcac0c462012-07-06 19:13:50 +00001191inline _LIBCPP_INLINE_VISIBILITY float erfc(float __x) _NOEXCEPT {return erfcf(__x);}
1192inline _LIBCPP_INLINE_VISIBILITY long double erfc(long double __x) _NOEXCEPT {return erfcl(__x);}
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001193
1194template <class _A1>
Howard Hinnant422a53f2010-09-21 21:28:23 +00001195inline _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001196typename enable_if<is_integral<_A1>::value, double>::type
Howard Hinnantcac0c462012-07-06 19:13:50 +00001197erfc(_A1 __x) _NOEXCEPT {return erfc((double)__x);}
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001198
1199// exp2
1200
1201using ::exp2;
1202using ::exp2f;
1203
Howard Hinnantcac0c462012-07-06 19:13:50 +00001204inline _LIBCPP_INLINE_VISIBILITY float exp2(float __x) _NOEXCEPT {return exp2f(__x);}
1205inline _LIBCPP_INLINE_VISIBILITY long double exp2(long double __x) _NOEXCEPT {return exp2l(__x);}
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001206
1207template <class _A1>
Howard Hinnant422a53f2010-09-21 21:28:23 +00001208inline _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001209typename enable_if<is_integral<_A1>::value, double>::type
Howard Hinnantcac0c462012-07-06 19:13:50 +00001210exp2(_A1 __x) _NOEXCEPT {return exp2((double)__x);}
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001211
1212// expm1
1213
1214using ::expm1;
1215using ::expm1f;
1216
Howard Hinnantcac0c462012-07-06 19:13:50 +00001217inline _LIBCPP_INLINE_VISIBILITY float expm1(float __x) _NOEXCEPT {return expm1f(__x);}
1218inline _LIBCPP_INLINE_VISIBILITY long double expm1(long double __x) _NOEXCEPT {return expm1l(__x);}
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001219
1220template <class _A1>
Howard Hinnant422a53f2010-09-21 21:28:23 +00001221inline _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001222typename enable_if<is_integral<_A1>::value, double>::type
Howard Hinnantcac0c462012-07-06 19:13:50 +00001223expm1(_A1 __x) _NOEXCEPT {return expm1((double)__x);}
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001224
1225// fdim
1226
1227using ::fdim;
1228using ::fdimf;
1229
Howard Hinnantcac0c462012-07-06 19:13:50 +00001230inline _LIBCPP_INLINE_VISIBILITY float fdim(float __x, float __y) _NOEXCEPT {return fdimf(__x, __y);}
1231inline _LIBCPP_INLINE_VISIBILITY long double fdim(long double __x, long double __y) _NOEXCEPT {return fdiml(__x, __y);}
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001232
1233template <class _A1, class _A2>
Howard Hinnant422a53f2010-09-21 21:28:23 +00001234inline _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001235typename enable_if
1236<
1237 is_arithmetic<_A1>::value &&
1238 is_arithmetic<_A2>::value,
1239 typename __promote<_A1, _A2>::type
1240>::type
Howard Hinnantcac0c462012-07-06 19:13:50 +00001241fdim(_A1 __x, _A2 __y) _NOEXCEPT
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001242{
1243 typedef typename __promote<_A1, _A2>::type __result_type;
1244 static_assert((!(is_same<_A1, __result_type>::value &&
1245 is_same<_A2, __result_type>::value)), "");
1246 return fdim((__result_type)__x, (__result_type)__y);
1247}
1248
1249// fma
1250
Howard Hinnantcac0c462012-07-06 19:13:50 +00001251inline _LIBCPP_INLINE_VISIBILITY float fmaf(float __x, float __y, float __z) _NOEXCEPT {return (float)((double)__x*__y + __z);}
Howard Hinnant0919dba2012-11-06 21:55:44 +00001252#ifndef FP_FAST_FMAF
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001253#define FP_FAST_FMAF
Howard Hinnant0919dba2012-11-06 21:55:44 +00001254#endif
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001255
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001256using ::fma;
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001257
Howard Hinnantcac0c462012-07-06 19:13:50 +00001258inline _LIBCPP_INLINE_VISIBILITY float fma(float __x, float __y, float __z) _NOEXCEPT {return fmaf(__x, __y, __z);}
1259inline _LIBCPP_INLINE_VISIBILITY long double fma(long double __x, long double __y, long double __z) _NOEXCEPT {return fmal(__x, __y, __z);}
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001260
1261template <class _A1, class _A2, class _A3>
Howard Hinnant422a53f2010-09-21 21:28:23 +00001262inline _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001263typename enable_if
1264<
1265 is_arithmetic<_A1>::value &&
1266 is_arithmetic<_A2>::value &&
1267 is_arithmetic<_A3>::value,
1268 typename __promote<_A1, _A2, _A3>::type
1269>::type
Howard Hinnantcac0c462012-07-06 19:13:50 +00001270fma(_A1 __x, _A2 __y, _A3 __z) _NOEXCEPT
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001271{
1272 typedef typename __promote<_A1, _A2, _A3>::type __result_type;
1273 static_assert((!(is_same<_A1, __result_type>::value &&
1274 is_same<_A2, __result_type>::value &&
1275 is_same<_A3, __result_type>::value)), "");
1276 return fma((__result_type)__x, (__result_type)__y, (__result_type)__z);
1277}
1278
1279// fmax
1280
1281using ::fmax;
1282using ::fmaxf;
1283
Howard Hinnantcac0c462012-07-06 19:13:50 +00001284inline _LIBCPP_INLINE_VISIBILITY float fmax(float __x, float __y) _NOEXCEPT {return fmaxf(__x, __y);}
1285inline _LIBCPP_INLINE_VISIBILITY long double fmax(long double __x, long double __y) _NOEXCEPT {return fmaxl(__x, __y);}
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001286
1287template <class _A1, class _A2>
Howard Hinnant422a53f2010-09-21 21:28:23 +00001288inline _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001289typename enable_if
1290<
1291 is_arithmetic<_A1>::value &&
1292 is_arithmetic<_A2>::value,
1293 typename __promote<_A1, _A2>::type
1294>::type
Howard Hinnantcac0c462012-07-06 19:13:50 +00001295fmax(_A1 __x, _A2 __y) _NOEXCEPT
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001296{
1297 typedef typename __promote<_A1, _A2>::type __result_type;
1298 static_assert((!(is_same<_A1, __result_type>::value &&
1299 is_same<_A2, __result_type>::value)), "");
1300 return fmax((__result_type)__x, (__result_type)__y);
1301}
1302
1303// fmin
1304
1305using ::fmin;
1306using ::fminf;
1307
Howard Hinnantcac0c462012-07-06 19:13:50 +00001308inline _LIBCPP_INLINE_VISIBILITY float fmin(float __x, float __y) _NOEXCEPT {return fminf(__x, __y);}
1309inline _LIBCPP_INLINE_VISIBILITY long double fmin(long double __x, long double __y) _NOEXCEPT {return fminl(__x, __y);}
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001310
1311template <class _A1, class _A2>
Howard Hinnant422a53f2010-09-21 21:28:23 +00001312inline _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001313typename enable_if
1314<
1315 is_arithmetic<_A1>::value &&
1316 is_arithmetic<_A2>::value,
1317 typename __promote<_A1, _A2>::type
1318>::type
Howard Hinnantcac0c462012-07-06 19:13:50 +00001319fmin(_A1 __x, _A2 __y) _NOEXCEPT
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001320{
1321 typedef typename __promote<_A1, _A2>::type __result_type;
1322 static_assert((!(is_same<_A1, __result_type>::value &&
1323 is_same<_A2, __result_type>::value)), "");
1324 return fmin((__result_type)__x, (__result_type)__y);
1325}
1326
1327// hypot
1328
1329using ::hypot;
1330using ::hypotf;
1331
Howard Hinnantcac0c462012-07-06 19:13:50 +00001332inline _LIBCPP_INLINE_VISIBILITY float hypot(float __x, float __y) _NOEXCEPT {return hypotf(__x, __y);}
1333inline _LIBCPP_INLINE_VISIBILITY long double hypot(long double __x, long double __y) _NOEXCEPT {return hypotl(__x, __y);}
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001334
1335template <class _A1, class _A2>
Howard Hinnant422a53f2010-09-21 21:28:23 +00001336inline _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001337typename enable_if
1338<
1339 is_arithmetic<_A1>::value &&
1340 is_arithmetic<_A2>::value,
1341 typename __promote<_A1, _A2>::type
1342>::type
Howard Hinnantcac0c462012-07-06 19:13:50 +00001343hypot(_A1 __x, _A2 __y) _NOEXCEPT
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001344{
1345 typedef typename __promote<_A1, _A2>::type __result_type;
1346 static_assert((!(is_same<_A1, __result_type>::value &&
1347 is_same<_A2, __result_type>::value)), "");
1348 return hypot((__result_type)__x, (__result_type)__y);
1349}
1350
1351// ilogb
1352
1353using ::ilogb;
1354using ::ilogbf;
1355
Howard Hinnantcac0c462012-07-06 19:13:50 +00001356inline _LIBCPP_INLINE_VISIBILITY int ilogb(float __x) _NOEXCEPT {return ilogbf(__x);}
1357inline _LIBCPP_INLINE_VISIBILITY int ilogb(long double __x) _NOEXCEPT {return ilogbl(__x);}
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001358
1359template <class _A1>
Howard Hinnant422a53f2010-09-21 21:28:23 +00001360inline _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001361typename enable_if<is_integral<_A1>::value, int>::type
Howard Hinnantcac0c462012-07-06 19:13:50 +00001362ilogb(_A1 __x) _NOEXCEPT {return ilogb((double)__x);}
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001363
1364// lgamma
1365
1366using ::lgamma;
1367using ::lgammaf;
1368
Howard Hinnantcac0c462012-07-06 19:13:50 +00001369inline _LIBCPP_INLINE_VISIBILITY float lgamma(float __x) _NOEXCEPT {return lgammaf(__x);}
1370inline _LIBCPP_INLINE_VISIBILITY long double lgamma(long double __x) _NOEXCEPT {return lgammal(__x);}
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001371
David Chisnall997e4542012-02-29 13:05:08 +00001372
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001373template <class _A1>
Howard Hinnant422a53f2010-09-21 21:28:23 +00001374inline _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001375typename enable_if<is_integral<_A1>::value, double>::type
Howard Hinnantcac0c462012-07-06 19:13:50 +00001376lgamma(_A1 __x) _NOEXCEPT {return lgamma((double)__x);}
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001377
David Chisnall997e4542012-02-29 13:05:08 +00001378
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001379// llrint
1380
1381using ::llrint;
1382using ::llrintf;
1383
Howard Hinnantcac0c462012-07-06 19:13:50 +00001384inline _LIBCPP_INLINE_VISIBILITY long long llrint(float __x) _NOEXCEPT {return llrintf(__x);}
1385inline _LIBCPP_INLINE_VISIBILITY long long llrint(long double __x) _NOEXCEPT {return llrintl(__x);}
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001386
1387template <class _A1>
Howard Hinnant422a53f2010-09-21 21:28:23 +00001388inline _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001389typename enable_if<is_integral<_A1>::value, long long>::type
Howard Hinnantcac0c462012-07-06 19:13:50 +00001390llrint(_A1 __x) _NOEXCEPT {return llrint((double)__x);}
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001391
1392// llround
1393
1394using ::llround;
1395using ::llroundf;
1396
Howard Hinnantcac0c462012-07-06 19:13:50 +00001397inline _LIBCPP_INLINE_VISIBILITY long long llround(float __x) _NOEXCEPT {return llroundf(__x);}
1398inline _LIBCPP_INLINE_VISIBILITY long long llround(long double __x) _NOEXCEPT {return llroundl(__x);}
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001399
1400template <class _A1>
Howard Hinnant422a53f2010-09-21 21:28:23 +00001401inline _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001402typename enable_if<is_integral<_A1>::value, long long>::type
Howard Hinnantcac0c462012-07-06 19:13:50 +00001403llround(_A1 __x) _NOEXCEPT {return llround((double)__x);}
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001404
1405// log1p
1406
1407using ::log1p;
1408using ::log1pf;
1409
Howard Hinnantcac0c462012-07-06 19:13:50 +00001410inline _LIBCPP_INLINE_VISIBILITY float log1p(float __x) _NOEXCEPT {return log1pf(__x);}
1411inline _LIBCPP_INLINE_VISIBILITY long double log1p(long double __x) _NOEXCEPT {return log1pl(__x);}
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001412
1413template <class _A1>
Howard Hinnant422a53f2010-09-21 21:28:23 +00001414inline _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001415typename enable_if<is_integral<_A1>::value, double>::type
Howard Hinnantcac0c462012-07-06 19:13:50 +00001416log1p(_A1 __x) _NOEXCEPT {return log1p((double)__x);}
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001417
1418// log2
1419
1420using ::log2;
1421using ::log2f;
1422
Howard Hinnantcac0c462012-07-06 19:13:50 +00001423inline _LIBCPP_INLINE_VISIBILITY float log2(float __x) _NOEXCEPT {return log2f(__x);}
1424inline _LIBCPP_INLINE_VISIBILITY long double log2(long double __x) _NOEXCEPT {return log2l(__x);}
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001425
1426template <class _A1>
Howard Hinnant422a53f2010-09-21 21:28:23 +00001427inline _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001428typename enable_if<is_integral<_A1>::value, double>::type
Howard Hinnantcac0c462012-07-06 19:13:50 +00001429log2(_A1 __x) _NOEXCEPT {return log2((double)__x);}
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001430
1431// logb
1432
1433using ::logb;
1434using ::logbf;
1435
Howard Hinnantcac0c462012-07-06 19:13:50 +00001436inline _LIBCPP_INLINE_VISIBILITY float logb(float __x) _NOEXCEPT {return logbf(__x);}
1437inline _LIBCPP_INLINE_VISIBILITY long double logb(long double __x) _NOEXCEPT {return logbl(__x);}
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001438
1439template <class _A1>
Howard Hinnant422a53f2010-09-21 21:28:23 +00001440inline _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001441typename enable_if<is_integral<_A1>::value, double>::type
Howard Hinnantcac0c462012-07-06 19:13:50 +00001442logb(_A1 __x) _NOEXCEPT {return logb((double)__x);}
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001443
1444// lrint
1445
1446using ::lrint;
1447using ::lrintf;
1448
Howard Hinnantcac0c462012-07-06 19:13:50 +00001449inline _LIBCPP_INLINE_VISIBILITY long lrint(float __x) _NOEXCEPT {return lrintf(__x);}
1450inline _LIBCPP_INLINE_VISIBILITY long lrint(long double __x) _NOEXCEPT {return lrintl(__x);}
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001451
1452template <class _A1>
Howard Hinnant422a53f2010-09-21 21:28:23 +00001453inline _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001454typename enable_if<is_integral<_A1>::value, long>::type
Howard Hinnantcac0c462012-07-06 19:13:50 +00001455lrint(_A1 __x) _NOEXCEPT {return lrint((double)__x);}
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001456
1457// lround
1458
1459using ::lround;
1460using ::lroundf;
1461
Howard Hinnantcac0c462012-07-06 19:13:50 +00001462inline _LIBCPP_INLINE_VISIBILITY long lround(float __x) _NOEXCEPT {return lroundf(__x);}
1463inline _LIBCPP_INLINE_VISIBILITY long lround(long double __x) _NOEXCEPT {return lroundl(__x);}
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001464
1465template <class _A1>
Howard Hinnant422a53f2010-09-21 21:28:23 +00001466inline _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001467typename enable_if<is_integral<_A1>::value, long>::type
Howard Hinnantcac0c462012-07-06 19:13:50 +00001468lround(_A1 __x) _NOEXCEPT {return lround((double)__x);}
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001469
Howard Hinnante9df0a52013-08-01 18:17:34 +00001470#endif // _LIBCPP_MSVCRT
David Chisnall997e4542012-02-29 13:05:08 +00001471#endif // __sun__
Howard Hinnante9df0a52013-08-01 18:17:34 +00001472
1473// nan
1474
1475#ifndef _LIBCPP_MSVCRT
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001476using ::nan;
1477using ::nanf;
Howard Hinnante9df0a52013-08-01 18:17:34 +00001478#endif // _LIBCPP_MSVCRT
1479
David Chisnall997e4542012-02-29 13:05:08 +00001480#ifndef __sun__
Howard Hinnante9df0a52013-08-01 18:17:34 +00001481#ifndef _LIBCPP_MSVCRT
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001482
1483// nearbyint
1484
1485using ::nearbyint;
1486using ::nearbyintf;
1487
Howard Hinnantcac0c462012-07-06 19:13:50 +00001488inline _LIBCPP_INLINE_VISIBILITY float nearbyint(float __x) _NOEXCEPT {return nearbyintf(__x);}
1489inline _LIBCPP_INLINE_VISIBILITY long double nearbyint(long double __x) _NOEXCEPT {return nearbyintl(__x);}
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001490
1491template <class _A1>
Howard Hinnant422a53f2010-09-21 21:28:23 +00001492inline _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001493typename enable_if<is_integral<_A1>::value, double>::type
Howard Hinnantcac0c462012-07-06 19:13:50 +00001494nearbyint(_A1 __x) _NOEXCEPT {return nearbyint((double)__x);}
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001495
1496// nextafter
1497
1498using ::nextafter;
1499using ::nextafterf;
1500
Howard Hinnantcac0c462012-07-06 19:13:50 +00001501inline _LIBCPP_INLINE_VISIBILITY float nextafter(float __x, float __y) _NOEXCEPT {return nextafterf(__x, __y);}
1502inline _LIBCPP_INLINE_VISIBILITY long double nextafter(long double __x, long double __y) _NOEXCEPT {return nextafterl(__x, __y);}
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001503
1504template <class _A1, class _A2>
Howard Hinnant422a53f2010-09-21 21:28:23 +00001505inline _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001506typename enable_if
1507<
1508 is_arithmetic<_A1>::value &&
1509 is_arithmetic<_A2>::value,
1510 typename __promote<_A1, _A2>::type
1511>::type
Howard Hinnantcac0c462012-07-06 19:13:50 +00001512nextafter(_A1 __x, _A2 __y) _NOEXCEPT
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001513{
1514 typedef typename __promote<_A1, _A2>::type __result_type;
1515 static_assert((!(is_same<_A1, __result_type>::value &&
1516 is_same<_A2, __result_type>::value)), "");
1517 return nextafter((__result_type)__x, (__result_type)__y);
1518}
1519
1520// nexttoward
1521
1522using ::nexttoward;
1523using ::nexttowardf;
1524
Howard Hinnantcac0c462012-07-06 19:13:50 +00001525inline _LIBCPP_INLINE_VISIBILITY float nexttoward(float __x, long double __y) _NOEXCEPT {return nexttowardf(__x, __y);}
1526inline _LIBCPP_INLINE_VISIBILITY long double nexttoward(long double __x, long double __y) _NOEXCEPT {return nexttowardl(__x, __y);}
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001527
1528template <class _A1>
Howard Hinnant422a53f2010-09-21 21:28:23 +00001529inline _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001530typename enable_if<is_integral<_A1>::value, double>::type
Howard Hinnantcac0c462012-07-06 19:13:50 +00001531nexttoward(_A1 __x, long double __y) _NOEXCEPT {return nexttoward((double)__x, __y);}
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001532
1533// remainder
1534
1535using ::remainder;
1536using ::remainderf;
1537
Howard Hinnantcac0c462012-07-06 19:13:50 +00001538inline _LIBCPP_INLINE_VISIBILITY float remainder(float __x, float __y) _NOEXCEPT {return remainderf(__x, __y);}
1539inline _LIBCPP_INLINE_VISIBILITY long double remainder(long double __x, long double __y) _NOEXCEPT {return remainderl(__x, __y);}
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001540
1541template <class _A1, class _A2>
Howard Hinnant422a53f2010-09-21 21:28:23 +00001542inline _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001543typename enable_if
1544<
1545 is_arithmetic<_A1>::value &&
1546 is_arithmetic<_A2>::value,
1547 typename __promote<_A1, _A2>::type
1548>::type
Howard Hinnantcac0c462012-07-06 19:13:50 +00001549remainder(_A1 __x, _A2 __y) _NOEXCEPT
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001550{
1551 typedef typename __promote<_A1, _A2>::type __result_type;
1552 static_assert((!(is_same<_A1, __result_type>::value &&
1553 is_same<_A2, __result_type>::value)), "");
1554 return remainder((__result_type)__x, (__result_type)__y);
1555}
1556
1557// remquo
1558
1559using ::remquo;
1560using ::remquof;
1561
Howard Hinnantcac0c462012-07-06 19:13:50 +00001562inline _LIBCPP_INLINE_VISIBILITY float remquo(float __x, float __y, int* __z) _NOEXCEPT {return remquof(__x, __y, __z);}
1563inline _LIBCPP_INLINE_VISIBILITY long double remquo(long double __x, long double __y, int* __z) _NOEXCEPT {return remquol(__x, __y, __z);}
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001564
1565template <class _A1, class _A2>
Howard Hinnant422a53f2010-09-21 21:28:23 +00001566inline _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001567typename enable_if
1568<
1569 is_arithmetic<_A1>::value &&
1570 is_arithmetic<_A2>::value,
1571 typename __promote<_A1, _A2>::type
1572>::type
Howard Hinnantcac0c462012-07-06 19:13:50 +00001573remquo(_A1 __x, _A2 __y, int* __z) _NOEXCEPT
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001574{
1575 typedef typename __promote<_A1, _A2>::type __result_type;
1576 static_assert((!(is_same<_A1, __result_type>::value &&
1577 is_same<_A2, __result_type>::value)), "");
1578 return remquo((__result_type)__x, (__result_type)__y, __z);
1579}
1580
1581// rint
1582
1583using ::rint;
1584using ::rintf;
1585
Howard Hinnantcac0c462012-07-06 19:13:50 +00001586inline _LIBCPP_INLINE_VISIBILITY float rint(float __x) _NOEXCEPT {return rintf(__x);}
1587inline _LIBCPP_INLINE_VISIBILITY long double rint(long double __x) _NOEXCEPT {return rintl(__x);}
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001588
1589template <class _A1>
Howard Hinnant422a53f2010-09-21 21:28:23 +00001590inline _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001591typename enable_if<is_integral<_A1>::value, double>::type
Howard Hinnantcac0c462012-07-06 19:13:50 +00001592rint(_A1 __x) _NOEXCEPT {return rint((double)__x);}
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001593
1594// round
1595
1596using ::round;
1597using ::roundf;
1598
Howard Hinnantcac0c462012-07-06 19:13:50 +00001599inline _LIBCPP_INLINE_VISIBILITY float round(float __x) _NOEXCEPT {return roundf(__x);}
1600inline _LIBCPP_INLINE_VISIBILITY long double round(long double __x) _NOEXCEPT {return roundl(__x);}
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001601
1602template <class _A1>
Howard Hinnant422a53f2010-09-21 21:28:23 +00001603inline _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001604typename enable_if<is_integral<_A1>::value, double>::type
Howard Hinnantcac0c462012-07-06 19:13:50 +00001605round(_A1 __x) _NOEXCEPT {return round((double)__x);}
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001606
1607// scalbln
1608
1609using ::scalbln;
1610using ::scalblnf;
1611
Howard Hinnantcac0c462012-07-06 19:13:50 +00001612inline _LIBCPP_INLINE_VISIBILITY float scalbln(float __x, long __y) _NOEXCEPT {return scalblnf(__x, __y);}
1613inline _LIBCPP_INLINE_VISIBILITY long double scalbln(long double __x, long __y) _NOEXCEPT {return scalblnl(__x, __y);}
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001614
1615template <class _A1>
Howard Hinnant422a53f2010-09-21 21:28:23 +00001616inline _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001617typename enable_if<is_integral<_A1>::value, double>::type
Howard Hinnantcac0c462012-07-06 19:13:50 +00001618scalbln(_A1 __x, long __y) _NOEXCEPT {return scalbln((double)__x, __y);}
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001619
1620// scalbn
1621
1622using ::scalbn;
1623using ::scalbnf;
1624
Howard Hinnantcac0c462012-07-06 19:13:50 +00001625inline _LIBCPP_INLINE_VISIBILITY float scalbn(float __x, int __y) _NOEXCEPT {return scalbnf(__x, __y);}
1626inline _LIBCPP_INLINE_VISIBILITY long double scalbn(long double __x, int __y) _NOEXCEPT {return scalbnl(__x, __y);}
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001627
1628template <class _A1>
Howard Hinnant422a53f2010-09-21 21:28:23 +00001629inline _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001630typename enable_if<is_integral<_A1>::value, double>::type
Howard Hinnantcac0c462012-07-06 19:13:50 +00001631scalbn(_A1 __x, int __y) _NOEXCEPT {return scalbn((double)__x, __y);}
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001632
1633// tgamma
1634
1635using ::tgamma;
1636using ::tgammaf;
1637
Howard Hinnantcac0c462012-07-06 19:13:50 +00001638inline _LIBCPP_INLINE_VISIBILITY float tgamma(float __x) _NOEXCEPT {return tgammaf(__x);}
1639inline _LIBCPP_INLINE_VISIBILITY long double tgamma(long double __x) _NOEXCEPT {return tgammal(__x);}
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001640
1641template <class _A1>
Howard Hinnant422a53f2010-09-21 21:28:23 +00001642inline _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001643typename enable_if<is_integral<_A1>::value, double>::type
Howard Hinnantcac0c462012-07-06 19:13:50 +00001644tgamma(_A1 __x) _NOEXCEPT {return tgamma((double)__x);}
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001645
1646// trunc
1647
1648using ::trunc;
1649using ::truncf;
1650
Howard Hinnantcac0c462012-07-06 19:13:50 +00001651inline _LIBCPP_INLINE_VISIBILITY float trunc(float __x) _NOEXCEPT {return truncf(__x);}
1652inline _LIBCPP_INLINE_VISIBILITY long double trunc(long double __x) _NOEXCEPT {return truncl(__x);}
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001653
1654template <class _A1>
Howard Hinnant422a53f2010-09-21 21:28:23 +00001655inline _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001656typename enable_if<is_integral<_A1>::value, double>::type
Howard Hinnantcac0c462012-07-06 19:13:50 +00001657trunc(_A1 __x) _NOEXCEPT {return trunc((double)__x);}
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001658
Howard Hinnante9df0a52013-08-01 18:17:34 +00001659#endif // !_LIBCPP_MSVCRT
Howard Hinnant9f8884e2011-10-27 16:24:42 +00001660
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001661using ::acosl;
1662using ::asinl;
1663using ::atanl;
1664using ::atan2l;
1665using ::ceill;
1666using ::cosl;
1667using ::coshl;
1668using ::expl;
1669using ::fabsl;
1670using ::floorl;
1671using ::fmodl;
1672using ::frexpl;
1673using ::ldexpl;
1674using ::logl;
1675using ::log10l;
1676using ::modfl;
1677using ::powl;
1678using ::sinl;
1679using ::sinhl;
1680using ::sqrtl;
1681using ::tanl;
Howard Hinnante9df0a52013-08-01 18:17:34 +00001682#ifndef _LIBCPP_MSVCRT
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001683using ::tanhl;
1684using ::acoshl;
1685using ::asinhl;
1686using ::atanhl;
1687using ::cbrtl;
Howard Hinnante9df0a52013-08-01 18:17:34 +00001688#endif // !_LIBCPP_MSVCRT
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001689using ::copysignl;
Howard Hinnante9df0a52013-08-01 18:17:34 +00001690#ifndef _LIBCPP_MSVCRT
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001691using ::erfl;
1692using ::erfcl;
1693using ::exp2l;
1694using ::expm1l;
1695using ::fdiml;
1696using ::fmal;
1697using ::fmaxl;
1698using ::fminl;
1699using ::hypotl;
1700using ::ilogbl;
1701using ::lgammal;
1702using ::llrintl;
1703using ::llroundl;
1704using ::log1pl;
1705using ::log2l;
1706using ::logbl;
1707using ::lrintl;
1708using ::lroundl;
1709using ::nanl;
1710using ::nearbyintl;
1711using ::nextafterl;
1712using ::nexttowardl;
1713using ::remainderl;
1714using ::remquol;
1715using ::rintl;
1716using ::roundl;
1717using ::scalblnl;
1718using ::scalbnl;
1719using ::tgammal;
1720using ::truncl;
Howard Hinnante9df0a52013-08-01 18:17:34 +00001721#endif // !_LIBCPP_MSVCRT
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001722
David Chisnall997e4542012-02-29 13:05:08 +00001723#else
1724using ::lgamma;
1725using ::lgammaf;
1726#endif // __sun__
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001727_LIBCPP_END_NAMESPACE_STD
1728
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001729#endif // _LIBCPP_CMATH