blob: 5f9aaedd5afa66e068e266478d2fda12b81f02cb [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
Jonathan Roelofs9dc353c2014-08-27 14:05:20 +0000319__libcpp_signbit(_A1 __lcpp_x) _NOEXCEPT
Howard Hinnant0a111112011-05-13 21:52:40 +0000320{
Jonathan Roelofs9dc353c2014-08-27 14:05:20 +0000321 return signbit(__lcpp_x);
Howard Hinnant0a111112011-05-13 21:52:40 +0000322}
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
Jonathan Roelofs9dc353c2014-08-27 14:05:20 +0000329signbit(_A1 __lcpp_x) _NOEXCEPT
Howard Hinnant0a111112011-05-13 21:52:40 +0000330{
Jonathan Roelofs9dc353c2014-08-27 14:05:20 +0000331 return __libcpp_signbit((typename std::__promote<_A1>::type)__lcpp_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
Jonathan Roelofs9dc353c2014-08-27 14:05:20 +0000343__libcpp_fpclassify(_A1 __lcpp_x) _NOEXCEPT
Howard Hinnant0a111112011-05-13 21:52:40 +0000344{
Jonathan Roelofs9dc353c2014-08-27 14:05:20 +0000345 return fpclassify(__lcpp_x);
Howard Hinnant0a111112011-05-13 21:52:40 +0000346}
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
Jonathan Roelofs9dc353c2014-08-27 14:05:20 +0000353fpclassify(_A1 __lcpp_x) _NOEXCEPT
Howard Hinnant0a111112011-05-13 21:52:40 +0000354{
Jonathan Roelofs9dc353c2014-08-27 14:05:20 +0000355 return __libcpp_fpclassify((typename std::__promote<_A1>::type)__lcpp_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
Jonathan Roelofs9dc353c2014-08-27 14:05:20 +0000367__libcpp_isfinite(_A1 __lcpp_x) _NOEXCEPT
Howard Hinnant0a111112011-05-13 21:52:40 +0000368{
Jonathan Roelofs9dc353c2014-08-27 14:05:20 +0000369 return isfinite(__lcpp_x);
Howard Hinnant0a111112011-05-13 21:52:40 +0000370}
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
Jonathan Roelofs9dc353c2014-08-27 14:05:20 +0000377isfinite(_A1 __lcpp_x) _NOEXCEPT
Howard Hinnant0a111112011-05-13 21:52:40 +0000378{
Jonathan Roelofs9dc353c2014-08-27 14:05:20 +0000379 return __libcpp_isfinite((typename std::__promote<_A1>::type)__lcpp_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
Jonathan Roelofs9dc353c2014-08-27 14:05:20 +0000391__libcpp_isinf(_A1 __lcpp_x) _NOEXCEPT
Howard Hinnant0a111112011-05-13 21:52:40 +0000392{
Jonathan Roelofs9dc353c2014-08-27 14:05:20 +0000393 return isinf(__lcpp_x);
Howard Hinnant0a111112011-05-13 21:52:40 +0000394}
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
Jonathan Roelofs9dc353c2014-08-27 14:05:20 +0000401isinf(_A1 __lcpp_x) _NOEXCEPT
Howard Hinnant0a111112011-05-13 21:52:40 +0000402{
Jonathan Roelofs9dc353c2014-08-27 14:05:20 +0000403 return __libcpp_isinf((typename std::__promote<_A1>::type)__lcpp_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
Jonathan Roelofs9dc353c2014-08-27 14:05:20 +0000415__libcpp_isnan(_A1 __lcpp_x) _NOEXCEPT
Howard Hinnant0a111112011-05-13 21:52:40 +0000416{
Jonathan Roelofs9dc353c2014-08-27 14:05:20 +0000417 return isnan(__lcpp_x);
Howard Hinnant0a111112011-05-13 21:52:40 +0000418}
419
420#undef isnan
421
Marshall Clow908b5d72014-01-06 18:12:50 +0000422template <class _A1>
Howard Hinnant0a111112011-05-13 21:52:40 +0000423inline _LIBCPP_INLINE_VISIBILITY
Marshall Clow908b5d72014-01-06 18:12:50 +0000424typename std::enable_if<std::is_arithmetic<_A1>::value, bool>::type
Jonathan Roelofs9dc353c2014-08-27 14:05:20 +0000425isnan(_A1 __lcpp_x) _NOEXCEPT
Howard Hinnant0a111112011-05-13 21:52:40 +0000426{
Jonathan Roelofs9dc353c2014-08-27 14:05:20 +0000427 return __libcpp_isnan((typename std::__promote<_A1>::type)__lcpp_x);
Howard Hinnant0a111112011-05-13 21:52:40 +0000428}
429
430#endif // isnan
431
432// isnormal
433
434#ifdef isnormal
435
436template <class _A1>
437_LIBCPP_ALWAYS_INLINE
438bool
Jonathan Roelofs9dc353c2014-08-27 14:05:20 +0000439__libcpp_isnormal(_A1 __lcpp_x) _NOEXCEPT
Howard Hinnant0a111112011-05-13 21:52:40 +0000440{
Jonathan Roelofs9dc353c2014-08-27 14:05:20 +0000441 return isnormal(__lcpp_x);
Howard Hinnant0a111112011-05-13 21:52:40 +0000442}
443
444#undef isnormal
445
446template <class _A1>
447inline _LIBCPP_INLINE_VISIBILITY
Howard Hinnantb05a5562013-01-14 20:56:22 +0000448typename std::enable_if<std::is_arithmetic<_A1>::value, bool>::type
Jonathan Roelofs9dc353c2014-08-27 14:05:20 +0000449isnormal(_A1 __lcpp_x) _NOEXCEPT
Howard Hinnant0a111112011-05-13 21:52:40 +0000450{
Jonathan Roelofs9dc353c2014-08-27 14:05:20 +0000451 return __libcpp_isnormal((typename std::__promote<_A1>::type)__lcpp_x);
Howard Hinnant0a111112011-05-13 21:52:40 +0000452}
453
454#endif // isnormal
455
456// isgreater
457
458#ifdef isgreater
459
460template <class _A1, class _A2>
461_LIBCPP_ALWAYS_INLINE
462bool
Jonathan Roelofs9dc353c2014-08-27 14:05:20 +0000463__libcpp_isgreater(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
Howard Hinnant0a111112011-05-13 21:52:40 +0000464{
Jonathan Roelofs9dc353c2014-08-27 14:05:20 +0000465 return isgreater(__lcpp_x, __lcpp_y);
Howard Hinnant0a111112011-05-13 21:52:40 +0000466}
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:22 +0000474 std::is_arithmetic<_A1>::value &&
475 std::is_arithmetic<_A2>::value,
Howard Hinnant0a111112011-05-13 21:52:40 +0000476 bool
477>::type
Jonathan Roelofs9dc353c2014-08-27 14:05:20 +0000478isgreater(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
Howard Hinnant0a111112011-05-13 21:52:40 +0000479{
Howard Hinnantb05a5562013-01-14 20:56:22 +0000480 typedef typename std::__promote<_A1, _A2>::type type;
Jonathan Roelofs9dc353c2014-08-27 14:05:20 +0000481 return __libcpp_isgreater((type)__lcpp_x, (type)__lcpp_y);
Howard Hinnant0a111112011-05-13 21:52:40 +0000482}
483
484#endif // isgreater
485
486// isgreaterequal
487
488#ifdef isgreaterequal
489
490template <class _A1, class _A2>
491_LIBCPP_ALWAYS_INLINE
492bool
Jonathan Roelofs9dc353c2014-08-27 14:05:20 +0000493__libcpp_isgreaterequal(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
Howard Hinnant0a111112011-05-13 21:52:40 +0000494{
Jonathan Roelofs9dc353c2014-08-27 14:05:20 +0000495 return isgreaterequal(__lcpp_x, __lcpp_y);
Howard Hinnant0a111112011-05-13 21:52:40 +0000496}
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:22 +0000504 std::is_arithmetic<_A1>::value &&
505 std::is_arithmetic<_A2>::value,
Howard Hinnant0a111112011-05-13 21:52:40 +0000506 bool
507>::type
Jonathan Roelofs9dc353c2014-08-27 14:05:20 +0000508isgreaterequal(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
Howard Hinnant0a111112011-05-13 21:52:40 +0000509{
Howard Hinnantb05a5562013-01-14 20:56:22 +0000510 typedef typename std::__promote<_A1, _A2>::type type;
Jonathan Roelofs9dc353c2014-08-27 14:05:20 +0000511 return __libcpp_isgreaterequal((type)__lcpp_x, (type)__lcpp_y);
Howard Hinnant0a111112011-05-13 21:52:40 +0000512}
513
514#endif // isgreaterequal
515
516// isless
517
518#ifdef isless
519
520template <class _A1, class _A2>
521_LIBCPP_ALWAYS_INLINE
522bool
Jonathan Roelofs9dc353c2014-08-27 14:05:20 +0000523__libcpp_isless(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
Howard Hinnant0a111112011-05-13 21:52:40 +0000524{
Jonathan Roelofs9dc353c2014-08-27 14:05:20 +0000525 return isless(__lcpp_x, __lcpp_y);
Howard Hinnant0a111112011-05-13 21:52:40 +0000526}
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:22 +0000534 std::is_arithmetic<_A1>::value &&
535 std::is_arithmetic<_A2>::value,
Howard Hinnant0a111112011-05-13 21:52:40 +0000536 bool
537>::type
Jonathan Roelofs9dc353c2014-08-27 14:05:20 +0000538isless(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
Howard Hinnant0a111112011-05-13 21:52:40 +0000539{
Howard Hinnantb05a5562013-01-14 20:56:22 +0000540 typedef typename std::__promote<_A1, _A2>::type type;
Jonathan Roelofs9dc353c2014-08-27 14:05:20 +0000541 return __libcpp_isless((type)__lcpp_x, (type)__lcpp_y);
Howard Hinnant0a111112011-05-13 21:52:40 +0000542}
543
544#endif // isless
545
546// islessequal
547
548#ifdef islessequal
549
550template <class _A1, class _A2>
551_LIBCPP_ALWAYS_INLINE
552bool
Jonathan Roelofs9dc353c2014-08-27 14:05:20 +0000553__libcpp_islessequal(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
Howard Hinnant0a111112011-05-13 21:52:40 +0000554{
Jonathan Roelofs9dc353c2014-08-27 14:05:20 +0000555 return islessequal(__lcpp_x, __lcpp_y);
Howard Hinnant0a111112011-05-13 21:52:40 +0000556}
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:22 +0000564 std::is_arithmetic<_A1>::value &&
565 std::is_arithmetic<_A2>::value,
Howard Hinnant0a111112011-05-13 21:52:40 +0000566 bool
567>::type
Jonathan Roelofs9dc353c2014-08-27 14:05:20 +0000568islessequal(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
Howard Hinnant0a111112011-05-13 21:52:40 +0000569{
Howard Hinnantb05a5562013-01-14 20:56:22 +0000570 typedef typename std::__promote<_A1, _A2>::type type;
Jonathan Roelofs9dc353c2014-08-27 14:05:20 +0000571 return __libcpp_islessequal((type)__lcpp_x, (type)__lcpp_y);
Howard Hinnant0a111112011-05-13 21:52:40 +0000572}
573
574#endif // islessequal
575
576// islessgreater
577
578#ifdef islessgreater
579
580template <class _A1, class _A2>
581_LIBCPP_ALWAYS_INLINE
582bool
Jonathan Roelofs9dc353c2014-08-27 14:05:20 +0000583__libcpp_islessgreater(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
Howard Hinnant0a111112011-05-13 21:52:40 +0000584{
Jonathan Roelofs9dc353c2014-08-27 14:05:20 +0000585 return islessgreater(__lcpp_x, __lcpp_y);
Howard Hinnant0a111112011-05-13 21:52:40 +0000586}
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:22 +0000594 std::is_arithmetic<_A1>::value &&
595 std::is_arithmetic<_A2>::value,
Howard Hinnant0a111112011-05-13 21:52:40 +0000596 bool
597>::type
Jonathan Roelofs9dc353c2014-08-27 14:05:20 +0000598islessgreater(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
Howard Hinnant0a111112011-05-13 21:52:40 +0000599{
Howard Hinnantb05a5562013-01-14 20:56:22 +0000600 typedef typename std::__promote<_A1, _A2>::type type;
Jonathan Roelofs9dc353c2014-08-27 14:05:20 +0000601 return __libcpp_islessgreater((type)__lcpp_x, (type)__lcpp_y);
Howard Hinnant0a111112011-05-13 21:52:40 +0000602}
603
604#endif // islessgreater
605
606// isunordered
607
608#ifdef isunordered
609
610template <class _A1, class _A2>
611_LIBCPP_ALWAYS_INLINE
612bool
Jonathan Roelofs9dc353c2014-08-27 14:05:20 +0000613__libcpp_isunordered(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
Howard Hinnant0a111112011-05-13 21:52:40 +0000614{
Jonathan Roelofs9dc353c2014-08-27 14:05:20 +0000615 return isunordered(__lcpp_x, __lcpp_y);
Howard Hinnant0a111112011-05-13 21:52:40 +0000616}
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:22 +0000624 std::is_arithmetic<_A1>::value &&
625 std::is_arithmetic<_A2>::value,
Howard Hinnant0a111112011-05-13 21:52:40 +0000626 bool
627>::type
Jonathan Roelofs9dc353c2014-08-27 14:05:20 +0000628isunordered(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
Howard Hinnant0a111112011-05-13 21:52:40 +0000629{
Howard Hinnantb05a5562013-01-14 20:56:22 +0000630 typedef typename std::__promote<_A1, _A2>::type type;
Jonathan Roelofs9dc353c2014-08-27 14:05:20 +0000631 return __libcpp_isunordered((type)__lcpp_x, (type)__lcpp_y);
Howard Hinnant0a111112011-05-13 21:52:40 +0000632}
633
634#endif // isunordered
635
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000636_LIBCPP_BEGIN_NAMESPACE_STD
637
Howard Hinnant0a111112011-05-13 21:52:40 +0000638using ::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:16 +0000652using ::float_t;
653using ::double_t;
654
655// abs
656
Eric Fiselier0b6f8ed2015-03-18 15:24:18 +0000657#if defined(__sun__)
658using ::abs;
659#endif
660
Eric Fiselierf51d6762015-01-23 22:22:36 +0000661#if !defined(_AIX) && !defined(__sun__)
Howard Hinnant422a53f2010-09-21 21:28:23 +0000662inline _LIBCPP_INLINE_VISIBILITY
Howard Hinnantf07a5292012-05-03 14:58:34 +0000663float
Jonathan Roelofs9dc353c2014-08-27 14:05:20 +0000664abs(float __lcpp_x) _NOEXCEPT {return fabsf(__lcpp_x);}
Howard Hinnantf07a5292012-05-03 14:58:34 +0000665
666inline _LIBCPP_INLINE_VISIBILITY
667double
Jonathan Roelofs9dc353c2014-08-27 14:05:20 +0000668abs(double __lcpp_x) _NOEXCEPT {return fabs(__lcpp_x);}
Howard Hinnantf07a5292012-05-03 14:58:34 +0000669
670inline _LIBCPP_INLINE_VISIBILITY
671long double
Jonathan Roelofs9dc353c2014-08-27 14:05:20 +0000672abs(long double __lcpp_x) _NOEXCEPT {return fabsl(__lcpp_x);}
Howard Hinnant7f764502013-08-14 18:00:20 +0000673#endif // !defined(_AIX)
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000674
David Chisnall997e4542012-02-29 13:05:08 +0000675#ifndef __sun__
676
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000677// acos
678
679using ::acos;
680using ::acosf;
681
Howard Hinnant7f764502013-08-14 18:00:20 +0000682#if !(defined(_LIBCPP_MSVCRT) || defined(_AIX))
Jonathan Roelofs9dc353c2014-08-27 14:05:20 +0000683inline _LIBCPP_INLINE_VISIBILITY float acos(float __lcpp_x) _NOEXCEPT {return acosf(__lcpp_x);}
684inline _LIBCPP_INLINE_VISIBILITY long double acos(long double __lcpp_x) _NOEXCEPT {return acosl(__lcpp_x);}
Howard Hinnant9f8884e2011-10-27 16:24:42 +0000685#endif
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000686
687template <class _A1>
Howard Hinnant422a53f2010-09-21 21:28:23 +0000688inline _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000689typename enable_if<is_integral<_A1>::value, double>::type
Jonathan Roelofs9dc353c2014-08-27 14:05:20 +0000690acos(_A1 __lcpp_x) _NOEXCEPT {return acos((double)__lcpp_x);}
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000691
692// asin
693
694using ::asin;
695using ::asinf;
696
Howard Hinnant7f764502013-08-14 18:00:20 +0000697#if !(defined(_LIBCPP_MSVCRT) || defined(_AIX))
Jonathan Roelofs9dc353c2014-08-27 14:05:20 +0000698inline _LIBCPP_INLINE_VISIBILITY float asin(float __lcpp_x) _NOEXCEPT {return asinf(__lcpp_x);}
699inline _LIBCPP_INLINE_VISIBILITY long double asin(long double __lcpp_x) _NOEXCEPT {return asinl(__lcpp_x);}
Howard Hinnant9f8884e2011-10-27 16:24:42 +0000700#endif
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000701
702template <class _A1>
Howard Hinnant422a53f2010-09-21 21:28:23 +0000703inline _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000704typename enable_if<is_integral<_A1>::value, double>::type
Jonathan Roelofs9dc353c2014-08-27 14:05:20 +0000705asin(_A1 __lcpp_x) _NOEXCEPT {return asin((double)__lcpp_x);}
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000706
707// atan
708
709using ::atan;
710using ::atanf;
711
Howard Hinnant7f764502013-08-14 18:00:20 +0000712#if !(defined(_LIBCPP_MSVCRT) || defined(_AIX))
Jonathan Roelofs9dc353c2014-08-27 14:05:20 +0000713inline _LIBCPP_INLINE_VISIBILITY float atan(float __lcpp_x) _NOEXCEPT {return atanf(__lcpp_x);}
714inline _LIBCPP_INLINE_VISIBILITY long double atan(long double __lcpp_x) _NOEXCEPT {return atanl(__lcpp_x);}
Howard Hinnant9f8884e2011-10-27 16:24:42 +0000715#endif
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000716
717template <class _A1>
Howard Hinnant422a53f2010-09-21 21:28:23 +0000718inline _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000719typename enable_if<is_integral<_A1>::value, double>::type
Jonathan Roelofs9dc353c2014-08-27 14:05:20 +0000720atan(_A1 __lcpp_x) _NOEXCEPT {return atan((double)__lcpp_x);}
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000721
722// atan2
723
724using ::atan2;
725using ::atan2f;
726
Howard Hinnant7f764502013-08-14 18:00:20 +0000727#if !(defined(_LIBCPP_MSVCRT) || defined(_AIX))
Jonathan Roelofs9dc353c2014-08-27 14:05:20 +0000728inline _LIBCPP_INLINE_VISIBILITY float atan2(float __lcpp_y, float __lcpp_x) _NOEXCEPT {return atan2f(__lcpp_y, __lcpp_x);}
729inline _LIBCPP_INLINE_VISIBILITY long double atan2(long double __lcpp_y, long double __lcpp_x) _NOEXCEPT {return atan2l(__lcpp_y, __lcpp_x);}
Howard Hinnant9f8884e2011-10-27 16:24:42 +0000730#endif
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000731
732template <class _A1, class _A2>
Howard Hinnant422a53f2010-09-21 21:28:23 +0000733inline _LIBCPP_INLINE_VISIBILITY
Eric Fiselier950ee772014-10-17 00:31:47 +0000734typename __lazy_enable_if
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000735<
736 is_arithmetic<_A1>::value &&
737 is_arithmetic<_A2>::value,
Eric Fiselier950ee772014-10-17 00:31:47 +0000738 __promote<_A1, _A2>
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000739>::type
Jonathan Roelofs9dc353c2014-08-27 14:05:20 +0000740atan2(_A1 __lcpp_y, _A2 __lcpp_x) _NOEXCEPT
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000741{
742 typedef typename __promote<_A1, _A2>::type __result_type;
743 static_assert((!(is_same<_A1, __result_type>::value &&
744 is_same<_A2, __result_type>::value)), "");
Jonathan Roelofs9dc353c2014-08-27 14:05:20 +0000745 return atan2((__result_type)__lcpp_y, (__result_type)__lcpp_x);
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000746}
747
748// ceil
749
750using ::ceil;
751using ::ceilf;
752
Howard Hinnant7f764502013-08-14 18:00:20 +0000753#if !(defined(_LIBCPP_MSVCRT) || defined(_AIX))
Jonathan Roelofs9dc353c2014-08-27 14:05:20 +0000754inline _LIBCPP_INLINE_VISIBILITY float ceil(float __lcpp_x) _NOEXCEPT {return ceilf(__lcpp_x);}
755inline _LIBCPP_INLINE_VISIBILITY long double ceil(long double __lcpp_x) _NOEXCEPT {return ceill(__lcpp_x);}
Howard Hinnant9f8884e2011-10-27 16:24:42 +0000756#endif
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000757
758template <class _A1>
Howard Hinnant422a53f2010-09-21 21:28:23 +0000759inline _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000760typename enable_if<is_integral<_A1>::value, double>::type
Jonathan Roelofs9dc353c2014-08-27 14:05:20 +0000761ceil(_A1 __lcpp_x) _NOEXCEPT {return ceil((double)__lcpp_x);}
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000762
763// cos
764
765using ::cos;
766using ::cosf;
767
Howard Hinnant7f764502013-08-14 18:00:20 +0000768#if !(defined(_LIBCPP_MSVCRT) || defined(_AIX))
Jonathan Roelofs9dc353c2014-08-27 14:05:20 +0000769inline _LIBCPP_INLINE_VISIBILITY float cos(float __lcpp_x) _NOEXCEPT {return cosf(__lcpp_x);}
770inline _LIBCPP_INLINE_VISIBILITY long double cos(long double __lcpp_x) _NOEXCEPT {return cosl(__lcpp_x);}
Howard Hinnant9f8884e2011-10-27 16:24:42 +0000771#endif
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000772
773template <class _A1>
Howard Hinnant161a9bf2013-08-29 23:50:48 +0000774inline _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000775typename enable_if<is_integral<_A1>::value, double>::type
Jonathan Roelofs9dc353c2014-08-27 14:05:20 +0000776cos(_A1 __lcpp_x) _NOEXCEPT {return cos((double)__lcpp_x);}
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000777
778// cosh
779
780using ::cosh;
781using ::coshf;
782
Howard Hinnant7f764502013-08-14 18:00:20 +0000783#if !(defined(_LIBCPP_MSVCRT) || defined(_AIX))
Jonathan Roelofs9dc353c2014-08-27 14:05:20 +0000784inline _LIBCPP_INLINE_VISIBILITY float cosh(float __lcpp_x) _NOEXCEPT {return coshf(__lcpp_x);}
785inline _LIBCPP_INLINE_VISIBILITY long double cosh(long double __lcpp_x) _NOEXCEPT {return coshl(__lcpp_x);}
Howard Hinnant9f8884e2011-10-27 16:24:42 +0000786#endif
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000787
788template <class _A1>
Howard Hinnant422a53f2010-09-21 21:28:23 +0000789inline _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000790typename enable_if<is_integral<_A1>::value, double>::type
Jonathan Roelofs9dc353c2014-08-27 14:05:20 +0000791cosh(_A1 __lcpp_x) _NOEXCEPT {return cosh((double)__lcpp_x);}
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000792
David Chisnall997e4542012-02-29 13:05:08 +0000793#endif // __sun__
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000794// exp
795
796using ::exp;
797using ::expf;
798
David Chisnall997e4542012-02-29 13:05:08 +0000799#ifndef __sun__
800
Howard Hinnant7f764502013-08-14 18:00:20 +0000801#if !(defined(_LIBCPP_MSVCRT) || defined(_AIX))
Jonathan Roelofs9dc353c2014-08-27 14:05:20 +0000802inline _LIBCPP_INLINE_VISIBILITY float exp(float __lcpp_x) _NOEXCEPT {return expf(__lcpp_x);}
803inline _LIBCPP_INLINE_VISIBILITY long double exp(long double __lcpp_x) _NOEXCEPT {return expl(__lcpp_x);}
Howard Hinnant9f8884e2011-10-27 16:24:42 +0000804#endif
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000805
David Chisnall997e4542012-02-29 13:05:08 +0000806
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000807template <class _A1>
Howard Hinnant422a53f2010-09-21 21:28:23 +0000808inline _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000809typename enable_if<is_integral<_A1>::value, double>::type
Jonathan Roelofs9dc353c2014-08-27 14:05:20 +0000810exp(_A1 __lcpp_x) _NOEXCEPT {return exp((double)__lcpp_x);}
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000811
812// fabs
813
814using ::fabs;
815using ::fabsf;
816
Howard Hinnant7f764502013-08-14 18:00:20 +0000817#if !(defined(_LIBCPP_MSVCRT) || defined(_AIX))
Jonathan Roelofs9dc353c2014-08-27 14:05:20 +0000818inline _LIBCPP_INLINE_VISIBILITY float fabs(float __lcpp_x) _NOEXCEPT {return fabsf(__lcpp_x);}
819inline _LIBCPP_INLINE_VISIBILITY long double fabs(long double __lcpp_x) _NOEXCEPT {return fabsl(__lcpp_x);}
Howard Hinnant9f8884e2011-10-27 16:24:42 +0000820#endif
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000821
822template <class _A1>
Howard Hinnant422a53f2010-09-21 21:28:23 +0000823inline _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000824typename enable_if<is_integral<_A1>::value, double>::type
Jonathan Roelofs9dc353c2014-08-27 14:05:20 +0000825fabs(_A1 __lcpp_x) _NOEXCEPT {return fabs((double)__lcpp_x);}
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000826
827// floor
828
829using ::floor;
830using ::floorf;
831
Howard Hinnant7f764502013-08-14 18:00:20 +0000832#if !(defined(_LIBCPP_MSVCRT) || defined(_AIX))
Jonathan Roelofs9dc353c2014-08-27 14:05:20 +0000833inline _LIBCPP_INLINE_VISIBILITY float floor(float __lcpp_x) _NOEXCEPT {return floorf(__lcpp_x);}
834inline _LIBCPP_INLINE_VISIBILITY long double floor(long double __lcpp_x) _NOEXCEPT {return floorl(__lcpp_x);}
Howard Hinnant9f8884e2011-10-27 16:24:42 +0000835#endif
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000836
837template <class _A1>
Howard Hinnant422a53f2010-09-21 21:28:23 +0000838inline _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000839typename enable_if<is_integral<_A1>::value, double>::type
Jonathan Roelofs9dc353c2014-08-27 14:05:20 +0000840floor(_A1 __lcpp_x) _NOEXCEPT {return floor((double)__lcpp_x);}
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000841
842// fmod
843
David Chisnall997e4542012-02-29 13:05:08 +0000844#endif //__sun__
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000845using ::fmod;
846using ::fmodf;
David Chisnall997e4542012-02-29 13:05:08 +0000847#ifndef __sun__
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000848
Howard Hinnant7f764502013-08-14 18:00:20 +0000849#if !(defined(_LIBCPP_MSVCRT) || defined(_AIX))
Jonathan Roelofs9dc353c2014-08-27 14:05:20 +0000850inline _LIBCPP_INLINE_VISIBILITY float fmod(float __lcpp_x, float __lcpp_y) _NOEXCEPT {return fmodf(__lcpp_x, __lcpp_y);}
851inline _LIBCPP_INLINE_VISIBILITY long double fmod(long double __lcpp_x, long double __lcpp_y) _NOEXCEPT {return fmodl(__lcpp_x, __lcpp_y);}
Howard Hinnant9f8884e2011-10-27 16:24:42 +0000852#endif
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000853
854template <class _A1, class _A2>
Howard Hinnant422a53f2010-09-21 21:28:23 +0000855inline _LIBCPP_INLINE_VISIBILITY
Eric Fiselier950ee772014-10-17 00:31:47 +0000856typename __lazy_enable_if
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000857<
858 is_arithmetic<_A1>::value &&
859 is_arithmetic<_A2>::value,
Eric Fiselier950ee772014-10-17 00:31:47 +0000860 __promote<_A1, _A2>
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000861>::type
Jonathan Roelofs9dc353c2014-08-27 14:05:20 +0000862fmod(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000863{
864 typedef typename __promote<_A1, _A2>::type __result_type;
865 static_assert((!(is_same<_A1, __result_type>::value &&
866 is_same<_A2, __result_type>::value)), "");
Jonathan Roelofs9dc353c2014-08-27 14:05:20 +0000867 return fmod((__result_type)__lcpp_x, (__result_type)__lcpp_y);
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000868}
869
David Chisnall997e4542012-02-29 13:05:08 +0000870
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000871// frexp
872
873using ::frexp;
874using ::frexpf;
875
Howard Hinnant7f764502013-08-14 18:00:20 +0000876#if !(defined(_LIBCPP_MSVCRT) || defined(_AIX))
Jonathan Roelofs9dc353c2014-08-27 14:05:20 +0000877inline _LIBCPP_INLINE_VISIBILITY float frexp(float __lcpp_x, int* __lcpp_e) _NOEXCEPT {return frexpf(__lcpp_x, __lcpp_e);}
878inline _LIBCPP_INLINE_VISIBILITY long double frexp(long double __lcpp_x, int* __lcpp_e) _NOEXCEPT {return frexpl(__lcpp_x, __lcpp_e);}
Howard Hinnant9f8884e2011-10-27 16:24:42 +0000879#endif
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000880
881template <class _A1>
Howard Hinnant422a53f2010-09-21 21:28:23 +0000882inline _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000883typename enable_if<is_integral<_A1>::value, double>::type
Jonathan Roelofs9dc353c2014-08-27 14:05:20 +0000884frexp(_A1 __lcpp_x, int* __lcpp_e) _NOEXCEPT {return frexp((double)__lcpp_x, __lcpp_e);}
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000885
886// ldexp
887
888using ::ldexp;
889using ::ldexpf;
890
Howard Hinnant7f764502013-08-14 18:00:20 +0000891#if !(defined(_LIBCPP_MSVCRT) || defined(_AIX))
Jonathan Roelofs9dc353c2014-08-27 14:05:20 +0000892inline _LIBCPP_INLINE_VISIBILITY float ldexp(float __lcpp_x, int __lcpp_e) _NOEXCEPT {return ldexpf(__lcpp_x, __lcpp_e);}
893inline _LIBCPP_INLINE_VISIBILITY long double ldexp(long double __lcpp_x, int __lcpp_e) _NOEXCEPT {return ldexpl(__lcpp_x, __lcpp_e);}
Howard Hinnant9f8884e2011-10-27 16:24:42 +0000894#endif
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000895
896template <class _A1>
Howard Hinnant422a53f2010-09-21 21:28:23 +0000897inline _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000898typename enable_if<is_integral<_A1>::value, double>::type
Jonathan Roelofs9dc353c2014-08-27 14:05:20 +0000899ldexp(_A1 __lcpp_x, int __lcpp_e) _NOEXCEPT {return ldexp((double)__lcpp_x, __lcpp_e);}
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000900
901// log
902
David Chisnall997e4542012-02-29 13:05:08 +0000903#endif // __sun__
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000904using ::log;
905using ::logf;
David Chisnall997e4542012-02-29 13:05:08 +0000906#ifndef __sun__
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000907
Howard Hinnant7f764502013-08-14 18:00:20 +0000908#if !(defined(_LIBCPP_MSVCRT) || defined(_AIX))
Jonathan Roelofs9dc353c2014-08-27 14:05:20 +0000909inline _LIBCPP_INLINE_VISIBILITY float log(float __lcpp_x) _NOEXCEPT {return logf(__lcpp_x);}
910inline _LIBCPP_INLINE_VISIBILITY long double log(long double __lcpp_x) _NOEXCEPT {return logl(__lcpp_x);}
Howard Hinnant9f8884e2011-10-27 16:24:42 +0000911#endif
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000912
913template <class _A1>
Howard Hinnant422a53f2010-09-21 21:28:23 +0000914inline _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000915typename enable_if<is_integral<_A1>::value, double>::type
Jonathan Roelofs9dc353c2014-08-27 14:05:20 +0000916log(_A1 __lcpp_x) _NOEXCEPT {return log((double)__lcpp_x);}
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000917
David Chisnall997e4542012-02-29 13:05:08 +0000918
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000919// log10
920
921using ::log10;
922using ::log10f;
923
Howard Hinnant7f764502013-08-14 18:00:20 +0000924#if !(defined(_LIBCPP_MSVCRT) || defined(_AIX))
Jonathan Roelofs9dc353c2014-08-27 14:05:20 +0000925inline _LIBCPP_INLINE_VISIBILITY float log10(float __lcpp_x) _NOEXCEPT {return log10f(__lcpp_x);}
926inline _LIBCPP_INLINE_VISIBILITY long double log10(long double __lcpp_x) _NOEXCEPT {return log10l(__lcpp_x);}
Howard Hinnant9f8884e2011-10-27 16:24:42 +0000927#endif
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000928
929template <class _A1>
Howard Hinnant422a53f2010-09-21 21:28:23 +0000930inline _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000931typename enable_if<is_integral<_A1>::value, double>::type
Jonathan Roelofs9dc353c2014-08-27 14:05:20 +0000932log10(_A1 __lcpp_x) _NOEXCEPT {return log10((double)__lcpp_x);}
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000933
934// modf
935
936using ::modf;
937using ::modff;
938
Howard Hinnant7f764502013-08-14 18:00:20 +0000939#if !(defined(_LIBCPP_MSVCRT) || defined(_AIX))
Jonathan Roelofs9dc353c2014-08-27 14:05:20 +0000940inline _LIBCPP_INLINE_VISIBILITY float modf(float __lcpp_x, float* __lcpp_y) _NOEXCEPT {return modff(__lcpp_x, __lcpp_y);}
941inline _LIBCPP_INLINE_VISIBILITY long double modf(long double __lcpp_x, long double* __lcpp_y) _NOEXCEPT {return modfl(__lcpp_x, __lcpp_y);}
Howard Hinnant9f8884e2011-10-27 16:24:42 +0000942#endif
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000943
944// pow
945
David Chisnall997e4542012-02-29 13:05:08 +0000946#endif // __sun__
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000947using ::pow;
948using ::powf;
949
David Chisnall997e4542012-02-29 13:05:08 +0000950#ifndef __sun__
951
Howard Hinnant7f764502013-08-14 18:00:20 +0000952#if !(defined(_LIBCPP_MSVCRT) || defined(_AIX))
Jonathan Roelofs9dc353c2014-08-27 14:05:20 +0000953inline _LIBCPP_INLINE_VISIBILITY float pow(float __lcpp_x, float __lcpp_y) _NOEXCEPT {return powf(__lcpp_x, __lcpp_y);}
954inline _LIBCPP_INLINE_VISIBILITY long double pow(long double __lcpp_x, long double __lcpp_y) _NOEXCEPT {return powl(__lcpp_x, __lcpp_y);}
Howard Hinnant9f8884e2011-10-27 16:24:42 +0000955#endif
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000956
957template <class _A1, class _A2>
Howard Hinnant422a53f2010-09-21 21:28:23 +0000958inline _LIBCPP_INLINE_VISIBILITY
Eric Fiselier950ee772014-10-17 00:31:47 +0000959typename __lazy_enable_if
Marshall Clow908b5d72014-01-06 18:12:50 +0000960<
961 is_arithmetic<_A1>::value &&
962 is_arithmetic<_A2>::value,
Eric Fiselier950ee772014-10-17 00:31:47 +0000963 __promote<_A1, _A2>
Marshall Clow908b5d72014-01-06 18:12:50 +0000964>::type
Jonathan Roelofs9dc353c2014-08-27 14:05:20 +0000965pow(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000966{
Marshall Clow908b5d72014-01-06 18:12:50 +0000967 typedef typename __promote<_A1, _A2>::type __result_type;
968 static_assert((!(is_same<_A1, __result_type>::value &&
969 is_same<_A2, __result_type>::value)), "");
Jonathan Roelofs9dc353c2014-08-27 14:05:20 +0000970 return pow((__result_type)__lcpp_x, (__result_type)__lcpp_y);
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000971}
972
973// sin
974
975using ::sin;
976using ::sinf;
977
Howard Hinnant7f764502013-08-14 18:00:20 +0000978#if !(defined(_LIBCPP_MSVCRT) || defined(_AIX))
Jonathan Roelofs9dc353c2014-08-27 14:05:20 +0000979inline _LIBCPP_INLINE_VISIBILITY float sin(float __lcpp_x) _NOEXCEPT {return sinf(__lcpp_x);}
980inline _LIBCPP_INLINE_VISIBILITY long double sin(long double __lcpp_x) _NOEXCEPT {return sinl(__lcpp_x);}
Howard Hinnant9f8884e2011-10-27 16:24:42 +0000981#endif
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000982
983template <class _A1>
Howard Hinnant422a53f2010-09-21 21:28:23 +0000984inline _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000985typename enable_if<is_integral<_A1>::value, double>::type
Jonathan Roelofs9dc353c2014-08-27 14:05:20 +0000986sin(_A1 __lcpp_x) _NOEXCEPT {return sin((double)__lcpp_x);}
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000987
988// sinh
989
990using ::sinh;
991using ::sinhf;
992
Howard Hinnant7f764502013-08-14 18:00:20 +0000993#if !(defined(_LIBCPP_MSVCRT) || defined(_AIX))
Jonathan Roelofs9dc353c2014-08-27 14:05:20 +0000994inline _LIBCPP_INLINE_VISIBILITY float sinh(float __lcpp_x) _NOEXCEPT {return sinhf(__lcpp_x);}
995inline _LIBCPP_INLINE_VISIBILITY long double sinh(long double __lcpp_x) _NOEXCEPT {return sinhl(__lcpp_x);}
Howard Hinnant9f8884e2011-10-27 16:24:42 +0000996#endif
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000997
998template <class _A1>
Howard Hinnant422a53f2010-09-21 21:28:23 +0000999inline _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001000typename enable_if<is_integral<_A1>::value, double>::type
Jonathan Roelofs9dc353c2014-08-27 14:05:20 +00001001sinh(_A1 __lcpp_x) _NOEXCEPT {return sinh((double)__lcpp_x);}
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001002
1003// sqrt
1004
David Chisnall997e4542012-02-29 13:05:08 +00001005#endif // __sun__
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001006using ::sqrt;
1007using ::sqrtf;
1008
David Chisnall997e4542012-02-29 13:05:08 +00001009
Howard Hinnant7f764502013-08-14 18:00:20 +00001010#if !(defined(_LIBCPP_MSVCRT) || defined(__sun__) || defined(_AIX))
Jonathan Roelofs9dc353c2014-08-27 14:05:20 +00001011inline _LIBCPP_INLINE_VISIBILITY float sqrt(float __lcpp_x) _NOEXCEPT {return sqrtf(__lcpp_x);}
1012inline _LIBCPP_INLINE_VISIBILITY long double sqrt(long double __lcpp_x) _NOEXCEPT {return sqrtl(__lcpp_x);}
Howard Hinnant9f8884e2011-10-27 16:24:42 +00001013#endif
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001014
1015template <class _A1>
Howard Hinnant422a53f2010-09-21 21:28:23 +00001016inline _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001017typename enable_if<is_integral<_A1>::value, double>::type
Jonathan Roelofs9dc353c2014-08-27 14:05:20 +00001018sqrt(_A1 __lcpp_x) _NOEXCEPT {return sqrt((double)__lcpp_x);}
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001019
1020// tan
1021
1022using ::tan;
1023using ::tanf;
David Chisnall997e4542012-02-29 13:05:08 +00001024#ifndef __sun__
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001025
Howard Hinnant7f764502013-08-14 18:00:20 +00001026#if !(defined(_LIBCPP_MSVCRT) || defined(_AIX))
Jonathan Roelofs9dc353c2014-08-27 14:05:20 +00001027inline _LIBCPP_INLINE_VISIBILITY float tan(float __lcpp_x) _NOEXCEPT {return tanf(__lcpp_x);}
1028inline _LIBCPP_INLINE_VISIBILITY long double tan(long double __lcpp_x) _NOEXCEPT {return tanl(__lcpp_x);}
Howard Hinnant9f8884e2011-10-27 16:24:42 +00001029#endif
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001030
1031template <class _A1>
Howard Hinnant422a53f2010-09-21 21:28:23 +00001032inline _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001033typename enable_if<is_integral<_A1>::value, double>::type
Jonathan Roelofs9dc353c2014-08-27 14:05:20 +00001034tan(_A1 __lcpp_x) _NOEXCEPT {return tan((double)__lcpp_x);}
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001035
1036// tanh
1037
1038using ::tanh;
1039using ::tanhf;
1040
Howard Hinnant7f764502013-08-14 18:00:20 +00001041#if !(defined(_LIBCPP_MSVCRT) || defined(_AIX))
Jonathan Roelofs9dc353c2014-08-27 14:05:20 +00001042inline _LIBCPP_INLINE_VISIBILITY float tanh(float __lcpp_x) _NOEXCEPT {return tanhf(__lcpp_x);}
1043inline _LIBCPP_INLINE_VISIBILITY long double tanh(long double __lcpp_x) _NOEXCEPT {return tanhl(__lcpp_x);}
Howard Hinnant9f8884e2011-10-27 16:24:42 +00001044#endif
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001045
1046template <class _A1>
Howard Hinnant422a53f2010-09-21 21:28:23 +00001047inline _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001048typename enable_if<is_integral<_A1>::value, double>::type
Jonathan Roelofs9dc353c2014-08-27 14:05:20 +00001049tanh(_A1 __lcpp_x) _NOEXCEPT {return tanh((double)__lcpp_x);}
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001050
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001051// acosh
1052
Howard Hinnante9df0a52013-08-01 18:17:34 +00001053#ifndef _LIBCPP_MSVCRT
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001054using ::acosh;
1055using ::acoshf;
1056
Jonathan Roelofs9dc353c2014-08-27 14:05:20 +00001057inline _LIBCPP_INLINE_VISIBILITY float acosh(float __lcpp_x) _NOEXCEPT {return acoshf(__lcpp_x);}
1058inline _LIBCPP_INLINE_VISIBILITY long double acosh(long double __lcpp_x) _NOEXCEPT {return acoshl(__lcpp_x);}
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001059
1060template <class _A1>
Howard Hinnant422a53f2010-09-21 21:28:23 +00001061inline _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001062typename enable_if<is_integral<_A1>::value, double>::type
Jonathan Roelofs9dc353c2014-08-27 14:05:20 +00001063acosh(_A1 __lcpp_x) _NOEXCEPT {return acosh((double)__lcpp_x);}
Howard Hinnant9f8884e2011-10-27 16:24:42 +00001064#endif
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001065
1066// asinh
1067
Howard Hinnante9df0a52013-08-01 18:17:34 +00001068#ifndef _LIBCPP_MSVCRT
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001069using ::asinh;
1070using ::asinhf;
1071
Jonathan Roelofs9dc353c2014-08-27 14:05:20 +00001072inline _LIBCPP_INLINE_VISIBILITY float asinh(float __lcpp_x) _NOEXCEPT {return asinhf(__lcpp_x);}
1073inline _LIBCPP_INLINE_VISIBILITY long double asinh(long double __lcpp_x) _NOEXCEPT {return asinhl(__lcpp_x);}
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001074
1075template <class _A1>
Howard Hinnant422a53f2010-09-21 21:28:23 +00001076inline _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001077typename enable_if<is_integral<_A1>::value, double>::type
Jonathan Roelofs9dc353c2014-08-27 14:05:20 +00001078asinh(_A1 __lcpp_x) _NOEXCEPT {return asinh((double)__lcpp_x);}
Howard Hinnant9f8884e2011-10-27 16:24:42 +00001079#endif
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001080
1081// atanh
1082
Howard Hinnante9df0a52013-08-01 18:17:34 +00001083#ifndef _LIBCPP_MSVCRT
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001084using ::atanh;
1085using ::atanhf;
1086
Jonathan Roelofs9dc353c2014-08-27 14:05:20 +00001087inline _LIBCPP_INLINE_VISIBILITY float atanh(float __lcpp_x) _NOEXCEPT {return atanhf(__lcpp_x);}
1088inline _LIBCPP_INLINE_VISIBILITY long double atanh(long double __lcpp_x) _NOEXCEPT {return atanhl(__lcpp_x);}
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001089
1090template <class _A1>
Howard Hinnant422a53f2010-09-21 21:28:23 +00001091inline _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001092typename enable_if<is_integral<_A1>::value, double>::type
Jonathan Roelofs9dc353c2014-08-27 14:05:20 +00001093atanh(_A1 __lcpp_x) _NOEXCEPT {return atanh((double)__lcpp_x);}
Howard Hinnant9f8884e2011-10-27 16:24:42 +00001094#endif
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001095
1096// cbrt
1097
Howard Hinnante9df0a52013-08-01 18:17:34 +00001098#ifndef _LIBCPP_MSVCRT
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001099using ::cbrt;
1100using ::cbrtf;
1101
Jonathan Roelofs9dc353c2014-08-27 14:05:20 +00001102inline _LIBCPP_INLINE_VISIBILITY float cbrt(float __lcpp_x) _NOEXCEPT {return cbrtf(__lcpp_x);}
1103inline _LIBCPP_INLINE_VISIBILITY long double cbrt(long double __lcpp_x) _NOEXCEPT {return cbrtl(__lcpp_x);}
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001104
1105template <class _A1>
Howard Hinnant422a53f2010-09-21 21:28:23 +00001106inline _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001107typename enable_if<is_integral<_A1>::value, double>::type
Jonathan Roelofs9dc353c2014-08-27 14:05:20 +00001108cbrt(_A1 __lcpp_x) _NOEXCEPT {return cbrt((double)__lcpp_x);}
Howard Hinnant9f8884e2011-10-27 16:24:42 +00001109#endif
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001110
1111// copysign
1112
1113using ::copysign;
1114using ::copysignf;
1115
Saleem Abdulrasool3ff05312015-02-28 20:18:39 +00001116#if !defined(_VC_CRT_MAJOR_VERSION) || (_VC_CRT_MAJOR_VERSION < 12)
1117inline _LIBCPP_INLINE_VISIBILITY float copysign(float __lcpp_x,
1118 float __lcpp_y) _NOEXCEPT {
1119 return copysignf(__lcpp_x, __lcpp_y);
1120}
1121inline _LIBCPP_INLINE_VISIBILITY long double
1122copysign(long double __lcpp_x, long double __lcpp_y) _NOEXCEPT {
1123 return copysignl(__lcpp_x, __lcpp_y);
1124}
1125#endif
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001126
1127template <class _A1, class _A2>
Howard Hinnant422a53f2010-09-21 21:28:23 +00001128inline _LIBCPP_INLINE_VISIBILITY
Eric Fiselier950ee772014-10-17 00:31:47 +00001129typename __lazy_enable_if
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001130<
1131 is_arithmetic<_A1>::value &&
1132 is_arithmetic<_A2>::value,
Eric Fiselier950ee772014-10-17 00:31:47 +00001133 __promote<_A1, _A2>
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001134>::type
Jonathan Roelofs9dc353c2014-08-27 14:05:20 +00001135copysign(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001136{
1137 typedef typename __promote<_A1, _A2>::type __result_type;
1138 static_assert((!(is_same<_A1, __result_type>::value &&
1139 is_same<_A2, __result_type>::value)), "");
Jonathan Roelofs9dc353c2014-08-27 14:05:20 +00001140 return copysign((__result_type)__lcpp_x, (__result_type)__lcpp_y);
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001141}
1142
Howard Hinnante9df0a52013-08-01 18:17:34 +00001143#ifndef _LIBCPP_MSVCRT
Howard Hinnant9f8884e2011-10-27 16:24:42 +00001144
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001145// erf
1146
1147using ::erf;
1148using ::erff;
1149
Jonathan Roelofs9dc353c2014-08-27 14:05:20 +00001150inline _LIBCPP_INLINE_VISIBILITY float erf(float __lcpp_x) _NOEXCEPT {return erff(__lcpp_x);}
1151inline _LIBCPP_INLINE_VISIBILITY long double erf(long double __lcpp_x) _NOEXCEPT {return erfl(__lcpp_x);}
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001152
1153template <class _A1>
Howard Hinnant422a53f2010-09-21 21:28:23 +00001154inline _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001155typename enable_if<is_integral<_A1>::value, double>::type
Jonathan Roelofs9dc353c2014-08-27 14:05:20 +00001156erf(_A1 __lcpp_x) _NOEXCEPT {return erf((double)__lcpp_x);}
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001157
1158// erfc
1159
1160using ::erfc;
1161using ::erfcf;
1162
Jonathan Roelofs9dc353c2014-08-27 14:05:20 +00001163inline _LIBCPP_INLINE_VISIBILITY float erfc(float __lcpp_x) _NOEXCEPT {return erfcf(__lcpp_x);}
1164inline _LIBCPP_INLINE_VISIBILITY long double erfc(long double __lcpp_x) _NOEXCEPT {return erfcl(__lcpp_x);}
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001165
1166template <class _A1>
Howard Hinnant422a53f2010-09-21 21:28:23 +00001167inline _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001168typename enable_if<is_integral<_A1>::value, double>::type
Jonathan Roelofs9dc353c2014-08-27 14:05:20 +00001169erfc(_A1 __lcpp_x) _NOEXCEPT {return erfc((double)__lcpp_x);}
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001170
1171// exp2
1172
1173using ::exp2;
1174using ::exp2f;
1175
Jonathan Roelofs9dc353c2014-08-27 14:05:20 +00001176inline _LIBCPP_INLINE_VISIBILITY float exp2(float __lcpp_x) _NOEXCEPT {return exp2f(__lcpp_x);}
1177inline _LIBCPP_INLINE_VISIBILITY long double exp2(long double __lcpp_x) _NOEXCEPT {return exp2l(__lcpp_x);}
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001178
1179template <class _A1>
Howard Hinnant422a53f2010-09-21 21:28:23 +00001180inline _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001181typename enable_if<is_integral<_A1>::value, double>::type
Jonathan Roelofs9dc353c2014-08-27 14:05:20 +00001182exp2(_A1 __lcpp_x) _NOEXCEPT {return exp2((double)__lcpp_x);}
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001183
1184// expm1
1185
1186using ::expm1;
1187using ::expm1f;
1188
Jonathan Roelofs9dc353c2014-08-27 14:05:20 +00001189inline _LIBCPP_INLINE_VISIBILITY float expm1(float __lcpp_x) _NOEXCEPT {return expm1f(__lcpp_x);}
1190inline _LIBCPP_INLINE_VISIBILITY long double expm1(long double __lcpp_x) _NOEXCEPT {return expm1l(__lcpp_x);}
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001191
1192template <class _A1>
Howard Hinnant422a53f2010-09-21 21:28:23 +00001193inline _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001194typename enable_if<is_integral<_A1>::value, double>::type
Jonathan Roelofs9dc353c2014-08-27 14:05:20 +00001195expm1(_A1 __lcpp_x) _NOEXCEPT {return expm1((double)__lcpp_x);}
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001196
1197// fdim
1198
1199using ::fdim;
1200using ::fdimf;
1201
Jonathan Roelofs9dc353c2014-08-27 14:05:20 +00001202inline _LIBCPP_INLINE_VISIBILITY float fdim(float __lcpp_x, float __lcpp_y) _NOEXCEPT {return fdimf(__lcpp_x, __lcpp_y);}
1203inline _LIBCPP_INLINE_VISIBILITY long double fdim(long double __lcpp_x, long double __lcpp_y) _NOEXCEPT {return fdiml(__lcpp_x, __lcpp_y);}
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001204
1205template <class _A1, class _A2>
Howard Hinnant422a53f2010-09-21 21:28:23 +00001206inline _LIBCPP_INLINE_VISIBILITY
Eric Fiselier950ee772014-10-17 00:31:47 +00001207typename __lazy_enable_if
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001208<
1209 is_arithmetic<_A1>::value &&
1210 is_arithmetic<_A2>::value,
Eric Fiselier950ee772014-10-17 00:31:47 +00001211 __promote<_A1, _A2>
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001212>::type
Jonathan Roelofs9dc353c2014-08-27 14:05:20 +00001213fdim(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001214{
1215 typedef typename __promote<_A1, _A2>::type __result_type;
1216 static_assert((!(is_same<_A1, __result_type>::value &&
1217 is_same<_A2, __result_type>::value)), "");
Jonathan Roelofs9dc353c2014-08-27 14:05:20 +00001218 return fdim((__result_type)__lcpp_x, (__result_type)__lcpp_y);
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001219}
1220
1221// fma
1222
Marshall Clow0d6dcb52014-03-05 17:09:51 +00001223using ::fmaf;
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001224using ::fma;
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001225
Jonathan Roelofs9dc353c2014-08-27 14:05:20 +00001226inline _LIBCPP_INLINE_VISIBILITY float fma(float __lcpp_x, float __lcpp_y, float __lcpp_z) _NOEXCEPT {return fmaf(__lcpp_x, __lcpp_y, __lcpp_z);}
1227inline _LIBCPP_INLINE_VISIBILITY long double fma(long double __lcpp_x, long double __lcpp_y, long double __lcpp_z) _NOEXCEPT {return fmal(__lcpp_x, __lcpp_y, __lcpp_z);}
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001228
1229template <class _A1, class _A2, class _A3>
Howard Hinnant422a53f2010-09-21 21:28:23 +00001230inline _LIBCPP_INLINE_VISIBILITY
Eric Fiselier950ee772014-10-17 00:31:47 +00001231typename __lazy_enable_if
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001232<
1233 is_arithmetic<_A1>::value &&
1234 is_arithmetic<_A2>::value &&
1235 is_arithmetic<_A3>::value,
Eric Fiselier950ee772014-10-17 00:31:47 +00001236 __promote<_A1, _A2, _A3>
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001237>::type
Jonathan Roelofs9dc353c2014-08-27 14:05:20 +00001238fma(_A1 __lcpp_x, _A2 __lcpp_y, _A3 __lcpp_z) _NOEXCEPT
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001239{
1240 typedef typename __promote<_A1, _A2, _A3>::type __result_type;
1241 static_assert((!(is_same<_A1, __result_type>::value &&
1242 is_same<_A2, __result_type>::value &&
1243 is_same<_A3, __result_type>::value)), "");
Jonathan Roelofs9dc353c2014-08-27 14:05:20 +00001244 return fma((__result_type)__lcpp_x, (__result_type)__lcpp_y, (__result_type)__lcpp_z);
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001245}
1246
1247// fmax
1248
1249using ::fmax;
1250using ::fmaxf;
1251
Jonathan Roelofs9dc353c2014-08-27 14:05:20 +00001252inline _LIBCPP_INLINE_VISIBILITY float fmax(float __lcpp_x, float __lcpp_y) _NOEXCEPT {return fmaxf(__lcpp_x, __lcpp_y);}
1253inline _LIBCPP_INLINE_VISIBILITY long double fmax(long double __lcpp_x, long double __lcpp_y) _NOEXCEPT {return fmaxl(__lcpp_x, __lcpp_y);}
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001254
1255template <class _A1, class _A2>
Howard Hinnant422a53f2010-09-21 21:28:23 +00001256inline _LIBCPP_INLINE_VISIBILITY
Eric Fiselier950ee772014-10-17 00:31:47 +00001257typename __lazy_enable_if
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001258<
1259 is_arithmetic<_A1>::value &&
1260 is_arithmetic<_A2>::value,
Eric Fiselier950ee772014-10-17 00:31:47 +00001261 __promote<_A1, _A2>
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001262>::type
Jonathan Roelofs9dc353c2014-08-27 14:05:20 +00001263fmax(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001264{
1265 typedef typename __promote<_A1, _A2>::type __result_type;
1266 static_assert((!(is_same<_A1, __result_type>::value &&
1267 is_same<_A2, __result_type>::value)), "");
Jonathan Roelofs9dc353c2014-08-27 14:05:20 +00001268 return fmax((__result_type)__lcpp_x, (__result_type)__lcpp_y);
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001269}
1270
1271// fmin
1272
1273using ::fmin;
1274using ::fminf;
1275
Jonathan Roelofs9dc353c2014-08-27 14:05:20 +00001276inline _LIBCPP_INLINE_VISIBILITY float fmin(float __lcpp_x, float __lcpp_y) _NOEXCEPT {return fminf(__lcpp_x, __lcpp_y);}
1277inline _LIBCPP_INLINE_VISIBILITY long double fmin(long double __lcpp_x, long double __lcpp_y) _NOEXCEPT {return fminl(__lcpp_x, __lcpp_y);}
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001278
1279template <class _A1, class _A2>
Howard Hinnant422a53f2010-09-21 21:28:23 +00001280inline _LIBCPP_INLINE_VISIBILITY
Eric Fiselier950ee772014-10-17 00:31:47 +00001281typename __lazy_enable_if
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001282<
1283 is_arithmetic<_A1>::value &&
1284 is_arithmetic<_A2>::value,
Eric Fiselier950ee772014-10-17 00:31:47 +00001285 __promote<_A1, _A2>
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001286>::type
Jonathan Roelofs9dc353c2014-08-27 14:05:20 +00001287fmin(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001288{
1289 typedef typename __promote<_A1, _A2>::type __result_type;
1290 static_assert((!(is_same<_A1, __result_type>::value &&
1291 is_same<_A2, __result_type>::value)), "");
Jonathan Roelofs9dc353c2014-08-27 14:05:20 +00001292 return fmin((__result_type)__lcpp_x, (__result_type)__lcpp_y);
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001293}
1294
1295// hypot
1296
1297using ::hypot;
1298using ::hypotf;
1299
Jonathan Roelofs9dc353c2014-08-27 14:05:20 +00001300inline _LIBCPP_INLINE_VISIBILITY float hypot(float __lcpp_x, float __lcpp_y) _NOEXCEPT {return hypotf(__lcpp_x, __lcpp_y);}
1301inline _LIBCPP_INLINE_VISIBILITY long double hypot(long double __lcpp_x, long double __lcpp_y) _NOEXCEPT {return hypotl(__lcpp_x, __lcpp_y);}
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001302
1303template <class _A1, class _A2>
Howard Hinnant422a53f2010-09-21 21:28:23 +00001304inline _LIBCPP_INLINE_VISIBILITY
Eric Fiselier950ee772014-10-17 00:31:47 +00001305typename __lazy_enable_if
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001306<
1307 is_arithmetic<_A1>::value &&
1308 is_arithmetic<_A2>::value,
Eric Fiselier950ee772014-10-17 00:31:47 +00001309 __promote<_A1, _A2>
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001310>::type
Jonathan Roelofs9dc353c2014-08-27 14:05:20 +00001311hypot(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001312{
1313 typedef typename __promote<_A1, _A2>::type __result_type;
1314 static_assert((!(is_same<_A1, __result_type>::value &&
1315 is_same<_A2, __result_type>::value)), "");
Jonathan Roelofs9dc353c2014-08-27 14:05:20 +00001316 return hypot((__result_type)__lcpp_x, (__result_type)__lcpp_y);
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001317}
1318
1319// ilogb
1320
1321using ::ilogb;
1322using ::ilogbf;
1323
Jonathan Roelofs9dc353c2014-08-27 14:05:20 +00001324inline _LIBCPP_INLINE_VISIBILITY int ilogb(float __lcpp_x) _NOEXCEPT {return ilogbf(__lcpp_x);}
1325inline _LIBCPP_INLINE_VISIBILITY int ilogb(long double __lcpp_x) _NOEXCEPT {return ilogbl(__lcpp_x);}
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001326
1327template <class _A1>
Howard Hinnant422a53f2010-09-21 21:28:23 +00001328inline _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001329typename enable_if<is_integral<_A1>::value, int>::type
Jonathan Roelofs9dc353c2014-08-27 14:05:20 +00001330ilogb(_A1 __lcpp_x) _NOEXCEPT {return ilogb((double)__lcpp_x);}
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001331
1332// lgamma
1333
1334using ::lgamma;
1335using ::lgammaf;
1336
Jonathan Roelofs9dc353c2014-08-27 14:05:20 +00001337inline _LIBCPP_INLINE_VISIBILITY float lgamma(float __lcpp_x) _NOEXCEPT {return lgammaf(__lcpp_x);}
1338inline _LIBCPP_INLINE_VISIBILITY long double lgamma(long double __lcpp_x) _NOEXCEPT {return lgammal(__lcpp_x);}
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001339
David Chisnall997e4542012-02-29 13:05:08 +00001340
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001341template <class _A1>
Howard Hinnant422a53f2010-09-21 21:28:23 +00001342inline _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001343typename enable_if<is_integral<_A1>::value, double>::type
Jonathan Roelofs9dc353c2014-08-27 14:05:20 +00001344lgamma(_A1 __lcpp_x) _NOEXCEPT {return lgamma((double)__lcpp_x);}
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001345
David Chisnall997e4542012-02-29 13:05:08 +00001346
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001347// llrint
1348
1349using ::llrint;
1350using ::llrintf;
1351
Jonathan Roelofs9dc353c2014-08-27 14:05:20 +00001352inline _LIBCPP_INLINE_VISIBILITY long long llrint(float __lcpp_x) _NOEXCEPT {return llrintf(__lcpp_x);}
1353inline _LIBCPP_INLINE_VISIBILITY long long llrint(long double __lcpp_x) _NOEXCEPT {return llrintl(__lcpp_x);}
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001354
1355template <class _A1>
Howard Hinnant422a53f2010-09-21 21:28:23 +00001356inline _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001357typename enable_if<is_integral<_A1>::value, long long>::type
Jonathan Roelofs9dc353c2014-08-27 14:05:20 +00001358llrint(_A1 __lcpp_x) _NOEXCEPT {return llrint((double)__lcpp_x);}
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001359
1360// llround
1361
1362using ::llround;
1363using ::llroundf;
1364
Jonathan Roelofs9dc353c2014-08-27 14:05:20 +00001365inline _LIBCPP_INLINE_VISIBILITY long long llround(float __lcpp_x) _NOEXCEPT {return llroundf(__lcpp_x);}
1366inline _LIBCPP_INLINE_VISIBILITY long long llround(long double __lcpp_x) _NOEXCEPT {return llroundl(__lcpp_x);}
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001367
1368template <class _A1>
Howard Hinnant422a53f2010-09-21 21:28:23 +00001369inline _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001370typename enable_if<is_integral<_A1>::value, long long>::type
Jonathan Roelofs9dc353c2014-08-27 14:05:20 +00001371llround(_A1 __lcpp_x) _NOEXCEPT {return llround((double)__lcpp_x);}
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001372
1373// log1p
1374
1375using ::log1p;
1376using ::log1pf;
1377
Jonathan Roelofs9dc353c2014-08-27 14:05:20 +00001378inline _LIBCPP_INLINE_VISIBILITY float log1p(float __lcpp_x) _NOEXCEPT {return log1pf(__lcpp_x);}
1379inline _LIBCPP_INLINE_VISIBILITY long double log1p(long double __lcpp_x) _NOEXCEPT {return log1pl(__lcpp_x);}
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001380
1381template <class _A1>
Howard Hinnant422a53f2010-09-21 21:28:23 +00001382inline _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001383typename enable_if<is_integral<_A1>::value, double>::type
Jonathan Roelofs9dc353c2014-08-27 14:05:20 +00001384log1p(_A1 __lcpp_x) _NOEXCEPT {return log1p((double)__lcpp_x);}
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001385
1386// log2
1387
1388using ::log2;
1389using ::log2f;
1390
Jonathan Roelofs9dc353c2014-08-27 14:05:20 +00001391inline _LIBCPP_INLINE_VISIBILITY float log2(float __lcpp_x) _NOEXCEPT {return log2f(__lcpp_x);}
1392inline _LIBCPP_INLINE_VISIBILITY long double log2(long double __lcpp_x) _NOEXCEPT {return log2l(__lcpp_x);}
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001393
1394template <class _A1>
Howard Hinnant422a53f2010-09-21 21:28:23 +00001395inline _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001396typename enable_if<is_integral<_A1>::value, double>::type
Jonathan Roelofs9dc353c2014-08-27 14:05:20 +00001397log2(_A1 __lcpp_x) _NOEXCEPT {return log2((double)__lcpp_x);}
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001398
1399// logb
1400
1401using ::logb;
1402using ::logbf;
1403
Jonathan Roelofs9dc353c2014-08-27 14:05:20 +00001404inline _LIBCPP_INLINE_VISIBILITY float logb(float __lcpp_x) _NOEXCEPT {return logbf(__lcpp_x);}
1405inline _LIBCPP_INLINE_VISIBILITY long double logb(long double __lcpp_x) _NOEXCEPT {return logbl(__lcpp_x);}
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001406
1407template <class _A1>
Howard Hinnant422a53f2010-09-21 21:28:23 +00001408inline _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001409typename enable_if<is_integral<_A1>::value, double>::type
Jonathan Roelofs9dc353c2014-08-27 14:05:20 +00001410logb(_A1 __lcpp_x) _NOEXCEPT {return logb((double)__lcpp_x);}
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001411
1412// lrint
1413
1414using ::lrint;
1415using ::lrintf;
1416
Jonathan Roelofs9dc353c2014-08-27 14:05:20 +00001417inline _LIBCPP_INLINE_VISIBILITY long lrint(float __lcpp_x) _NOEXCEPT {return lrintf(__lcpp_x);}
1418inline _LIBCPP_INLINE_VISIBILITY long lrint(long double __lcpp_x) _NOEXCEPT {return lrintl(__lcpp_x);}
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001419
1420template <class _A1>
Howard Hinnant422a53f2010-09-21 21:28:23 +00001421inline _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001422typename enable_if<is_integral<_A1>::value, long>::type
Jonathan Roelofs9dc353c2014-08-27 14:05:20 +00001423lrint(_A1 __lcpp_x) _NOEXCEPT {return lrint((double)__lcpp_x);}
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001424
1425// lround
1426
1427using ::lround;
1428using ::lroundf;
1429
Jonathan Roelofs9dc353c2014-08-27 14:05:20 +00001430inline _LIBCPP_INLINE_VISIBILITY long lround(float __lcpp_x) _NOEXCEPT {return lroundf(__lcpp_x);}
1431inline _LIBCPP_INLINE_VISIBILITY long lround(long double __lcpp_x) _NOEXCEPT {return lroundl(__lcpp_x);}
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001432
1433template <class _A1>
Howard Hinnant422a53f2010-09-21 21:28:23 +00001434inline _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001435typename enable_if<is_integral<_A1>::value, long>::type
Jonathan Roelofs9dc353c2014-08-27 14:05:20 +00001436lround(_A1 __lcpp_x) _NOEXCEPT {return lround((double)__lcpp_x);}
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001437
Howard Hinnante9df0a52013-08-01 18:17:34 +00001438#endif // _LIBCPP_MSVCRT
David Chisnall997e4542012-02-29 13:05:08 +00001439#endif // __sun__
Howard Hinnante9df0a52013-08-01 18:17:34 +00001440
1441// nan
1442
1443#ifndef _LIBCPP_MSVCRT
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001444using ::nan;
1445using ::nanf;
Howard Hinnante9df0a52013-08-01 18:17:34 +00001446#endif // _LIBCPP_MSVCRT
1447
David Chisnall997e4542012-02-29 13:05:08 +00001448#ifndef __sun__
Howard Hinnante9df0a52013-08-01 18:17:34 +00001449#ifndef _LIBCPP_MSVCRT
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001450
1451// nearbyint
1452
1453using ::nearbyint;
1454using ::nearbyintf;
1455
Jonathan Roelofs9dc353c2014-08-27 14:05:20 +00001456inline _LIBCPP_INLINE_VISIBILITY float nearbyint(float __lcpp_x) _NOEXCEPT {return nearbyintf(__lcpp_x);}
1457inline _LIBCPP_INLINE_VISIBILITY long double nearbyint(long double __lcpp_x) _NOEXCEPT {return nearbyintl(__lcpp_x);}
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001458
1459template <class _A1>
Howard Hinnant422a53f2010-09-21 21:28:23 +00001460inline _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001461typename enable_if<is_integral<_A1>::value, double>::type
Jonathan Roelofs9dc353c2014-08-27 14:05:20 +00001462nearbyint(_A1 __lcpp_x) _NOEXCEPT {return nearbyint((double)__lcpp_x);}
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001463
1464// nextafter
1465
1466using ::nextafter;
1467using ::nextafterf;
1468
Jonathan Roelofs9dc353c2014-08-27 14:05:20 +00001469inline _LIBCPP_INLINE_VISIBILITY float nextafter(float __lcpp_x, float __lcpp_y) _NOEXCEPT {return nextafterf(__lcpp_x, __lcpp_y);}
1470inline _LIBCPP_INLINE_VISIBILITY long double nextafter(long double __lcpp_x, long double __lcpp_y) _NOEXCEPT {return nextafterl(__lcpp_x, __lcpp_y);}
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001471
1472template <class _A1, class _A2>
Howard Hinnant422a53f2010-09-21 21:28:23 +00001473inline _LIBCPP_INLINE_VISIBILITY
Eric Fiselier950ee772014-10-17 00:31:47 +00001474typename __lazy_enable_if
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001475<
1476 is_arithmetic<_A1>::value &&
1477 is_arithmetic<_A2>::value,
Eric Fiselier950ee772014-10-17 00:31:47 +00001478 __promote<_A1, _A2>
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001479>::type
Jonathan Roelofs9dc353c2014-08-27 14:05:20 +00001480nextafter(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001481{
1482 typedef typename __promote<_A1, _A2>::type __result_type;
1483 static_assert((!(is_same<_A1, __result_type>::value &&
1484 is_same<_A2, __result_type>::value)), "");
Jonathan Roelofs9dc353c2014-08-27 14:05:20 +00001485 return nextafter((__result_type)__lcpp_x, (__result_type)__lcpp_y);
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001486}
1487
1488// nexttoward
1489
1490using ::nexttoward;
1491using ::nexttowardf;
1492
Jonathan Roelofs9dc353c2014-08-27 14:05:20 +00001493inline _LIBCPP_INLINE_VISIBILITY float nexttoward(float __lcpp_x, long double __lcpp_y) _NOEXCEPT {return nexttowardf(__lcpp_x, __lcpp_y);}
1494inline _LIBCPP_INLINE_VISIBILITY long double nexttoward(long double __lcpp_x, long double __lcpp_y) _NOEXCEPT {return nexttowardl(__lcpp_x, __lcpp_y);}
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001495
1496template <class _A1>
Howard Hinnant422a53f2010-09-21 21:28:23 +00001497inline _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001498typename enable_if<is_integral<_A1>::value, double>::type
Jonathan Roelofs9dc353c2014-08-27 14:05:20 +00001499nexttoward(_A1 __lcpp_x, long double __lcpp_y) _NOEXCEPT {return nexttoward((double)__lcpp_x, __lcpp_y);}
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001500
1501// remainder
1502
1503using ::remainder;
1504using ::remainderf;
1505
Jonathan Roelofs9dc353c2014-08-27 14:05:20 +00001506inline _LIBCPP_INLINE_VISIBILITY float remainder(float __lcpp_x, float __lcpp_y) _NOEXCEPT {return remainderf(__lcpp_x, __lcpp_y);}
1507inline _LIBCPP_INLINE_VISIBILITY long double remainder(long double __lcpp_x, long double __lcpp_y) _NOEXCEPT {return remainderl(__lcpp_x, __lcpp_y);}
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001508
1509template <class _A1, class _A2>
Howard Hinnant422a53f2010-09-21 21:28:23 +00001510inline _LIBCPP_INLINE_VISIBILITY
Eric Fiselier950ee772014-10-17 00:31:47 +00001511typename __lazy_enable_if
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001512<
1513 is_arithmetic<_A1>::value &&
1514 is_arithmetic<_A2>::value,
Eric Fiselier950ee772014-10-17 00:31:47 +00001515 __promote<_A1, _A2>
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001516>::type
Jonathan Roelofs9dc353c2014-08-27 14:05:20 +00001517remainder(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001518{
1519 typedef typename __promote<_A1, _A2>::type __result_type;
1520 static_assert((!(is_same<_A1, __result_type>::value &&
1521 is_same<_A2, __result_type>::value)), "");
Jonathan Roelofs9dc353c2014-08-27 14:05:20 +00001522 return remainder((__result_type)__lcpp_x, (__result_type)__lcpp_y);
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001523}
1524
1525// remquo
1526
1527using ::remquo;
1528using ::remquof;
1529
Jonathan Roelofs9dc353c2014-08-27 14:05:20 +00001530inline _LIBCPP_INLINE_VISIBILITY float remquo(float __lcpp_x, float __lcpp_y, int* __lcpp_z) _NOEXCEPT {return remquof(__lcpp_x, __lcpp_y, __lcpp_z);}
1531inline _LIBCPP_INLINE_VISIBILITY long double remquo(long double __lcpp_x, long double __lcpp_y, int* __lcpp_z) _NOEXCEPT {return remquol(__lcpp_x, __lcpp_y, __lcpp_z);}
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001532
1533template <class _A1, class _A2>
Howard Hinnant422a53f2010-09-21 21:28:23 +00001534inline _LIBCPP_INLINE_VISIBILITY
Eric Fiselier950ee772014-10-17 00:31:47 +00001535typename __lazy_enable_if
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001536<
1537 is_arithmetic<_A1>::value &&
1538 is_arithmetic<_A2>::value,
Eric Fiselier950ee772014-10-17 00:31:47 +00001539 __promote<_A1, _A2>
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001540>::type
Jonathan Roelofs9dc353c2014-08-27 14:05:20 +00001541remquo(_A1 __lcpp_x, _A2 __lcpp_y, int* __lcpp_z) _NOEXCEPT
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001542{
1543 typedef typename __promote<_A1, _A2>::type __result_type;
1544 static_assert((!(is_same<_A1, __result_type>::value &&
1545 is_same<_A2, __result_type>::value)), "");
Jonathan Roelofs9dc353c2014-08-27 14:05:20 +00001546 return remquo((__result_type)__lcpp_x, (__result_type)__lcpp_y, __lcpp_z);
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001547}
1548
1549// rint
1550
1551using ::rint;
1552using ::rintf;
1553
Jonathan Roelofs9dc353c2014-08-27 14:05:20 +00001554inline _LIBCPP_INLINE_VISIBILITY float rint(float __lcpp_x) _NOEXCEPT {return rintf(__lcpp_x);}
1555inline _LIBCPP_INLINE_VISIBILITY long double rint(long double __lcpp_x) _NOEXCEPT {return rintl(__lcpp_x);}
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001556
1557template <class _A1>
Howard Hinnant422a53f2010-09-21 21:28:23 +00001558inline _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001559typename enable_if<is_integral<_A1>::value, double>::type
Jonathan Roelofs9dc353c2014-08-27 14:05:20 +00001560rint(_A1 __lcpp_x) _NOEXCEPT {return rint((double)__lcpp_x);}
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001561
1562// round
1563
1564using ::round;
1565using ::roundf;
1566
Jonathan Roelofs9dc353c2014-08-27 14:05:20 +00001567inline _LIBCPP_INLINE_VISIBILITY float round(float __lcpp_x) _NOEXCEPT {return roundf(__lcpp_x);}
1568inline _LIBCPP_INLINE_VISIBILITY long double round(long double __lcpp_x) _NOEXCEPT {return roundl(__lcpp_x);}
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001569
1570template <class _A1>
Howard Hinnant422a53f2010-09-21 21:28:23 +00001571inline _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001572typename enable_if<is_integral<_A1>::value, double>::type
Jonathan Roelofs9dc353c2014-08-27 14:05:20 +00001573round(_A1 __lcpp_x) _NOEXCEPT {return round((double)__lcpp_x);}
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001574
1575// scalbln
1576
1577using ::scalbln;
1578using ::scalblnf;
1579
Jonathan Roelofs9dc353c2014-08-27 14:05:20 +00001580inline _LIBCPP_INLINE_VISIBILITY float scalbln(float __lcpp_x, long __lcpp_y) _NOEXCEPT {return scalblnf(__lcpp_x, __lcpp_y);}
1581inline _LIBCPP_INLINE_VISIBILITY long double scalbln(long double __lcpp_x, long __lcpp_y) _NOEXCEPT {return scalblnl(__lcpp_x, __lcpp_y);}
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001582
1583template <class _A1>
Howard Hinnant422a53f2010-09-21 21:28:23 +00001584inline _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001585typename enable_if<is_integral<_A1>::value, double>::type
Jonathan Roelofs9dc353c2014-08-27 14:05:20 +00001586scalbln(_A1 __lcpp_x, long __lcpp_y) _NOEXCEPT {return scalbln((double)__lcpp_x, __lcpp_y);}
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001587
1588// scalbn
1589
1590using ::scalbn;
1591using ::scalbnf;
1592
Jonathan Roelofs9dc353c2014-08-27 14:05:20 +00001593inline _LIBCPP_INLINE_VISIBILITY float scalbn(float __lcpp_x, int __lcpp_y) _NOEXCEPT {return scalbnf(__lcpp_x, __lcpp_y);}
1594inline _LIBCPP_INLINE_VISIBILITY long double scalbn(long double __lcpp_x, int __lcpp_y) _NOEXCEPT {return scalbnl(__lcpp_x, __lcpp_y);}
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001595
1596template <class _A1>
Howard Hinnant422a53f2010-09-21 21:28:23 +00001597inline _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001598typename enable_if<is_integral<_A1>::value, double>::type
Jonathan Roelofs9dc353c2014-08-27 14:05:20 +00001599scalbn(_A1 __lcpp_x, int __lcpp_y) _NOEXCEPT {return scalbn((double)__lcpp_x, __lcpp_y);}
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001600
1601// tgamma
1602
1603using ::tgamma;
1604using ::tgammaf;
1605
Jonathan Roelofs9dc353c2014-08-27 14:05:20 +00001606inline _LIBCPP_INLINE_VISIBILITY float tgamma(float __lcpp_x) _NOEXCEPT {return tgammaf(__lcpp_x);}
1607inline _LIBCPP_INLINE_VISIBILITY long double tgamma(long double __lcpp_x) _NOEXCEPT {return tgammal(__lcpp_x);}
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001608
1609template <class _A1>
Howard Hinnant422a53f2010-09-21 21:28:23 +00001610inline _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001611typename enable_if<is_integral<_A1>::value, double>::type
Jonathan Roelofs9dc353c2014-08-27 14:05:20 +00001612tgamma(_A1 __lcpp_x) _NOEXCEPT {return tgamma((double)__lcpp_x);}
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001613
1614// trunc
1615
1616using ::trunc;
1617using ::truncf;
1618
Jonathan Roelofs9dc353c2014-08-27 14:05:20 +00001619inline _LIBCPP_INLINE_VISIBILITY float trunc(float __lcpp_x) _NOEXCEPT {return truncf(__lcpp_x);}
1620inline _LIBCPP_INLINE_VISIBILITY long double trunc(long double __lcpp_x) _NOEXCEPT {return truncl(__lcpp_x);}
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001621
1622template <class _A1>
Howard Hinnant422a53f2010-09-21 21:28:23 +00001623inline _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001624typename enable_if<is_integral<_A1>::value, double>::type
Jonathan Roelofs9dc353c2014-08-27 14:05:20 +00001625trunc(_A1 __lcpp_x) _NOEXCEPT {return trunc((double)__lcpp_x);}
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001626
Howard Hinnante9df0a52013-08-01 18:17:34 +00001627#endif // !_LIBCPP_MSVCRT
Howard Hinnant9f8884e2011-10-27 16:24:42 +00001628
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001629using ::acosl;
1630using ::asinl;
1631using ::atanl;
1632using ::atan2l;
1633using ::ceill;
1634using ::cosl;
1635using ::coshl;
1636using ::expl;
1637using ::fabsl;
1638using ::floorl;
1639using ::fmodl;
1640using ::frexpl;
1641using ::ldexpl;
1642using ::logl;
1643using ::log10l;
1644using ::modfl;
1645using ::powl;
1646using ::sinl;
1647using ::sinhl;
1648using ::sqrtl;
1649using ::tanl;
Howard Hinnante9df0a52013-08-01 18:17:34 +00001650#ifndef _LIBCPP_MSVCRT
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001651using ::tanhl;
1652using ::acoshl;
1653using ::asinhl;
1654using ::atanhl;
1655using ::cbrtl;
Howard Hinnante9df0a52013-08-01 18:17:34 +00001656#endif // !_LIBCPP_MSVCRT
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001657using ::copysignl;
Howard Hinnante9df0a52013-08-01 18:17:34 +00001658#ifndef _LIBCPP_MSVCRT
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001659using ::erfl;
1660using ::erfcl;
1661using ::exp2l;
1662using ::expm1l;
1663using ::fdiml;
1664using ::fmal;
1665using ::fmaxl;
1666using ::fminl;
1667using ::hypotl;
1668using ::ilogbl;
1669using ::lgammal;
1670using ::llrintl;
1671using ::llroundl;
1672using ::log1pl;
1673using ::log2l;
1674using ::logbl;
1675using ::lrintl;
1676using ::lroundl;
1677using ::nanl;
1678using ::nearbyintl;
1679using ::nextafterl;
1680using ::nexttowardl;
1681using ::remainderl;
1682using ::remquol;
1683using ::rintl;
1684using ::roundl;
1685using ::scalblnl;
1686using ::scalbnl;
1687using ::tgammal;
1688using ::truncl;
Howard Hinnante9df0a52013-08-01 18:17:34 +00001689#endif // !_LIBCPP_MSVCRT
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001690
David Chisnall997e4542012-02-29 13:05:08 +00001691#else
1692using ::lgamma;
1693using ::lgammaf;
1694#endif // __sun__
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001695_LIBCPP_END_NAMESPACE_STD
1696
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001697#endif // _LIBCPP_CMATH