blob: 964c6729c165b096eea9fbc6cb003afdbb8356f0 [file] [log] [blame]
Howard Hinnantbc8d3f92010-05-11 19:42:161// -*- C++ -*-
2//===---------------------------- cmath -----------------------------------===//
3//
Howard Hinnantf5256e12010-05-11 21:36:014// The LLVM Compiler Infrastructure
Howard Hinnantbc8d3f92010-05-11 19:42:165//
Howard Hinnantb64f8b02010-11-16 22:09:026// 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:168//
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:22140bool signbit(arithmetic x);
Howard Hinnantbc8d3f92010-05-11 19:42:16141
Howard Hinnantb05a5562013-01-14 20:56:22142int fpclassify(arithmetic x);
Howard Hinnantbc8d3f92010-05-11 19:42:16143
Howard Hinnantb05a5562013-01-14 20:56:22144bool isfinite(arithmetic x);
145bool isinf(arithmetic x);
146bool isnan(arithmetic x);
147bool isnormal(arithmetic x);
Howard Hinnantbc8d3f92010-05-11 19:42:16148
Howard Hinnantb05a5562013-01-14 20:56:22149bool 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:16155
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:34304#ifdef _LIBCPP_MSVCRT
Howard Hinnant9f8884e2011-10-27 16:24:42305#include "support/win32/math_win32.h"
306#endif
307
Howard Hinnant08e17472011-10-17 20:05:10308#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
Howard Hinnantbc8d3f92010-05-11 19:42:16309#pragma GCC system_header
Howard Hinnant08e17472011-10-17 20:05:10310#endif
Howard Hinnantbc8d3f92010-05-11 19:42:16311
Howard Hinnant0a111112011-05-13 21:52:40312// signbit
313
314#ifdef signbit
315
316template <class _A1>
317_LIBCPP_ALWAYS_INLINE
318bool
Howard Hinnantcac0c462012-07-06 19:13:50319__libcpp_signbit(_A1 __x) _NOEXCEPT
Howard Hinnant0a111112011-05-13 21:52:40320{
321 return signbit(__x);
322}
323
324#undef signbit
325
326template <class _A1>
327inline _LIBCPP_INLINE_VISIBILITY
Howard Hinnantb05a5562013-01-14 20:56:22328typename std::enable_if<std::is_arithmetic<_A1>::value, bool>::type
Howard Hinnantcac0c462012-07-06 19:13:50329signbit(_A1 __x) _NOEXCEPT
Howard Hinnant0a111112011-05-13 21:52:40330{
Howard Hinnantb05a5562013-01-14 20:56:22331 return __libcpp_signbit((typename std::__promote<_A1>::type)__x);
Howard Hinnant0a111112011-05-13 21:52:40332}
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:50343__libcpp_fpclassify(_A1 __x) _NOEXCEPT
Howard Hinnant0a111112011-05-13 21:52:40344{
345 return fpclassify(__x);
346}
347
348#undef fpclassify
349
350template <class _A1>
351inline _LIBCPP_INLINE_VISIBILITY
Howard Hinnantb05a5562013-01-14 20:56:22352typename std::enable_if<std::is_arithmetic<_A1>::value, int>::type
Howard Hinnantcac0c462012-07-06 19:13:50353fpclassify(_A1 __x) _NOEXCEPT
Howard Hinnant0a111112011-05-13 21:52:40354{
Howard Hinnantb05a5562013-01-14 20:56:22355 return __libcpp_fpclassify((typename std::__promote<_A1>::type)__x);
Howard Hinnant0a111112011-05-13 21:52:40356}
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:50367__libcpp_isfinite(_A1 __x) _NOEXCEPT
Howard Hinnant0a111112011-05-13 21:52:40368{
369 return isfinite(__x);
370}
371
372#undef isfinite
373
374template <class _A1>
375inline _LIBCPP_INLINE_VISIBILITY
Howard Hinnantb05a5562013-01-14 20:56:22376typename std::enable_if<std::is_arithmetic<_A1>::value, bool>::type
Howard Hinnantcac0c462012-07-06 19:13:50377isfinite(_A1 __x) _NOEXCEPT
Howard Hinnant0a111112011-05-13 21:52:40378{
Howard Hinnantb05a5562013-01-14 20:56:22379 return __libcpp_isfinite((typename std::__promote<_A1>::type)__x);
Howard Hinnant0a111112011-05-13 21:52:40380}
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:50391__libcpp_isinf(_A1 __x) _NOEXCEPT
Howard Hinnant0a111112011-05-13 21:52:40392{
393 return isinf(__x);
394}
395
396#undef isinf
397
398template <class _A1>
399inline _LIBCPP_INLINE_VISIBILITY
Howard Hinnantb05a5562013-01-14 20:56:22400typename std::enable_if<std::is_arithmetic<_A1>::value, bool>::type
Howard Hinnantcac0c462012-07-06 19:13:50401isinf(_A1 __x) _NOEXCEPT
Howard Hinnant0a111112011-05-13 21:52:40402{
Howard Hinnantb05a5562013-01-14 20:56:22403 return __libcpp_isinf((typename std::__promote<_A1>::type)__x);
Howard Hinnant0a111112011-05-13 21:52:40404}
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:50415__libcpp_isnan(_A1 __x) _NOEXCEPT
Howard Hinnant0a111112011-05-13 21:52:40416{
417 return isnan(__x);
418}
419
420#undef isnan
421
Marshall Clow908b5d72014-01-06 18:12:50422template <class _A1>
Howard Hinnant0a111112011-05-13 21:52:40423inline _LIBCPP_INLINE_VISIBILITY
Marshall Clow908b5d72014-01-06 18:12:50424typename std::enable_if<std::is_arithmetic<_A1>::value, bool>::type
425isnan(_A1 __x) _NOEXCEPT
Howard Hinnant0a111112011-05-13 21:52:40426{
Marshall Clow908b5d72014-01-06 18:12:50427 return __libcpp_isnan((typename std::__promote<_A1>::type)__x);
Howard Hinnant0a111112011-05-13 21:52:40428}
429
430#endif // isnan
431
432// isnormal
433
434#ifdef isnormal
435
436template <class _A1>
437_LIBCPP_ALWAYS_INLINE
438bool
Howard Hinnantcac0c462012-07-06 19:13:50439__libcpp_isnormal(_A1 __x) _NOEXCEPT
Howard Hinnant0a111112011-05-13 21:52:40440{
441 return isnormal(__x);
442}
443
444#undef isnormal
445
446template <class _A1>
447inline _LIBCPP_INLINE_VISIBILITY
Howard Hinnantb05a5562013-01-14 20:56:22448typename std::enable_if<std::is_arithmetic<_A1>::value, bool>::type
Howard Hinnantcac0c462012-07-06 19:13:50449isnormal(_A1 __x) _NOEXCEPT
Howard Hinnant0a111112011-05-13 21:52:40450{
Howard Hinnantb05a5562013-01-14 20:56:22451 return __libcpp_isnormal((typename std::__promote<_A1>::type)__x);
Howard Hinnant0a111112011-05-13 21:52:40452}
453
454#endif // isnormal
455
456// isgreater
457
458#ifdef isgreater
459
460template <class _A1, class _A2>
461_LIBCPP_ALWAYS_INLINE
462bool
Howard Hinnantcac0c462012-07-06 19:13:50463__libcpp_isgreater(_A1 __x, _A2 __y) _NOEXCEPT
Howard Hinnant0a111112011-05-13 21:52:40464{
465 return isgreater(__x, __y);
466}
467
468#undef isgreater
469
470template <class _A1, class _A2>
471inline _LIBCPP_INLINE_VISIBILITY
472typename std::enable_if
473<
Howard Hinnantb05a5562013-01-14 20:56:22474 std::is_arithmetic<_A1>::value &&
475 std::is_arithmetic<_A2>::value,
Howard Hinnant0a111112011-05-13 21:52:40476 bool
477>::type
Howard Hinnantcac0c462012-07-06 19:13:50478isgreater(_A1 __x, _A2 __y) _NOEXCEPT
Howard Hinnant0a111112011-05-13 21:52:40479{
Howard Hinnantb05a5562013-01-14 20:56:22480 typedef typename std::__promote<_A1, _A2>::type type;
481 return __libcpp_isgreater((type)__x, (type)__y);
Howard Hinnant0a111112011-05-13 21:52:40482}
483
484#endif // isgreater
485
486// isgreaterequal
487
488#ifdef isgreaterequal
489
490template <class _A1, class _A2>
491_LIBCPP_ALWAYS_INLINE
492bool
Howard Hinnantcac0c462012-07-06 19:13:50493__libcpp_isgreaterequal(_A1 __x, _A2 __y) _NOEXCEPT
Howard Hinnant0a111112011-05-13 21:52:40494{
495 return isgreaterequal(__x, __y);
496}
497
498#undef isgreaterequal
499
500template <class _A1, class _A2>
501inline _LIBCPP_INLINE_VISIBILITY
502typename std::enable_if
503<
Howard Hinnantb05a5562013-01-14 20:56:22504 std::is_arithmetic<_A1>::value &&
505 std::is_arithmetic<_A2>::value,
Howard Hinnant0a111112011-05-13 21:52:40506 bool
507>::type
Howard Hinnantcac0c462012-07-06 19:13:50508isgreaterequal(_A1 __x, _A2 __y) _NOEXCEPT
Howard Hinnant0a111112011-05-13 21:52:40509{
Howard Hinnantb05a5562013-01-14 20:56:22510 typedef typename std::__promote<_A1, _A2>::type type;
511 return __libcpp_isgreaterequal((type)__x, (type)__y);
Howard Hinnant0a111112011-05-13 21:52:40512}
513
514#endif // isgreaterequal
515
516// isless
517
518#ifdef isless
519
520template <class _A1, class _A2>
521_LIBCPP_ALWAYS_INLINE
522bool
Howard Hinnantcac0c462012-07-06 19:13:50523__libcpp_isless(_A1 __x, _A2 __y) _NOEXCEPT
Howard Hinnant0a111112011-05-13 21:52:40524{
525 return isless(__x, __y);
526}
527
528#undef isless
529
530template <class _A1, class _A2>
531inline _LIBCPP_INLINE_VISIBILITY
532typename std::enable_if
533<
Howard Hinnantb05a5562013-01-14 20:56:22534 std::is_arithmetic<_A1>::value &&
535 std::is_arithmetic<_A2>::value,
Howard Hinnant0a111112011-05-13 21:52:40536 bool
537>::type
Howard Hinnantcac0c462012-07-06 19:13:50538isless(_A1 __x, _A2 __y) _NOEXCEPT
Howard Hinnant0a111112011-05-13 21:52:40539{
Howard Hinnantb05a5562013-01-14 20:56:22540 typedef typename std::__promote<_A1, _A2>::type type;
541 return __libcpp_isless((type)__x, (type)__y);
Howard Hinnant0a111112011-05-13 21:52:40542}
543
544#endif // isless
545
546// islessequal
547
548#ifdef islessequal
549
550template <class _A1, class _A2>
551_LIBCPP_ALWAYS_INLINE
552bool
Howard Hinnantcac0c462012-07-06 19:13:50553__libcpp_islessequal(_A1 __x, _A2 __y) _NOEXCEPT
Howard Hinnant0a111112011-05-13 21:52:40554{
555 return islessequal(__x, __y);
556}
557
558#undef islessequal
559
560template <class _A1, class _A2>
561inline _LIBCPP_INLINE_VISIBILITY
562typename std::enable_if
563<
Howard Hinnantb05a5562013-01-14 20:56:22564 std::is_arithmetic<_A1>::value &&
565 std::is_arithmetic<_A2>::value,
Howard Hinnant0a111112011-05-13 21:52:40566 bool
567>::type
Howard Hinnantcac0c462012-07-06 19:13:50568islessequal(_A1 __x, _A2 __y) _NOEXCEPT
Howard Hinnant0a111112011-05-13 21:52:40569{
Howard Hinnantb05a5562013-01-14 20:56:22570 typedef typename std::__promote<_A1, _A2>::type type;
571 return __libcpp_islessequal((type)__x, (type)__y);
Howard Hinnant0a111112011-05-13 21:52:40572}
573
574#endif // islessequal
575
576// islessgreater
577
578#ifdef islessgreater
579
580template <class _A1, class _A2>
581_LIBCPP_ALWAYS_INLINE
582bool
Howard Hinnantcac0c462012-07-06 19:13:50583__libcpp_islessgreater(_A1 __x, _A2 __y) _NOEXCEPT
Howard Hinnant0a111112011-05-13 21:52:40584{
585 return islessgreater(__x, __y);
586}
587
588#undef islessgreater
589
590template <class _A1, class _A2>
591inline _LIBCPP_INLINE_VISIBILITY
592typename std::enable_if
593<
Howard Hinnantb05a5562013-01-14 20:56:22594 std::is_arithmetic<_A1>::value &&
595 std::is_arithmetic<_A2>::value,
Howard Hinnant0a111112011-05-13 21:52:40596 bool
597>::type
Howard Hinnantcac0c462012-07-06 19:13:50598islessgreater(_A1 __x, _A2 __y) _NOEXCEPT
Howard Hinnant0a111112011-05-13 21:52:40599{
Howard Hinnantb05a5562013-01-14 20:56:22600 typedef typename std::__promote<_A1, _A2>::type type;
601 return __libcpp_islessgreater((type)__x, (type)__y);
Howard Hinnant0a111112011-05-13 21:52:40602}
603
604#endif // islessgreater
605
606// isunordered
607
608#ifdef isunordered
609
610template <class _A1, class _A2>
611_LIBCPP_ALWAYS_INLINE
612bool
Howard Hinnantcac0c462012-07-06 19:13:50613__libcpp_isunordered(_A1 __x, _A2 __y) _NOEXCEPT
Howard Hinnant0a111112011-05-13 21:52:40614{
615 return isunordered(__x, __y);
616}
617
618#undef isunordered
619
620template <class _A1, class _A2>
621inline _LIBCPP_INLINE_VISIBILITY
622typename std::enable_if
623<
Howard Hinnantb05a5562013-01-14 20:56:22624 std::is_arithmetic<_A1>::value &&
625 std::is_arithmetic<_A2>::value,
Howard Hinnant0a111112011-05-13 21:52:40626 bool
627>::type
Howard Hinnantcac0c462012-07-06 19:13:50628isunordered(_A1 __x, _A2 __y) _NOEXCEPT
Howard Hinnant0a111112011-05-13 21:52:40629{
Howard Hinnantb05a5562013-01-14 20:56:22630 typedef typename std::__promote<_A1, _A2>::type type;
631 return __libcpp_isunordered((type)__x, (type)__y);
Howard Hinnant0a111112011-05-13 21:52:40632}
633
634#endif // isunordered
635
Howard Hinnantbc8d3f92010-05-11 19:42:16636_LIBCPP_BEGIN_NAMESPACE_STD
637
Howard Hinnant0a111112011-05-13 21:52:40638using ::signbit;
639using ::fpclassify;
640using ::isfinite;
641using ::isinf;
642using ::isnan;
643using ::isnormal;
644using ::isgreater;
645using ::isgreaterequal;
646using ::isless;
647using ::islessequal;
648using ::islessgreater;
649using ::isunordered;
650using ::isunordered;
651
Howard Hinnantbc8d3f92010-05-11 19:42:16652using ::float_t;
653using ::double_t;
654
655// abs
656
Howard Hinnant7f764502013-08-14 18:00:20657#if !defined(_AIX)
Howard Hinnant422a53f2010-09-21 21:28:23658inline _LIBCPP_INLINE_VISIBILITY
Howard Hinnantf07a5292012-05-03 14:58:34659float
Howard Hinnantcac0c462012-07-06 19:13:50660abs(float __x) _NOEXCEPT {return fabsf(__x);}
Howard Hinnantf07a5292012-05-03 14:58:34661
662inline _LIBCPP_INLINE_VISIBILITY
663double
Howard Hinnantcac0c462012-07-06 19:13:50664abs(double __x) _NOEXCEPT {return fabs(__x);}
Howard Hinnantf07a5292012-05-03 14:58:34665
666inline _LIBCPP_INLINE_VISIBILITY
667long double
Howard Hinnantcac0c462012-07-06 19:13:50668abs(long double __x) _NOEXCEPT {return fabsl(__x);}
Howard Hinnant7f764502013-08-14 18:00:20669#endif // !defined(_AIX)
Howard Hinnantbc8d3f92010-05-11 19:42:16670
David Chisnall997e4542012-02-29 13:05:08671#ifndef __sun__
672
Howard Hinnantbc8d3f92010-05-11 19:42:16673// acos
674
675using ::acos;
676using ::acosf;
677
Howard Hinnant7f764502013-08-14 18:00:20678#if !(defined(_LIBCPP_MSVCRT) || defined(_AIX))
Howard Hinnantcac0c462012-07-06 19:13:50679inline _LIBCPP_INLINE_VISIBILITY float acos(float __x) _NOEXCEPT {return acosf(__x);}
680inline _LIBCPP_INLINE_VISIBILITY long double acos(long double __x) _NOEXCEPT {return acosl(__x);}
Howard Hinnant9f8884e2011-10-27 16:24:42681#endif
Howard Hinnantbc8d3f92010-05-11 19:42:16682
683template <class _A1>
Howard Hinnant422a53f2010-09-21 21:28:23684inline _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16685typename enable_if<is_integral<_A1>::value, double>::type
Howard Hinnantcac0c462012-07-06 19:13:50686acos(_A1 __x) _NOEXCEPT {return acos((double)__x);}
Howard Hinnantbc8d3f92010-05-11 19:42:16687
688// asin
689
690using ::asin;
691using ::asinf;
692
Howard Hinnant7f764502013-08-14 18:00:20693#if !(defined(_LIBCPP_MSVCRT) || defined(_AIX))
Howard Hinnantcac0c462012-07-06 19:13:50694inline _LIBCPP_INLINE_VISIBILITY float asin(float __x) _NOEXCEPT {return asinf(__x);}
695inline _LIBCPP_INLINE_VISIBILITY long double asin(long double __x) _NOEXCEPT {return asinl(__x);}
Howard Hinnant9f8884e2011-10-27 16:24:42696#endif
Howard Hinnantbc8d3f92010-05-11 19:42:16697
698template <class _A1>
Howard Hinnant422a53f2010-09-21 21:28:23699inline _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16700typename enable_if<is_integral<_A1>::value, double>::type
Howard Hinnantcac0c462012-07-06 19:13:50701asin(_A1 __x) _NOEXCEPT {return asin((double)__x);}
Howard Hinnantbc8d3f92010-05-11 19:42:16702
703// atan
704
705using ::atan;
706using ::atanf;
707
Howard Hinnant7f764502013-08-14 18:00:20708#if !(defined(_LIBCPP_MSVCRT) || defined(_AIX))
Howard Hinnantcac0c462012-07-06 19:13:50709inline _LIBCPP_INLINE_VISIBILITY float atan(float __x) _NOEXCEPT {return atanf(__x);}
710inline _LIBCPP_INLINE_VISIBILITY long double atan(long double __x) _NOEXCEPT {return atanl(__x);}
Howard Hinnant9f8884e2011-10-27 16:24:42711#endif
Howard Hinnantbc8d3f92010-05-11 19:42:16712
713template <class _A1>
Howard Hinnant422a53f2010-09-21 21:28:23714inline _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16715typename enable_if<is_integral<_A1>::value, double>::type
Howard Hinnantcac0c462012-07-06 19:13:50716atan(_A1 __x) _NOEXCEPT {return atan((double)__x);}
Howard Hinnantbc8d3f92010-05-11 19:42:16717
718// atan2
719
720using ::atan2;
721using ::atan2f;
722
Howard Hinnant7f764502013-08-14 18:00:20723#if !(defined(_LIBCPP_MSVCRT) || defined(_AIX))
Howard Hinnantcac0c462012-07-06 19:13:50724inline _LIBCPP_INLINE_VISIBILITY float atan2(float __y, float __x) _NOEXCEPT {return atan2f(__y, __x);}
725inline _LIBCPP_INLINE_VISIBILITY long double atan2(long double __y, long double __x) _NOEXCEPT {return atan2l(__y, __x);}
Howard Hinnant9f8884e2011-10-27 16:24:42726#endif
Howard Hinnantbc8d3f92010-05-11 19:42:16727
728template <class _A1, class _A2>
Howard Hinnant422a53f2010-09-21 21:28:23729inline _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16730typename enable_if
731<
732 is_arithmetic<_A1>::value &&
733 is_arithmetic<_A2>::value,
734 typename __promote<_A1, _A2>::type
735>::type
Howard Hinnantcac0c462012-07-06 19:13:50736atan2(_A1 __y, _A2 __x) _NOEXCEPT
Howard Hinnantbc8d3f92010-05-11 19:42:16737{
738 typedef typename __promote<_A1, _A2>::type __result_type;
739 static_assert((!(is_same<_A1, __result_type>::value &&
740 is_same<_A2, __result_type>::value)), "");
741 return atan2((__result_type)__y, (__result_type)__x);
742}
743
744// ceil
745
746using ::ceil;
747using ::ceilf;
748
Howard Hinnant7f764502013-08-14 18:00:20749#if !(defined(_LIBCPP_MSVCRT) || defined(_AIX))
Howard Hinnantcac0c462012-07-06 19:13:50750inline _LIBCPP_INLINE_VISIBILITY float ceil(float __x) _NOEXCEPT {return ceilf(__x);}
751inline _LIBCPP_INLINE_VISIBILITY long double ceil(long double __x) _NOEXCEPT {return ceill(__x);}
Howard Hinnant9f8884e2011-10-27 16:24:42752#endif
Howard Hinnantbc8d3f92010-05-11 19:42:16753
754template <class _A1>
Howard Hinnant422a53f2010-09-21 21:28:23755inline _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16756typename enable_if<is_integral<_A1>::value, double>::type
Howard Hinnantcac0c462012-07-06 19:13:50757ceil(_A1 __x) _NOEXCEPT {return ceil((double)__x);}
Howard Hinnantbc8d3f92010-05-11 19:42:16758
759// cos
760
761using ::cos;
762using ::cosf;
763
Howard Hinnant7f764502013-08-14 18:00:20764#if !(defined(_LIBCPP_MSVCRT) || defined(_AIX))
Howard Hinnantcac0c462012-07-06 19:13:50765inline _LIBCPP_INLINE_VISIBILITY float cos(float __x) _NOEXCEPT {return cosf(__x);}
766inline _LIBCPP_INLINE_VISIBILITY long double cos(long double __x) _NOEXCEPT {return cosl(__x);}
Howard Hinnant9f8884e2011-10-27 16:24:42767#endif
Howard Hinnantbc8d3f92010-05-11 19:42:16768
769template <class _A1>
Howard Hinnant161a9bf2013-08-29 23:50:48770inline _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16771typename enable_if<is_integral<_A1>::value, double>::type
Howard Hinnantcac0c462012-07-06 19:13:50772cos(_A1 __x) _NOEXCEPT {return cos((double)__x);}
Howard Hinnantbc8d3f92010-05-11 19:42:16773
774// cosh
775
776using ::cosh;
777using ::coshf;
778
Howard Hinnant7f764502013-08-14 18:00:20779#if !(defined(_LIBCPP_MSVCRT) || defined(_AIX))
Howard Hinnantcac0c462012-07-06 19:13:50780inline _LIBCPP_INLINE_VISIBILITY float cosh(float __x) _NOEXCEPT {return coshf(__x);}
781inline _LIBCPP_INLINE_VISIBILITY long double cosh(long double __x) _NOEXCEPT {return coshl(__x);}
Howard Hinnant9f8884e2011-10-27 16:24:42782#endif
Howard Hinnantbc8d3f92010-05-11 19:42:16783
784template <class _A1>
Howard Hinnant422a53f2010-09-21 21:28:23785inline _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16786typename enable_if<is_integral<_A1>::value, double>::type
Howard Hinnantcac0c462012-07-06 19:13:50787cosh(_A1 __x) _NOEXCEPT {return cosh((double)__x);}
Howard Hinnantbc8d3f92010-05-11 19:42:16788
David Chisnall997e4542012-02-29 13:05:08789#endif // __sun__
Howard Hinnantbc8d3f92010-05-11 19:42:16790// exp
791
792using ::exp;
793using ::expf;
794
David Chisnall997e4542012-02-29 13:05:08795#ifndef __sun__
796
Howard Hinnant7f764502013-08-14 18:00:20797#if !(defined(_LIBCPP_MSVCRT) || defined(_AIX))
Howard Hinnantcac0c462012-07-06 19:13:50798inline _LIBCPP_INLINE_VISIBILITY float exp(float __x) _NOEXCEPT {return expf(__x);}
799inline _LIBCPP_INLINE_VISIBILITY long double exp(long double __x) _NOEXCEPT {return expl(__x);}
Howard Hinnant9f8884e2011-10-27 16:24:42800#endif
Howard Hinnantbc8d3f92010-05-11 19:42:16801
David Chisnall997e4542012-02-29 13:05:08802
Howard Hinnantbc8d3f92010-05-11 19:42:16803template <class _A1>
Howard Hinnant422a53f2010-09-21 21:28:23804inline _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16805typename enable_if<is_integral<_A1>::value, double>::type
Howard Hinnantcac0c462012-07-06 19:13:50806exp(_A1 __x) _NOEXCEPT {return exp((double)__x);}
Howard Hinnantbc8d3f92010-05-11 19:42:16807
808// fabs
809
810using ::fabs;
811using ::fabsf;
812
Howard Hinnant7f764502013-08-14 18:00:20813#if !(defined(_LIBCPP_MSVCRT) || defined(_AIX))
Howard Hinnantcac0c462012-07-06 19:13:50814inline _LIBCPP_INLINE_VISIBILITY float fabs(float __x) _NOEXCEPT {return fabsf(__x);}
815inline _LIBCPP_INLINE_VISIBILITY long double fabs(long double __x) _NOEXCEPT {return fabsl(__x);}
Howard Hinnant9f8884e2011-10-27 16:24:42816#endif
Howard Hinnantbc8d3f92010-05-11 19:42:16817
818template <class _A1>
Howard Hinnant422a53f2010-09-21 21:28:23819inline _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16820typename enable_if<is_integral<_A1>::value, double>::type
Howard Hinnantcac0c462012-07-06 19:13:50821fabs(_A1 __x) _NOEXCEPT {return fabs((double)__x);}
Howard Hinnantbc8d3f92010-05-11 19:42:16822
823// floor
824
825using ::floor;
826using ::floorf;
827
Howard Hinnant7f764502013-08-14 18:00:20828#if !(defined(_LIBCPP_MSVCRT) || defined(_AIX))
Howard Hinnantcac0c462012-07-06 19:13:50829inline _LIBCPP_INLINE_VISIBILITY float floor(float __x) _NOEXCEPT {return floorf(__x);}
830inline _LIBCPP_INLINE_VISIBILITY long double floor(long double __x) _NOEXCEPT {return floorl(__x);}
Howard Hinnant9f8884e2011-10-27 16:24:42831#endif
Howard Hinnantbc8d3f92010-05-11 19:42:16832
833template <class _A1>
Howard Hinnant422a53f2010-09-21 21:28:23834inline _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16835typename enable_if<is_integral<_A1>::value, double>::type
Howard Hinnantcac0c462012-07-06 19:13:50836floor(_A1 __x) _NOEXCEPT {return floor((double)__x);}
Howard Hinnantbc8d3f92010-05-11 19:42:16837
838// fmod
839
David Chisnall997e4542012-02-29 13:05:08840#endif //__sun__
Howard Hinnantbc8d3f92010-05-11 19:42:16841using ::fmod;
842using ::fmodf;
David Chisnall997e4542012-02-29 13:05:08843#ifndef __sun__
Howard Hinnantbc8d3f92010-05-11 19:42:16844
Howard Hinnant7f764502013-08-14 18:00:20845#if !(defined(_LIBCPP_MSVCRT) || defined(_AIX))
Howard Hinnantcac0c462012-07-06 19:13:50846inline _LIBCPP_INLINE_VISIBILITY float fmod(float __x, float __y) _NOEXCEPT {return fmodf(__x, __y);}
847inline _LIBCPP_INLINE_VISIBILITY long double fmod(long double __x, long double __y) _NOEXCEPT {return fmodl(__x, __y);}
Howard Hinnant9f8884e2011-10-27 16:24:42848#endif
Howard Hinnantbc8d3f92010-05-11 19:42:16849
850template <class _A1, class _A2>
Howard Hinnant422a53f2010-09-21 21:28:23851inline _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16852typename enable_if
853<
854 is_arithmetic<_A1>::value &&
855 is_arithmetic<_A2>::value,
856 typename __promote<_A1, _A2>::type
857>::type
Howard Hinnantcac0c462012-07-06 19:13:50858fmod(_A1 __x, _A2 __y) _NOEXCEPT
Howard Hinnantbc8d3f92010-05-11 19:42:16859{
860 typedef typename __promote<_A1, _A2>::type __result_type;
861 static_assert((!(is_same<_A1, __result_type>::value &&
862 is_same<_A2, __result_type>::value)), "");
863 return fmod((__result_type)__x, (__result_type)__y);
864}
865
David Chisnall997e4542012-02-29 13:05:08866
Howard Hinnantbc8d3f92010-05-11 19:42:16867// frexp
868
869using ::frexp;
870using ::frexpf;
871
Howard Hinnant7f764502013-08-14 18:00:20872#if !(defined(_LIBCPP_MSVCRT) || defined(_AIX))
Howard Hinnantcac0c462012-07-06 19:13:50873inline _LIBCPP_INLINE_VISIBILITY float frexp(float __x, int* __e) _NOEXCEPT {return frexpf(__x, __e);}
874inline _LIBCPP_INLINE_VISIBILITY long double frexp(long double __x, int* __e) _NOEXCEPT {return frexpl(__x, __e);}
Howard Hinnant9f8884e2011-10-27 16:24:42875#endif
Howard Hinnantbc8d3f92010-05-11 19:42:16876
877template <class _A1>
Howard Hinnant422a53f2010-09-21 21:28:23878inline _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16879typename enable_if<is_integral<_A1>::value, double>::type
Howard Hinnantcac0c462012-07-06 19:13:50880frexp(_A1 __x, int* __e) _NOEXCEPT {return frexp((double)__x, __e);}
Howard Hinnantbc8d3f92010-05-11 19:42:16881
882// ldexp
883
884using ::ldexp;
885using ::ldexpf;
886
Howard Hinnant7f764502013-08-14 18:00:20887#if !(defined(_LIBCPP_MSVCRT) || defined(_AIX))
Howard Hinnantcac0c462012-07-06 19:13:50888inline _LIBCPP_INLINE_VISIBILITY float ldexp(float __x, int __e) _NOEXCEPT {return ldexpf(__x, __e);}
889inline _LIBCPP_INLINE_VISIBILITY long double ldexp(long double __x, int __e) _NOEXCEPT {return ldexpl(__x, __e);}
Howard Hinnant9f8884e2011-10-27 16:24:42890#endif
Howard Hinnantbc8d3f92010-05-11 19:42:16891
892template <class _A1>
Howard Hinnant422a53f2010-09-21 21:28:23893inline _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16894typename enable_if<is_integral<_A1>::value, double>::type
Howard Hinnantcac0c462012-07-06 19:13:50895ldexp(_A1 __x, int __e) _NOEXCEPT {return ldexp((double)__x, __e);}
Howard Hinnantbc8d3f92010-05-11 19:42:16896
897// log
898
David Chisnall997e4542012-02-29 13:05:08899#endif // __sun__
Howard Hinnantbc8d3f92010-05-11 19:42:16900using ::log;
901using ::logf;
David Chisnall997e4542012-02-29 13:05:08902#ifndef __sun__
Howard Hinnantbc8d3f92010-05-11 19:42:16903
Howard Hinnant7f764502013-08-14 18:00:20904#if !(defined(_LIBCPP_MSVCRT) || defined(_AIX))
Howard Hinnantcac0c462012-07-06 19:13:50905inline _LIBCPP_INLINE_VISIBILITY float log(float __x) _NOEXCEPT {return logf(__x);}
906inline _LIBCPP_INLINE_VISIBILITY long double log(long double __x) _NOEXCEPT {return logl(__x);}
Howard Hinnant9f8884e2011-10-27 16:24:42907#endif
Howard Hinnantbc8d3f92010-05-11 19:42:16908
909template <class _A1>
Howard Hinnant422a53f2010-09-21 21:28:23910inline _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16911typename enable_if<is_integral<_A1>::value, double>::type
Howard Hinnantcac0c462012-07-06 19:13:50912log(_A1 __x) _NOEXCEPT {return log((double)__x);}
Howard Hinnantbc8d3f92010-05-11 19:42:16913
David Chisnall997e4542012-02-29 13:05:08914
Howard Hinnantbc8d3f92010-05-11 19:42:16915// log10
916
917using ::log10;
918using ::log10f;
919
Howard Hinnant7f764502013-08-14 18:00:20920#if !(defined(_LIBCPP_MSVCRT) || defined(_AIX))
Howard Hinnantcac0c462012-07-06 19:13:50921inline _LIBCPP_INLINE_VISIBILITY float log10(float __x) _NOEXCEPT {return log10f(__x);}
922inline _LIBCPP_INLINE_VISIBILITY long double log10(long double __x) _NOEXCEPT {return log10l(__x);}
Howard Hinnant9f8884e2011-10-27 16:24:42923#endif
Howard Hinnantbc8d3f92010-05-11 19:42:16924
925template <class _A1>
Howard Hinnant422a53f2010-09-21 21:28:23926inline _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16927typename enable_if<is_integral<_A1>::value, double>::type
Howard Hinnantcac0c462012-07-06 19:13:50928log10(_A1 __x) _NOEXCEPT {return log10((double)__x);}
Howard Hinnantbc8d3f92010-05-11 19:42:16929
930// modf
931
932using ::modf;
933using ::modff;
934
Howard Hinnant7f764502013-08-14 18:00:20935#if !(defined(_LIBCPP_MSVCRT) || defined(_AIX))
Howard Hinnantcac0c462012-07-06 19:13:50936inline _LIBCPP_INLINE_VISIBILITY float modf(float __x, float* __y) _NOEXCEPT {return modff(__x, __y);}
937inline _LIBCPP_INLINE_VISIBILITY long double modf(long double __x, long double* __y) _NOEXCEPT {return modfl(__x, __y);}
Howard Hinnant9f8884e2011-10-27 16:24:42938#endif
Howard Hinnantbc8d3f92010-05-11 19:42:16939
940// pow
941
David Chisnall997e4542012-02-29 13:05:08942#endif // __sun__
Howard Hinnantbc8d3f92010-05-11 19:42:16943using ::pow;
944using ::powf;
945
David Chisnall997e4542012-02-29 13:05:08946#ifndef __sun__
947
Howard Hinnant7f764502013-08-14 18:00:20948#if !(defined(_LIBCPP_MSVCRT) || defined(_AIX))
Howard Hinnantcac0c462012-07-06 19:13:50949inline _LIBCPP_INLINE_VISIBILITY float pow(float __x, float __y) _NOEXCEPT {return powf(__x, __y);}
950inline _LIBCPP_INLINE_VISIBILITY long double pow(long double __x, long double __y) _NOEXCEPT {return powl(__x, __y);}
Howard Hinnant9f8884e2011-10-27 16:24:42951#endif
Howard Hinnantbc8d3f92010-05-11 19:42:16952
953template <class _A1, class _A2>
Howard Hinnant422a53f2010-09-21 21:28:23954inline _LIBCPP_INLINE_VISIBILITY
Marshall Clow908b5d72014-01-06 18:12:50955typename enable_if
956<
957 is_arithmetic<_A1>::value &&
958 is_arithmetic<_A2>::value,
959 typename __promote<_A1, _A2>::type
960>::type
961pow(_A1 __x, _A2 __y) _NOEXCEPT
Howard Hinnantbc8d3f92010-05-11 19:42:16962{
Marshall Clow908b5d72014-01-06 18:12:50963 typedef typename __promote<_A1, _A2>::type __result_type;
964 static_assert((!(is_same<_A1, __result_type>::value &&
965 is_same<_A2, __result_type>::value)), "");
966 return pow((__result_type)__x, (__result_type)__y);
Howard Hinnantbc8d3f92010-05-11 19:42:16967}
968
969// sin
970
971using ::sin;
972using ::sinf;
973
Howard Hinnant7f764502013-08-14 18:00:20974#if !(defined(_LIBCPP_MSVCRT) || defined(_AIX))
Howard Hinnantcac0c462012-07-06 19:13:50975inline _LIBCPP_INLINE_VISIBILITY float sin(float __x) _NOEXCEPT {return sinf(__x);}
976inline _LIBCPP_INLINE_VISIBILITY long double sin(long double __x) _NOEXCEPT {return sinl(__x);}
Howard Hinnant9f8884e2011-10-27 16:24:42977#endif
Howard Hinnantbc8d3f92010-05-11 19:42:16978
979template <class _A1>
Howard Hinnant422a53f2010-09-21 21:28:23980inline _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16981typename enable_if<is_integral<_A1>::value, double>::type
Howard Hinnantcac0c462012-07-06 19:13:50982sin(_A1 __x) _NOEXCEPT {return sin((double)__x);}
Howard Hinnantbc8d3f92010-05-11 19:42:16983
984// sinh
985
986using ::sinh;
987using ::sinhf;
988
Howard Hinnant7f764502013-08-14 18:00:20989#if !(defined(_LIBCPP_MSVCRT) || defined(_AIX))
Howard Hinnantcac0c462012-07-06 19:13:50990inline _LIBCPP_INLINE_VISIBILITY float sinh(float __x) _NOEXCEPT {return sinhf(__x);}
991inline _LIBCPP_INLINE_VISIBILITY long double sinh(long double __x) _NOEXCEPT {return sinhl(__x);}
Howard Hinnant9f8884e2011-10-27 16:24:42992#endif
Howard Hinnantbc8d3f92010-05-11 19:42:16993
994template <class _A1>
Howard Hinnant422a53f2010-09-21 21:28:23995inline _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16996typename enable_if<is_integral<_A1>::value, double>::type
Howard Hinnantcac0c462012-07-06 19:13:50997sinh(_A1 __x) _NOEXCEPT {return sinh((double)__x);}
Howard Hinnantbc8d3f92010-05-11 19:42:16998
999// sqrt
1000
David Chisnall997e4542012-02-29 13:05:081001#endif // __sun__
Howard Hinnantbc8d3f92010-05-11 19:42:161002using ::sqrt;
1003using ::sqrtf;
1004
David Chisnall997e4542012-02-29 13:05:081005
Howard Hinnant7f764502013-08-14 18:00:201006#if !(defined(_LIBCPP_MSVCRT) || defined(__sun__) || defined(_AIX))
Howard Hinnantcac0c462012-07-06 19:13:501007inline _LIBCPP_INLINE_VISIBILITY float sqrt(float __x) _NOEXCEPT {return sqrtf(__x);}
1008inline _LIBCPP_INLINE_VISIBILITY long double sqrt(long double __x) _NOEXCEPT {return sqrtl(__x);}
Howard Hinnant9f8884e2011-10-27 16:24:421009#endif
Howard Hinnantbc8d3f92010-05-11 19:42:161010
1011template <class _A1>
Howard Hinnant422a53f2010-09-21 21:28:231012inline _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:161013typename enable_if<is_integral<_A1>::value, double>::type
Howard Hinnantcac0c462012-07-06 19:13:501014sqrt(_A1 __x) _NOEXCEPT {return sqrt((double)__x);}
Howard Hinnantbc8d3f92010-05-11 19:42:161015
1016// tan
1017
1018using ::tan;
1019using ::tanf;
David Chisnall997e4542012-02-29 13:05:081020#ifndef __sun__
Howard Hinnantbc8d3f92010-05-11 19:42:161021
Howard Hinnant7f764502013-08-14 18:00:201022#if !(defined(_LIBCPP_MSVCRT) || defined(_AIX))
Howard Hinnantcac0c462012-07-06 19:13:501023inline _LIBCPP_INLINE_VISIBILITY float tan(float __x) _NOEXCEPT {return tanf(__x);}
1024inline _LIBCPP_INLINE_VISIBILITY long double tan(long double __x) _NOEXCEPT {return tanl(__x);}
Howard Hinnant9f8884e2011-10-27 16:24:421025#endif
Howard Hinnantbc8d3f92010-05-11 19:42:161026
1027template <class _A1>
Howard Hinnant422a53f2010-09-21 21:28:231028inline _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:161029typename enable_if<is_integral<_A1>::value, double>::type
Howard Hinnantcac0c462012-07-06 19:13:501030tan(_A1 __x) _NOEXCEPT {return tan((double)__x);}
Howard Hinnantbc8d3f92010-05-11 19:42:161031
1032// tanh
1033
1034using ::tanh;
1035using ::tanhf;
1036
Howard Hinnant7f764502013-08-14 18:00:201037#if !(defined(_LIBCPP_MSVCRT) || defined(_AIX))
Howard Hinnantcac0c462012-07-06 19:13:501038inline _LIBCPP_INLINE_VISIBILITY float tanh(float __x) _NOEXCEPT {return tanhf(__x);}
1039inline _LIBCPP_INLINE_VISIBILITY long double tanh(long double __x) _NOEXCEPT {return tanhl(__x);}
Howard Hinnant9f8884e2011-10-27 16:24:421040#endif
Howard Hinnantbc8d3f92010-05-11 19:42:161041
1042template <class _A1>
Howard Hinnant422a53f2010-09-21 21:28:231043inline _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:161044typename enable_if<is_integral<_A1>::value, double>::type
Howard Hinnantcac0c462012-07-06 19:13:501045tanh(_A1 __x) _NOEXCEPT {return tanh((double)__x);}
Howard Hinnantbc8d3f92010-05-11 19:42:161046
Howard Hinnantbc8d3f92010-05-11 19:42:161047// acosh
1048
Howard Hinnante9df0a52013-08-01 18:17:341049#ifndef _LIBCPP_MSVCRT
Howard Hinnantbc8d3f92010-05-11 19:42:161050using ::acosh;
1051using ::acoshf;
1052
Howard Hinnantcac0c462012-07-06 19:13:501053inline _LIBCPP_INLINE_VISIBILITY float acosh(float __x) _NOEXCEPT {return acoshf(__x);}
1054inline _LIBCPP_INLINE_VISIBILITY long double acosh(long double __x) _NOEXCEPT {return acoshl(__x);}
Howard Hinnantbc8d3f92010-05-11 19:42:161055
1056template <class _A1>
Howard Hinnant422a53f2010-09-21 21:28:231057inline _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:161058typename enable_if<is_integral<_A1>::value, double>::type
Howard Hinnantcac0c462012-07-06 19:13:501059acosh(_A1 __x) _NOEXCEPT {return acosh((double)__x);}
Howard Hinnant9f8884e2011-10-27 16:24:421060#endif
Howard Hinnantbc8d3f92010-05-11 19:42:161061
1062// asinh
1063
Howard Hinnante9df0a52013-08-01 18:17:341064#ifndef _LIBCPP_MSVCRT
Howard Hinnantbc8d3f92010-05-11 19:42:161065using ::asinh;
1066using ::asinhf;
1067
Howard Hinnantcac0c462012-07-06 19:13:501068inline _LIBCPP_INLINE_VISIBILITY float asinh(float __x) _NOEXCEPT {return asinhf(__x);}
1069inline _LIBCPP_INLINE_VISIBILITY long double asinh(long double __x) _NOEXCEPT {return asinhl(__x);}
Howard Hinnantbc8d3f92010-05-11 19:42:161070
1071template <class _A1>
Howard Hinnant422a53f2010-09-21 21:28:231072inline _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:161073typename enable_if<is_integral<_A1>::value, double>::type
Howard Hinnantcac0c462012-07-06 19:13:501074asinh(_A1 __x) _NOEXCEPT {return asinh((double)__x);}
Howard Hinnant9f8884e2011-10-27 16:24:421075#endif
Howard Hinnantbc8d3f92010-05-11 19:42:161076
1077// atanh
1078
Howard Hinnante9df0a52013-08-01 18:17:341079#ifndef _LIBCPP_MSVCRT
Howard Hinnantbc8d3f92010-05-11 19:42:161080using ::atanh;
1081using ::atanhf;
1082
Howard Hinnantcac0c462012-07-06 19:13:501083inline _LIBCPP_INLINE_VISIBILITY float atanh(float __x) _NOEXCEPT {return atanhf(__x);}
1084inline _LIBCPP_INLINE_VISIBILITY long double atanh(long double __x) _NOEXCEPT {return atanhl(__x);}
Howard Hinnantbc8d3f92010-05-11 19:42:161085
1086template <class _A1>
Howard Hinnant422a53f2010-09-21 21:28:231087inline _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:161088typename enable_if<is_integral<_A1>::value, double>::type
Howard Hinnantcac0c462012-07-06 19:13:501089atanh(_A1 __x) _NOEXCEPT {return atanh((double)__x);}
Howard Hinnant9f8884e2011-10-27 16:24:421090#endif
Howard Hinnantbc8d3f92010-05-11 19:42:161091
1092// cbrt
1093
Howard Hinnante9df0a52013-08-01 18:17:341094#ifndef _LIBCPP_MSVCRT
Howard Hinnantbc8d3f92010-05-11 19:42:161095using ::cbrt;
1096using ::cbrtf;
1097
Howard Hinnantcac0c462012-07-06 19:13:501098inline _LIBCPP_INLINE_VISIBILITY float cbrt(float __x) _NOEXCEPT {return cbrtf(__x);}
1099inline _LIBCPP_INLINE_VISIBILITY long double cbrt(long double __x) _NOEXCEPT {return cbrtl(__x);}
Howard Hinnantbc8d3f92010-05-11 19:42:161100
1101template <class _A1>
Howard Hinnant422a53f2010-09-21 21:28:231102inline _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:161103typename enable_if<is_integral<_A1>::value, double>::type
Howard Hinnantcac0c462012-07-06 19:13:501104cbrt(_A1 __x) _NOEXCEPT {return cbrt((double)__x);}
Howard Hinnant9f8884e2011-10-27 16:24:421105#endif
Howard Hinnantbc8d3f92010-05-11 19:42:161106
1107// copysign
1108
1109using ::copysign;
1110using ::copysignf;
1111
Howard Hinnantcac0c462012-07-06 19:13:501112inline _LIBCPP_INLINE_VISIBILITY float copysign(float __x, float __y) _NOEXCEPT {return copysignf(__x, __y);}
1113inline _LIBCPP_INLINE_VISIBILITY long double copysign(long double __x, long double __y) _NOEXCEPT {return copysignl(__x, __y);}
Howard Hinnantbc8d3f92010-05-11 19:42:161114
1115template <class _A1, class _A2>
Howard Hinnant422a53f2010-09-21 21:28:231116inline _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:161117typename enable_if
1118<
1119 is_arithmetic<_A1>::value &&
1120 is_arithmetic<_A2>::value,
1121 typename __promote<_A1, _A2>::type
1122>::type
Howard Hinnantcac0c462012-07-06 19:13:501123copysign(_A1 __x, _A2 __y) _NOEXCEPT
Howard Hinnantbc8d3f92010-05-11 19:42:161124{
1125 typedef typename __promote<_A1, _A2>::type __result_type;
1126 static_assert((!(is_same<_A1, __result_type>::value &&
1127 is_same<_A2, __result_type>::value)), "");
1128 return copysign((__result_type)__x, (__result_type)__y);
1129}
1130
Howard Hinnante9df0a52013-08-01 18:17:341131#ifndef _LIBCPP_MSVCRT
Howard Hinnant9f8884e2011-10-27 16:24:421132
Howard Hinnantbc8d3f92010-05-11 19:42:161133// erf
1134
1135using ::erf;
1136using ::erff;
1137
Howard Hinnantcac0c462012-07-06 19:13:501138inline _LIBCPP_INLINE_VISIBILITY float erf(float __x) _NOEXCEPT {return erff(__x);}
1139inline _LIBCPP_INLINE_VISIBILITY long double erf(long double __x) _NOEXCEPT {return erfl(__x);}
Howard Hinnantbc8d3f92010-05-11 19:42:161140
1141template <class _A1>
Howard Hinnant422a53f2010-09-21 21:28:231142inline _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:161143typename enable_if<is_integral<_A1>::value, double>::type
Howard Hinnantcac0c462012-07-06 19:13:501144erf(_A1 __x) _NOEXCEPT {return erf((double)__x);}
Howard Hinnantbc8d3f92010-05-11 19:42:161145
1146// erfc
1147
1148using ::erfc;
1149using ::erfcf;
1150
Howard Hinnantcac0c462012-07-06 19:13:501151inline _LIBCPP_INLINE_VISIBILITY float erfc(float __x) _NOEXCEPT {return erfcf(__x);}
1152inline _LIBCPP_INLINE_VISIBILITY long double erfc(long double __x) _NOEXCEPT {return erfcl(__x);}
Howard Hinnantbc8d3f92010-05-11 19:42:161153
1154template <class _A1>
Howard Hinnant422a53f2010-09-21 21:28:231155inline _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:161156typename enable_if<is_integral<_A1>::value, double>::type
Howard Hinnantcac0c462012-07-06 19:13:501157erfc(_A1 __x) _NOEXCEPT {return erfc((double)__x);}
Howard Hinnantbc8d3f92010-05-11 19:42:161158
1159// exp2
1160
1161using ::exp2;
1162using ::exp2f;
1163
Howard Hinnantcac0c462012-07-06 19:13:501164inline _LIBCPP_INLINE_VISIBILITY float exp2(float __x) _NOEXCEPT {return exp2f(__x);}
1165inline _LIBCPP_INLINE_VISIBILITY long double exp2(long double __x) _NOEXCEPT {return exp2l(__x);}
Howard Hinnantbc8d3f92010-05-11 19:42:161166
1167template <class _A1>
Howard Hinnant422a53f2010-09-21 21:28:231168inline _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:161169typename enable_if<is_integral<_A1>::value, double>::type
Howard Hinnantcac0c462012-07-06 19:13:501170exp2(_A1 __x) _NOEXCEPT {return exp2((double)__x);}
Howard Hinnantbc8d3f92010-05-11 19:42:161171
1172// expm1
1173
1174using ::expm1;
1175using ::expm1f;
1176
Howard Hinnantcac0c462012-07-06 19:13:501177inline _LIBCPP_INLINE_VISIBILITY float expm1(float __x) _NOEXCEPT {return expm1f(__x);}
1178inline _LIBCPP_INLINE_VISIBILITY long double expm1(long double __x) _NOEXCEPT {return expm1l(__x);}
Howard Hinnantbc8d3f92010-05-11 19:42:161179
1180template <class _A1>
Howard Hinnant422a53f2010-09-21 21:28:231181inline _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:161182typename enable_if<is_integral<_A1>::value, double>::type
Howard Hinnantcac0c462012-07-06 19:13:501183expm1(_A1 __x) _NOEXCEPT {return expm1((double)__x);}
Howard Hinnantbc8d3f92010-05-11 19:42:161184
1185// fdim
1186
1187using ::fdim;
1188using ::fdimf;
1189
Howard Hinnantcac0c462012-07-06 19:13:501190inline _LIBCPP_INLINE_VISIBILITY float fdim(float __x, float __y) _NOEXCEPT {return fdimf(__x, __y);}
1191inline _LIBCPP_INLINE_VISIBILITY long double fdim(long double __x, long double __y) _NOEXCEPT {return fdiml(__x, __y);}
Howard Hinnantbc8d3f92010-05-11 19:42:161192
1193template <class _A1, class _A2>
Howard Hinnant422a53f2010-09-21 21:28:231194inline _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:161195typename enable_if
1196<
1197 is_arithmetic<_A1>::value &&
1198 is_arithmetic<_A2>::value,
1199 typename __promote<_A1, _A2>::type
1200>::type
Howard Hinnantcac0c462012-07-06 19:13:501201fdim(_A1 __x, _A2 __y) _NOEXCEPT
Howard Hinnantbc8d3f92010-05-11 19:42:161202{
1203 typedef typename __promote<_A1, _A2>::type __result_type;
1204 static_assert((!(is_same<_A1, __result_type>::value &&
1205 is_same<_A2, __result_type>::value)), "");
1206 return fdim((__result_type)__x, (__result_type)__y);
1207}
1208
1209// fma
1210
Marshall Clow0d6dcb52014-03-05 17:09:511211using ::fmaf;
Howard Hinnantbc8d3f92010-05-11 19:42:161212using ::fma;
Howard Hinnantbc8d3f92010-05-11 19:42:161213
Howard Hinnantcac0c462012-07-06 19:13:501214inline _LIBCPP_INLINE_VISIBILITY float fma(float __x, float __y, float __z) _NOEXCEPT {return fmaf(__x, __y, __z);}
1215inline _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:161216
1217template <class _A1, class _A2, class _A3>
Howard Hinnant422a53f2010-09-21 21:28:231218inline _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:161219typename enable_if
1220<
1221 is_arithmetic<_A1>::value &&
1222 is_arithmetic<_A2>::value &&
1223 is_arithmetic<_A3>::value,
1224 typename __promote<_A1, _A2, _A3>::type
1225>::type
Howard Hinnantcac0c462012-07-06 19:13:501226fma(_A1 __x, _A2 __y, _A3 __z) _NOEXCEPT
Howard Hinnantbc8d3f92010-05-11 19:42:161227{
1228 typedef typename __promote<_A1, _A2, _A3>::type __result_type;
1229 static_assert((!(is_same<_A1, __result_type>::value &&
1230 is_same<_A2, __result_type>::value &&
1231 is_same<_A3, __result_type>::value)), "");
1232 return fma((__result_type)__x, (__result_type)__y, (__result_type)__z);
1233}
1234
1235// fmax
1236
1237using ::fmax;
1238using ::fmaxf;
1239
Howard Hinnantcac0c462012-07-06 19:13:501240inline _LIBCPP_INLINE_VISIBILITY float fmax(float __x, float __y) _NOEXCEPT {return fmaxf(__x, __y);}
1241inline _LIBCPP_INLINE_VISIBILITY long double fmax(long double __x, long double __y) _NOEXCEPT {return fmaxl(__x, __y);}
Howard Hinnantbc8d3f92010-05-11 19:42:161242
1243template <class _A1, class _A2>
Howard Hinnant422a53f2010-09-21 21:28:231244inline _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:161245typename enable_if
1246<
1247 is_arithmetic<_A1>::value &&
1248 is_arithmetic<_A2>::value,
1249 typename __promote<_A1, _A2>::type
1250>::type
Howard Hinnantcac0c462012-07-06 19:13:501251fmax(_A1 __x, _A2 __y) _NOEXCEPT
Howard Hinnantbc8d3f92010-05-11 19:42:161252{
1253 typedef typename __promote<_A1, _A2>::type __result_type;
1254 static_assert((!(is_same<_A1, __result_type>::value &&
1255 is_same<_A2, __result_type>::value)), "");
1256 return fmax((__result_type)__x, (__result_type)__y);
1257}
1258
1259// fmin
1260
1261using ::fmin;
1262using ::fminf;
1263
Howard Hinnantcac0c462012-07-06 19:13:501264inline _LIBCPP_INLINE_VISIBILITY float fmin(float __x, float __y) _NOEXCEPT {return fminf(__x, __y);}
1265inline _LIBCPP_INLINE_VISIBILITY long double fmin(long double __x, long double __y) _NOEXCEPT {return fminl(__x, __y);}
Howard Hinnantbc8d3f92010-05-11 19:42:161266
1267template <class _A1, class _A2>
Howard Hinnant422a53f2010-09-21 21:28:231268inline _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:161269typename enable_if
1270<
1271 is_arithmetic<_A1>::value &&
1272 is_arithmetic<_A2>::value,
1273 typename __promote<_A1, _A2>::type
1274>::type
Howard Hinnantcac0c462012-07-06 19:13:501275fmin(_A1 __x, _A2 __y) _NOEXCEPT
Howard Hinnantbc8d3f92010-05-11 19:42:161276{
1277 typedef typename __promote<_A1, _A2>::type __result_type;
1278 static_assert((!(is_same<_A1, __result_type>::value &&
1279 is_same<_A2, __result_type>::value)), "");
1280 return fmin((__result_type)__x, (__result_type)__y);
1281}
1282
1283// hypot
1284
1285using ::hypot;
1286using ::hypotf;
1287
Howard Hinnantcac0c462012-07-06 19:13:501288inline _LIBCPP_INLINE_VISIBILITY float hypot(float __x, float __y) _NOEXCEPT {return hypotf(__x, __y);}
1289inline _LIBCPP_INLINE_VISIBILITY long double hypot(long double __x, long double __y) _NOEXCEPT {return hypotl(__x, __y);}
Howard Hinnantbc8d3f92010-05-11 19:42:161290
1291template <class _A1, class _A2>
Howard Hinnant422a53f2010-09-21 21:28:231292inline _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:161293typename enable_if
1294<
1295 is_arithmetic<_A1>::value &&
1296 is_arithmetic<_A2>::value,
1297 typename __promote<_A1, _A2>::type
1298>::type
Howard Hinnantcac0c462012-07-06 19:13:501299hypot(_A1 __x, _A2 __y) _NOEXCEPT
Howard Hinnantbc8d3f92010-05-11 19:42:161300{
1301 typedef typename __promote<_A1, _A2>::type __result_type;
1302 static_assert((!(is_same<_A1, __result_type>::value &&
1303 is_same<_A2, __result_type>::value)), "");
1304 return hypot((__result_type)__x, (__result_type)__y);
1305}
1306
1307// ilogb
1308
1309using ::ilogb;
1310using ::ilogbf;
1311
Howard Hinnantcac0c462012-07-06 19:13:501312inline _LIBCPP_INLINE_VISIBILITY int ilogb(float __x) _NOEXCEPT {return ilogbf(__x);}
1313inline _LIBCPP_INLINE_VISIBILITY int ilogb(long double __x) _NOEXCEPT {return ilogbl(__x);}
Howard Hinnantbc8d3f92010-05-11 19:42:161314
1315template <class _A1>
Howard Hinnant422a53f2010-09-21 21:28:231316inline _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:161317typename enable_if<is_integral<_A1>::value, int>::type
Howard Hinnantcac0c462012-07-06 19:13:501318ilogb(_A1 __x) _NOEXCEPT {return ilogb((double)__x);}
Howard Hinnantbc8d3f92010-05-11 19:42:161319
1320// lgamma
1321
1322using ::lgamma;
1323using ::lgammaf;
1324
Howard Hinnantcac0c462012-07-06 19:13:501325inline _LIBCPP_INLINE_VISIBILITY float lgamma(float __x) _NOEXCEPT {return lgammaf(__x);}
1326inline _LIBCPP_INLINE_VISIBILITY long double lgamma(long double __x) _NOEXCEPT {return lgammal(__x);}
Howard Hinnantbc8d3f92010-05-11 19:42:161327
David Chisnall997e4542012-02-29 13:05:081328
Howard Hinnantbc8d3f92010-05-11 19:42:161329template <class _A1>
Howard Hinnant422a53f2010-09-21 21:28:231330inline _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:161331typename enable_if<is_integral<_A1>::value, double>::type
Howard Hinnantcac0c462012-07-06 19:13:501332lgamma(_A1 __x) _NOEXCEPT {return lgamma((double)__x);}
Howard Hinnantbc8d3f92010-05-11 19:42:161333
David Chisnall997e4542012-02-29 13:05:081334
Howard Hinnantbc8d3f92010-05-11 19:42:161335// llrint
1336
1337using ::llrint;
1338using ::llrintf;
1339
Howard Hinnantcac0c462012-07-06 19:13:501340inline _LIBCPP_INLINE_VISIBILITY long long llrint(float __x) _NOEXCEPT {return llrintf(__x);}
1341inline _LIBCPP_INLINE_VISIBILITY long long llrint(long double __x) _NOEXCEPT {return llrintl(__x);}
Howard Hinnantbc8d3f92010-05-11 19:42:161342
1343template <class _A1>
Howard Hinnant422a53f2010-09-21 21:28:231344inline _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:161345typename enable_if<is_integral<_A1>::value, long long>::type
Howard Hinnantcac0c462012-07-06 19:13:501346llrint(_A1 __x) _NOEXCEPT {return llrint((double)__x);}
Howard Hinnantbc8d3f92010-05-11 19:42:161347
1348// llround
1349
1350using ::llround;
1351using ::llroundf;
1352
Howard Hinnantcac0c462012-07-06 19:13:501353inline _LIBCPP_INLINE_VISIBILITY long long llround(float __x) _NOEXCEPT {return llroundf(__x);}
1354inline _LIBCPP_INLINE_VISIBILITY long long llround(long double __x) _NOEXCEPT {return llroundl(__x);}
Howard Hinnantbc8d3f92010-05-11 19:42:161355
1356template <class _A1>
Howard Hinnant422a53f2010-09-21 21:28:231357inline _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:161358typename enable_if<is_integral<_A1>::value, long long>::type
Howard Hinnantcac0c462012-07-06 19:13:501359llround(_A1 __x) _NOEXCEPT {return llround((double)__x);}
Howard Hinnantbc8d3f92010-05-11 19:42:161360
1361// log1p
1362
1363using ::log1p;
1364using ::log1pf;
1365
Howard Hinnantcac0c462012-07-06 19:13:501366inline _LIBCPP_INLINE_VISIBILITY float log1p(float __x) _NOEXCEPT {return log1pf(__x);}
1367inline _LIBCPP_INLINE_VISIBILITY long double log1p(long double __x) _NOEXCEPT {return log1pl(__x);}
Howard Hinnantbc8d3f92010-05-11 19:42:161368
1369template <class _A1>
Howard Hinnant422a53f2010-09-21 21:28:231370inline _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:161371typename enable_if<is_integral<_A1>::value, double>::type
Howard Hinnantcac0c462012-07-06 19:13:501372log1p(_A1 __x) _NOEXCEPT {return log1p((double)__x);}
Howard Hinnantbc8d3f92010-05-11 19:42:161373
1374// log2
1375
1376using ::log2;
1377using ::log2f;
1378
Howard Hinnantcac0c462012-07-06 19:13:501379inline _LIBCPP_INLINE_VISIBILITY float log2(float __x) _NOEXCEPT {return log2f(__x);}
1380inline _LIBCPP_INLINE_VISIBILITY long double log2(long double __x) _NOEXCEPT {return log2l(__x);}
Howard Hinnantbc8d3f92010-05-11 19:42:161381
1382template <class _A1>
Howard Hinnant422a53f2010-09-21 21:28:231383inline _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:161384typename enable_if<is_integral<_A1>::value, double>::type
Howard Hinnantcac0c462012-07-06 19:13:501385log2(_A1 __x) _NOEXCEPT {return log2((double)__x);}
Howard Hinnantbc8d3f92010-05-11 19:42:161386
1387// logb
1388
1389using ::logb;
1390using ::logbf;
1391
Howard Hinnantcac0c462012-07-06 19:13:501392inline _LIBCPP_INLINE_VISIBILITY float logb(float __x) _NOEXCEPT {return logbf(__x);}
1393inline _LIBCPP_INLINE_VISIBILITY long double logb(long double __x) _NOEXCEPT {return logbl(__x);}
Howard Hinnantbc8d3f92010-05-11 19:42:161394
1395template <class _A1>
Howard Hinnant422a53f2010-09-21 21:28:231396inline _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:161397typename enable_if<is_integral<_A1>::value, double>::type
Howard Hinnantcac0c462012-07-06 19:13:501398logb(_A1 __x) _NOEXCEPT {return logb((double)__x);}
Howard Hinnantbc8d3f92010-05-11 19:42:161399
1400// lrint
1401
1402using ::lrint;
1403using ::lrintf;
1404
Howard Hinnantcac0c462012-07-06 19:13:501405inline _LIBCPP_INLINE_VISIBILITY long lrint(float __x) _NOEXCEPT {return lrintf(__x);}
1406inline _LIBCPP_INLINE_VISIBILITY long lrint(long double __x) _NOEXCEPT {return lrintl(__x);}
Howard Hinnantbc8d3f92010-05-11 19:42:161407
1408template <class _A1>
Howard Hinnant422a53f2010-09-21 21:28:231409inline _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:161410typename enable_if<is_integral<_A1>::value, long>::type
Howard Hinnantcac0c462012-07-06 19:13:501411lrint(_A1 __x) _NOEXCEPT {return lrint((double)__x);}
Howard Hinnantbc8d3f92010-05-11 19:42:161412
1413// lround
1414
1415using ::lround;
1416using ::lroundf;
1417
Howard Hinnantcac0c462012-07-06 19:13:501418inline _LIBCPP_INLINE_VISIBILITY long lround(float __x) _NOEXCEPT {return lroundf(__x);}
1419inline _LIBCPP_INLINE_VISIBILITY long lround(long double __x) _NOEXCEPT {return lroundl(__x);}
Howard Hinnantbc8d3f92010-05-11 19:42:161420
1421template <class _A1>
Howard Hinnant422a53f2010-09-21 21:28:231422inline _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:161423typename enable_if<is_integral<_A1>::value, long>::type
Howard Hinnantcac0c462012-07-06 19:13:501424lround(_A1 __x) _NOEXCEPT {return lround((double)__x);}
Howard Hinnantbc8d3f92010-05-11 19:42:161425
Howard Hinnante9df0a52013-08-01 18:17:341426#endif // _LIBCPP_MSVCRT
David Chisnall997e4542012-02-29 13:05:081427#endif // __sun__
Howard Hinnante9df0a52013-08-01 18:17:341428
1429// nan
1430
1431#ifndef _LIBCPP_MSVCRT
Howard Hinnantbc8d3f92010-05-11 19:42:161432using ::nan;
1433using ::nanf;
Howard Hinnante9df0a52013-08-01 18:17:341434#endif // _LIBCPP_MSVCRT
1435
David Chisnall997e4542012-02-29 13:05:081436#ifndef __sun__
Howard Hinnante9df0a52013-08-01 18:17:341437#ifndef _LIBCPP_MSVCRT
Howard Hinnantbc8d3f92010-05-11 19:42:161438
1439// nearbyint
1440
1441using ::nearbyint;
1442using ::nearbyintf;
1443
Howard Hinnantcac0c462012-07-06 19:13:501444inline _LIBCPP_INLINE_VISIBILITY float nearbyint(float __x) _NOEXCEPT {return nearbyintf(__x);}
1445inline _LIBCPP_INLINE_VISIBILITY long double nearbyint(long double __x) _NOEXCEPT {return nearbyintl(__x);}
Howard Hinnantbc8d3f92010-05-11 19:42:161446
1447template <class _A1>
Howard Hinnant422a53f2010-09-21 21:28:231448inline _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:161449typename enable_if<is_integral<_A1>::value, double>::type
Howard Hinnantcac0c462012-07-06 19:13:501450nearbyint(_A1 __x) _NOEXCEPT {return nearbyint((double)__x);}
Howard Hinnantbc8d3f92010-05-11 19:42:161451
1452// nextafter
1453
1454using ::nextafter;
1455using ::nextafterf;
1456
Howard Hinnantcac0c462012-07-06 19:13:501457inline _LIBCPP_INLINE_VISIBILITY float nextafter(float __x, float __y) _NOEXCEPT {return nextafterf(__x, __y);}
1458inline _LIBCPP_INLINE_VISIBILITY long double nextafter(long double __x, long double __y) _NOEXCEPT {return nextafterl(__x, __y);}
Howard Hinnantbc8d3f92010-05-11 19:42:161459
1460template <class _A1, class _A2>
Howard Hinnant422a53f2010-09-21 21:28:231461inline _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:161462typename enable_if
1463<
1464 is_arithmetic<_A1>::value &&
1465 is_arithmetic<_A2>::value,
1466 typename __promote<_A1, _A2>::type
1467>::type
Howard Hinnantcac0c462012-07-06 19:13:501468nextafter(_A1 __x, _A2 __y) _NOEXCEPT
Howard Hinnantbc8d3f92010-05-11 19:42:161469{
1470 typedef typename __promote<_A1, _A2>::type __result_type;
1471 static_assert((!(is_same<_A1, __result_type>::value &&
1472 is_same<_A2, __result_type>::value)), "");
1473 return nextafter((__result_type)__x, (__result_type)__y);
1474}
1475
1476// nexttoward
1477
1478using ::nexttoward;
1479using ::nexttowardf;
1480
Howard Hinnantcac0c462012-07-06 19:13:501481inline _LIBCPP_INLINE_VISIBILITY float nexttoward(float __x, long double __y) _NOEXCEPT {return nexttowardf(__x, __y);}
1482inline _LIBCPP_INLINE_VISIBILITY long double nexttoward(long double __x, long double __y) _NOEXCEPT {return nexttowardl(__x, __y);}
Howard Hinnantbc8d3f92010-05-11 19:42:161483
1484template <class _A1>
Howard Hinnant422a53f2010-09-21 21:28:231485inline _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:161486typename enable_if<is_integral<_A1>::value, double>::type
Howard Hinnantcac0c462012-07-06 19:13:501487nexttoward(_A1 __x, long double __y) _NOEXCEPT {return nexttoward((double)__x, __y);}
Howard Hinnantbc8d3f92010-05-11 19:42:161488
1489// remainder
1490
1491using ::remainder;
1492using ::remainderf;
1493
Howard Hinnantcac0c462012-07-06 19:13:501494inline _LIBCPP_INLINE_VISIBILITY float remainder(float __x, float __y) _NOEXCEPT {return remainderf(__x, __y);}
1495inline _LIBCPP_INLINE_VISIBILITY long double remainder(long double __x, long double __y) _NOEXCEPT {return remainderl(__x, __y);}
Howard Hinnantbc8d3f92010-05-11 19:42:161496
1497template <class _A1, class _A2>
Howard Hinnant422a53f2010-09-21 21:28:231498inline _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:161499typename enable_if
1500<
1501 is_arithmetic<_A1>::value &&
1502 is_arithmetic<_A2>::value,
1503 typename __promote<_A1, _A2>::type
1504>::type
Howard Hinnantcac0c462012-07-06 19:13:501505remainder(_A1 __x, _A2 __y) _NOEXCEPT
Howard Hinnantbc8d3f92010-05-11 19:42:161506{
1507 typedef typename __promote<_A1, _A2>::type __result_type;
1508 static_assert((!(is_same<_A1, __result_type>::value &&
1509 is_same<_A2, __result_type>::value)), "");
1510 return remainder((__result_type)__x, (__result_type)__y);
1511}
1512
1513// remquo
1514
1515using ::remquo;
1516using ::remquof;
1517
Howard Hinnantcac0c462012-07-06 19:13:501518inline _LIBCPP_INLINE_VISIBILITY float remquo(float __x, float __y, int* __z) _NOEXCEPT {return remquof(__x, __y, __z);}
1519inline _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:161520
1521template <class _A1, class _A2>
Howard Hinnant422a53f2010-09-21 21:28:231522inline _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:161523typename enable_if
1524<
1525 is_arithmetic<_A1>::value &&
1526 is_arithmetic<_A2>::value,
1527 typename __promote<_A1, _A2>::type
1528>::type
Howard Hinnantcac0c462012-07-06 19:13:501529remquo(_A1 __x, _A2 __y, int* __z) _NOEXCEPT
Howard Hinnantbc8d3f92010-05-11 19:42:161530{
1531 typedef typename __promote<_A1, _A2>::type __result_type;
1532 static_assert((!(is_same<_A1, __result_type>::value &&
1533 is_same<_A2, __result_type>::value)), "");
1534 return remquo((__result_type)__x, (__result_type)__y, __z);
1535}
1536
1537// rint
1538
1539using ::rint;
1540using ::rintf;
1541
Howard Hinnantcac0c462012-07-06 19:13:501542inline _LIBCPP_INLINE_VISIBILITY float rint(float __x) _NOEXCEPT {return rintf(__x);}
1543inline _LIBCPP_INLINE_VISIBILITY long double rint(long double __x) _NOEXCEPT {return rintl(__x);}
Howard Hinnantbc8d3f92010-05-11 19:42:161544
1545template <class _A1>
Howard Hinnant422a53f2010-09-21 21:28:231546inline _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:161547typename enable_if<is_integral<_A1>::value, double>::type
Howard Hinnantcac0c462012-07-06 19:13:501548rint(_A1 __x) _NOEXCEPT {return rint((double)__x);}
Howard Hinnantbc8d3f92010-05-11 19:42:161549
1550// round
1551
1552using ::round;
1553using ::roundf;
1554
Howard Hinnantcac0c462012-07-06 19:13:501555inline _LIBCPP_INLINE_VISIBILITY float round(float __x) _NOEXCEPT {return roundf(__x);}
1556inline _LIBCPP_INLINE_VISIBILITY long double round(long double __x) _NOEXCEPT {return roundl(__x);}
Howard Hinnantbc8d3f92010-05-11 19:42:161557
1558template <class _A1>
Howard Hinnant422a53f2010-09-21 21:28:231559inline _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:161560typename enable_if<is_integral<_A1>::value, double>::type
Howard Hinnantcac0c462012-07-06 19:13:501561round(_A1 __x) _NOEXCEPT {return round((double)__x);}
Howard Hinnantbc8d3f92010-05-11 19:42:161562
1563// scalbln
1564
1565using ::scalbln;
1566using ::scalblnf;
1567
Howard Hinnantcac0c462012-07-06 19:13:501568inline _LIBCPP_INLINE_VISIBILITY float scalbln(float __x, long __y) _NOEXCEPT {return scalblnf(__x, __y);}
1569inline _LIBCPP_INLINE_VISIBILITY long double scalbln(long double __x, long __y) _NOEXCEPT {return scalblnl(__x, __y);}
Howard Hinnantbc8d3f92010-05-11 19:42:161570
1571template <class _A1>
Howard Hinnant422a53f2010-09-21 21:28:231572inline _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:161573typename enable_if<is_integral<_A1>::value, double>::type
Howard Hinnantcac0c462012-07-06 19:13:501574scalbln(_A1 __x, long __y) _NOEXCEPT {return scalbln((double)__x, __y);}
Howard Hinnantbc8d3f92010-05-11 19:42:161575
1576// scalbn
1577
1578using ::scalbn;
1579using ::scalbnf;
1580
Howard Hinnantcac0c462012-07-06 19:13:501581inline _LIBCPP_INLINE_VISIBILITY float scalbn(float __x, int __y) _NOEXCEPT {return scalbnf(__x, __y);}
1582inline _LIBCPP_INLINE_VISIBILITY long double scalbn(long double __x, int __y) _NOEXCEPT {return scalbnl(__x, __y);}
Howard Hinnantbc8d3f92010-05-11 19:42:161583
1584template <class _A1>
Howard Hinnant422a53f2010-09-21 21:28:231585inline _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:161586typename enable_if<is_integral<_A1>::value, double>::type
Howard Hinnantcac0c462012-07-06 19:13:501587scalbn(_A1 __x, int __y) _NOEXCEPT {return scalbn((double)__x, __y);}
Howard Hinnantbc8d3f92010-05-11 19:42:161588
1589// tgamma
1590
1591using ::tgamma;
1592using ::tgammaf;
1593
Howard Hinnantcac0c462012-07-06 19:13:501594inline _LIBCPP_INLINE_VISIBILITY float tgamma(float __x) _NOEXCEPT {return tgammaf(__x);}
1595inline _LIBCPP_INLINE_VISIBILITY long double tgamma(long double __x) _NOEXCEPT {return tgammal(__x);}
Howard Hinnantbc8d3f92010-05-11 19:42:161596
1597template <class _A1>
Howard Hinnant422a53f2010-09-21 21:28:231598inline _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:161599typename enable_if<is_integral<_A1>::value, double>::type
Howard Hinnantcac0c462012-07-06 19:13:501600tgamma(_A1 __x) _NOEXCEPT {return tgamma((double)__x);}
Howard Hinnantbc8d3f92010-05-11 19:42:161601
1602// trunc
1603
1604using ::trunc;
1605using ::truncf;
1606
Howard Hinnantcac0c462012-07-06 19:13:501607inline _LIBCPP_INLINE_VISIBILITY float trunc(float __x) _NOEXCEPT {return truncf(__x);}
1608inline _LIBCPP_INLINE_VISIBILITY long double trunc(long double __x) _NOEXCEPT {return truncl(__x);}
Howard Hinnantbc8d3f92010-05-11 19:42:161609
1610template <class _A1>
Howard Hinnant422a53f2010-09-21 21:28:231611inline _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:161612typename enable_if<is_integral<_A1>::value, double>::type
Howard Hinnantcac0c462012-07-06 19:13:501613trunc(_A1 __x) _NOEXCEPT {return trunc((double)__x);}
Howard Hinnantbc8d3f92010-05-11 19:42:161614
Howard Hinnante9df0a52013-08-01 18:17:341615#endif // !_LIBCPP_MSVCRT
Howard Hinnant9f8884e2011-10-27 16:24:421616
Howard Hinnantbc8d3f92010-05-11 19:42:161617using ::acosl;
1618using ::asinl;
1619using ::atanl;
1620using ::atan2l;
1621using ::ceill;
1622using ::cosl;
1623using ::coshl;
1624using ::expl;
1625using ::fabsl;
1626using ::floorl;
1627using ::fmodl;
1628using ::frexpl;
1629using ::ldexpl;
1630using ::logl;
1631using ::log10l;
1632using ::modfl;
1633using ::powl;
1634using ::sinl;
1635using ::sinhl;
1636using ::sqrtl;
1637using ::tanl;
Howard Hinnante9df0a52013-08-01 18:17:341638#ifndef _LIBCPP_MSVCRT
Howard Hinnantbc8d3f92010-05-11 19:42:161639using ::tanhl;
1640using ::acoshl;
1641using ::asinhl;
1642using ::atanhl;
1643using ::cbrtl;
Howard Hinnante9df0a52013-08-01 18:17:341644#endif // !_LIBCPP_MSVCRT
Howard Hinnantbc8d3f92010-05-11 19:42:161645using ::copysignl;
Howard Hinnante9df0a52013-08-01 18:17:341646#ifndef _LIBCPP_MSVCRT
Howard Hinnantbc8d3f92010-05-11 19:42:161647using ::erfl;
1648using ::erfcl;
1649using ::exp2l;
1650using ::expm1l;
1651using ::fdiml;
1652using ::fmal;
1653using ::fmaxl;
1654using ::fminl;
1655using ::hypotl;
1656using ::ilogbl;
1657using ::lgammal;
1658using ::llrintl;
1659using ::llroundl;
1660using ::log1pl;
1661using ::log2l;
1662using ::logbl;
1663using ::lrintl;
1664using ::lroundl;
1665using ::nanl;
1666using ::nearbyintl;
1667using ::nextafterl;
1668using ::nexttowardl;
1669using ::remainderl;
1670using ::remquol;
1671using ::rintl;
1672using ::roundl;
1673using ::scalblnl;
1674using ::scalbnl;
1675using ::tgammal;
1676using ::truncl;
Howard Hinnante9df0a52013-08-01 18:17:341677#endif // !_LIBCPP_MSVCRT
Howard Hinnantbc8d3f92010-05-11 19:42:161678
David Chisnall997e4542012-02-29 13:05:081679#else
1680using ::lgamma;
1681using ::lgammaf;
1682#endif // __sun__
Howard Hinnantbc8d3f92010-05-11 19:42:161683_LIBCPP_END_NAMESPACE_STD
1684
Howard Hinnantbc8d3f92010-05-11 19:42:161685#endif // _LIBCPP_CMATH