blob: d3fbfe6d23f6bd525d8f4d666aba5794c0db0cdb [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
140bool signbit(floating_point x);
141
142int fpclassify(floating_point x);
143
Howard Hinnant324bb032010-08-22 00:02:43 +0000144bool isfinite(floating_point x);
145bool isinf(floating_point x);
146bool isnan(floating_point x);
147bool isnormal(floating_point x);
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000148
Howard Hinnant324bb032010-08-22 00:02:43 +0000149bool isgreater(floating_point x, floating_point y);
150bool isgreaterequal(floating_point x, floating_point y);
151bool isless(floating_point x, floating_point y);
152bool islessequal(floating_point x, floating_point y);
153bool islessgreater(floating_point x, floating_point y);
154bool isunordered(floating_point x, floating_point 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 Hinnant9f8884e2011-10-27 16:24:42 +0000304#ifdef _MSC_VER
305#include "support/win32/math_win32.h"
306#endif
307
Howard Hinnant08e17472011-10-17 20:05:10 +0000308#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000309#pragma GCC system_header
Howard Hinnant08e17472011-10-17 20:05:10 +0000310#endif
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000311
Howard Hinnant0a111112011-05-13 21:52:40 +0000312// signbit
313
314#ifdef signbit
315
316template <class _A1>
317_LIBCPP_ALWAYS_INLINE
318bool
Howard Hinnantcac0c462012-07-06 19:13:50 +0000319__libcpp_signbit(_A1 __x) _NOEXCEPT
Howard Hinnant0a111112011-05-13 21:52:40 +0000320{
321 return signbit(__x);
322}
323
324#undef signbit
325
326template <class _A1>
327inline _LIBCPP_INLINE_VISIBILITY
328typename std::enable_if<std::is_floating_point<_A1>::value, bool>::type
Howard Hinnantcac0c462012-07-06 19:13:50 +0000329signbit(_A1 __x) _NOEXCEPT
Howard Hinnant0a111112011-05-13 21:52:40 +0000330{
331 return __libcpp_signbit(__x);
332}
333
334#endif // signbit
335
336// fpclassify
337
338#ifdef fpclassify
339
340template <class _A1>
341_LIBCPP_ALWAYS_INLINE
342int
Howard Hinnantcac0c462012-07-06 19:13:50 +0000343__libcpp_fpclassify(_A1 __x) _NOEXCEPT
Howard Hinnant0a111112011-05-13 21:52:40 +0000344{
345 return fpclassify(__x);
346}
347
348#undef fpclassify
349
350template <class _A1>
351inline _LIBCPP_INLINE_VISIBILITY
352typename std::enable_if<std::is_floating_point<_A1>::value, int>::type
Howard Hinnantcac0c462012-07-06 19:13:50 +0000353fpclassify(_A1 __x) _NOEXCEPT
Howard Hinnant0a111112011-05-13 21:52:40 +0000354{
355 return __libcpp_fpclassify(__x);
356}
357
358#endif // fpclassify
359
360// isfinite
361
362#ifdef isfinite
363
364template <class _A1>
365_LIBCPP_ALWAYS_INLINE
366bool
Howard Hinnantcac0c462012-07-06 19:13:50 +0000367__libcpp_isfinite(_A1 __x) _NOEXCEPT
Howard Hinnant0a111112011-05-13 21:52:40 +0000368{
369 return isfinite(__x);
370}
371
372#undef isfinite
373
374template <class _A1>
375inline _LIBCPP_INLINE_VISIBILITY
376typename std::enable_if<std::is_floating_point<_A1>::value, bool>::type
Howard Hinnantcac0c462012-07-06 19:13:50 +0000377isfinite(_A1 __x) _NOEXCEPT
Howard Hinnant0a111112011-05-13 21:52:40 +0000378{
379 return __libcpp_isfinite(__x);
380}
381
382#endif // isfinite
383
384// isinf
385
386#ifdef isinf
387
388template <class _A1>
389_LIBCPP_ALWAYS_INLINE
390bool
Howard Hinnantcac0c462012-07-06 19:13:50 +0000391__libcpp_isinf(_A1 __x) _NOEXCEPT
Howard Hinnant0a111112011-05-13 21:52:40 +0000392{
393 return isinf(__x);
394}
395
396#undef isinf
397
398template <class _A1>
399inline _LIBCPP_INLINE_VISIBILITY
400typename std::enable_if<std::is_floating_point<_A1>::value, bool>::type
Howard Hinnantcac0c462012-07-06 19:13:50 +0000401isinf(_A1 __x) _NOEXCEPT
Howard Hinnant0a111112011-05-13 21:52:40 +0000402{
403 return __libcpp_isinf(__x);
404}
405
406#endif // isinf
407
408// isnan
409
410#ifdef isnan
411
412template <class _A1>
413_LIBCPP_ALWAYS_INLINE
414bool
Howard Hinnantcac0c462012-07-06 19:13:50 +0000415__libcpp_isnan(_A1 __x) _NOEXCEPT
Howard Hinnant0a111112011-05-13 21:52:40 +0000416{
417 return isnan(__x);
418}
419
420#undef isnan
421
422template <class _A1>
423inline _LIBCPP_INLINE_VISIBILITY
424typename std::enable_if<std::is_floating_point<_A1>::value, bool>::type
Howard Hinnantcac0c462012-07-06 19:13:50 +0000425isnan(_A1 __x) _NOEXCEPT
Howard Hinnant0a111112011-05-13 21:52:40 +0000426{
427 return __libcpp_isnan(__x);
428}
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:50 +0000439__libcpp_isnormal(_A1 __x) _NOEXCEPT
Howard Hinnant0a111112011-05-13 21:52:40 +0000440{
441 return isnormal(__x);
442}
443
444#undef isnormal
445
446template <class _A1>
447inline _LIBCPP_INLINE_VISIBILITY
448typename std::enable_if<std::is_floating_point<_A1>::value, bool>::type
Howard Hinnantcac0c462012-07-06 19:13:50 +0000449isnormal(_A1 __x) _NOEXCEPT
Howard Hinnant0a111112011-05-13 21:52:40 +0000450{
451 return __libcpp_isnormal(__x);
452}
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:50 +0000463__libcpp_isgreater(_A1 __x, _A2 __y) _NOEXCEPT
Howard Hinnant0a111112011-05-13 21:52:40 +0000464{
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<
474 std::is_floating_point<_A1>::value &&
475 std::is_floating_point<_A2>::value,
476 bool
477>::type
Howard Hinnantcac0c462012-07-06 19:13:50 +0000478isgreater(_A1 __x, _A2 __y) _NOEXCEPT
Howard Hinnant0a111112011-05-13 21:52:40 +0000479{
480 return __libcpp_isgreater(__x, __y);
481}
482
483#endif // isgreater
484
485// isgreaterequal
486
487#ifdef isgreaterequal
488
489template <class _A1, class _A2>
490_LIBCPP_ALWAYS_INLINE
491bool
Howard Hinnantcac0c462012-07-06 19:13:50 +0000492__libcpp_isgreaterequal(_A1 __x, _A2 __y) _NOEXCEPT
Howard Hinnant0a111112011-05-13 21:52:40 +0000493{
494 return isgreaterequal(__x, __y);
495}
496
497#undef isgreaterequal
498
499template <class _A1, class _A2>
500inline _LIBCPP_INLINE_VISIBILITY
501typename std::enable_if
502<
503 std::is_floating_point<_A1>::value &&
504 std::is_floating_point<_A2>::value,
505 bool
506>::type
Howard Hinnantcac0c462012-07-06 19:13:50 +0000507isgreaterequal(_A1 __x, _A2 __y) _NOEXCEPT
Howard Hinnant0a111112011-05-13 21:52:40 +0000508{
509 return __libcpp_isgreaterequal(__x, __y);
510}
511
512#endif // isgreaterequal
513
514// isless
515
516#ifdef isless
517
518template <class _A1, class _A2>
519_LIBCPP_ALWAYS_INLINE
520bool
Howard Hinnantcac0c462012-07-06 19:13:50 +0000521__libcpp_isless(_A1 __x, _A2 __y) _NOEXCEPT
Howard Hinnant0a111112011-05-13 21:52:40 +0000522{
523 return isless(__x, __y);
524}
525
526#undef isless
527
528template <class _A1, class _A2>
529inline _LIBCPP_INLINE_VISIBILITY
530typename std::enable_if
531<
532 std::is_floating_point<_A1>::value &&
533 std::is_floating_point<_A2>::value,
534 bool
535>::type
Howard Hinnantcac0c462012-07-06 19:13:50 +0000536isless(_A1 __x, _A2 __y) _NOEXCEPT
Howard Hinnant0a111112011-05-13 21:52:40 +0000537{
538 return __libcpp_isless(__x, __y);
539}
540
541#endif // isless
542
543// islessequal
544
545#ifdef islessequal
546
547template <class _A1, class _A2>
548_LIBCPP_ALWAYS_INLINE
549bool
Howard Hinnantcac0c462012-07-06 19:13:50 +0000550__libcpp_islessequal(_A1 __x, _A2 __y) _NOEXCEPT
Howard Hinnant0a111112011-05-13 21:52:40 +0000551{
552 return islessequal(__x, __y);
553}
554
555#undef islessequal
556
557template <class _A1, class _A2>
558inline _LIBCPP_INLINE_VISIBILITY
559typename std::enable_if
560<
561 std::is_floating_point<_A1>::value &&
562 std::is_floating_point<_A2>::value,
563 bool
564>::type
Howard Hinnantcac0c462012-07-06 19:13:50 +0000565islessequal(_A1 __x, _A2 __y) _NOEXCEPT
Howard Hinnant0a111112011-05-13 21:52:40 +0000566{
567 return __libcpp_islessequal(__x, __y);
568}
569
570#endif // islessequal
571
572// islessgreater
573
574#ifdef islessgreater
575
576template <class _A1, class _A2>
577_LIBCPP_ALWAYS_INLINE
578bool
Howard Hinnantcac0c462012-07-06 19:13:50 +0000579__libcpp_islessgreater(_A1 __x, _A2 __y) _NOEXCEPT
Howard Hinnant0a111112011-05-13 21:52:40 +0000580{
581 return islessgreater(__x, __y);
582}
583
584#undef islessgreater
585
586template <class _A1, class _A2>
587inline _LIBCPP_INLINE_VISIBILITY
588typename std::enable_if
589<
590 std::is_floating_point<_A1>::value &&
591 std::is_floating_point<_A2>::value,
592 bool
593>::type
Howard Hinnantcac0c462012-07-06 19:13:50 +0000594islessgreater(_A1 __x, _A2 __y) _NOEXCEPT
Howard Hinnant0a111112011-05-13 21:52:40 +0000595{
596 return __libcpp_islessgreater(__x, __y);
597}
598
599#endif // islessgreater
600
601// isunordered
602
603#ifdef isunordered
604
605template <class _A1, class _A2>
606_LIBCPP_ALWAYS_INLINE
607bool
Howard Hinnantcac0c462012-07-06 19:13:50 +0000608__libcpp_isunordered(_A1 __x, _A2 __y) _NOEXCEPT
Howard Hinnant0a111112011-05-13 21:52:40 +0000609{
610 return isunordered(__x, __y);
611}
612
613#undef isunordered
614
615template <class _A1, class _A2>
616inline _LIBCPP_INLINE_VISIBILITY
617typename std::enable_if
618<
619 std::is_floating_point<_A1>::value &&
620 std::is_floating_point<_A2>::value,
621 bool
622>::type
Howard Hinnantcac0c462012-07-06 19:13:50 +0000623isunordered(_A1 __x, _A2 __y) _NOEXCEPT
Howard Hinnant0a111112011-05-13 21:52:40 +0000624{
625 return __libcpp_isunordered(__x, __y);
626}
627
628#endif // isunordered
629
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000630_LIBCPP_BEGIN_NAMESPACE_STD
631
Howard Hinnant0a111112011-05-13 21:52:40 +0000632using ::signbit;
633using ::fpclassify;
634using ::isfinite;
635using ::isinf;
636using ::isnan;
637using ::isnormal;
638using ::isgreater;
639using ::isgreaterequal;
640using ::isless;
641using ::islessequal;
642using ::islessgreater;
643using ::isunordered;
644using ::isunordered;
645
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000646using ::float_t;
647using ::double_t;
648
649// abs
650
Howard Hinnant422a53f2010-09-21 21:28:23 +0000651inline _LIBCPP_INLINE_VISIBILITY
Howard Hinnantf07a5292012-05-03 14:58:34 +0000652float
Howard Hinnantcac0c462012-07-06 19:13:50 +0000653abs(float __x) _NOEXCEPT {return fabsf(__x);}
Howard Hinnantf07a5292012-05-03 14:58:34 +0000654
655inline _LIBCPP_INLINE_VISIBILITY
656double
Howard Hinnantcac0c462012-07-06 19:13:50 +0000657abs(double __x) _NOEXCEPT {return fabs(__x);}
Howard Hinnantf07a5292012-05-03 14:58:34 +0000658
659inline _LIBCPP_INLINE_VISIBILITY
660long double
Howard Hinnantcac0c462012-07-06 19:13:50 +0000661abs(long double __x) _NOEXCEPT {return fabsl(__x);}
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000662
David Chisnall997e4542012-02-29 13:05:08 +0000663#ifndef __sun__
664
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000665// acos
666
667using ::acos;
668using ::acosf;
669
Howard Hinnant9f8884e2011-10-27 16:24:42 +0000670#ifndef _MSC_VER
Howard Hinnantcac0c462012-07-06 19:13:50 +0000671inline _LIBCPP_INLINE_VISIBILITY float acos(float __x) _NOEXCEPT {return acosf(__x);}
672inline _LIBCPP_INLINE_VISIBILITY long double acos(long double __x) _NOEXCEPT {return acosl(__x);}
Howard Hinnant9f8884e2011-10-27 16:24:42 +0000673#endif
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000674
675template <class _A1>
Howard Hinnant422a53f2010-09-21 21:28:23 +0000676inline _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000677typename enable_if<is_integral<_A1>::value, double>::type
Howard Hinnantcac0c462012-07-06 19:13:50 +0000678acos(_A1 __x) _NOEXCEPT {return acos((double)__x);}
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000679
680// asin
681
682using ::asin;
683using ::asinf;
684
Howard Hinnant9f8884e2011-10-27 16:24:42 +0000685#ifndef _MSC_VER
Howard Hinnantcac0c462012-07-06 19:13:50 +0000686inline _LIBCPP_INLINE_VISIBILITY float asin(float __x) _NOEXCEPT {return asinf(__x);}
687inline _LIBCPP_INLINE_VISIBILITY long double asin(long double __x) _NOEXCEPT {return asinl(__x);}
Howard Hinnant9f8884e2011-10-27 16:24:42 +0000688#endif
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000689
690template <class _A1>
Howard Hinnant422a53f2010-09-21 21:28:23 +0000691inline _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000692typename enable_if<is_integral<_A1>::value, double>::type
Howard Hinnantcac0c462012-07-06 19:13:50 +0000693asin(_A1 __x) _NOEXCEPT {return asin((double)__x);}
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000694
695// atan
696
697using ::atan;
698using ::atanf;
699
Howard Hinnant9f8884e2011-10-27 16:24:42 +0000700#ifndef _MSC_VER
Howard Hinnantcac0c462012-07-06 19:13:50 +0000701inline _LIBCPP_INLINE_VISIBILITY float atan(float __x) _NOEXCEPT {return atanf(__x);}
702inline _LIBCPP_INLINE_VISIBILITY long double atan(long double __x) _NOEXCEPT {return atanl(__x);}
Howard Hinnant9f8884e2011-10-27 16:24:42 +0000703#endif
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000704
705template <class _A1>
Howard Hinnant422a53f2010-09-21 21:28:23 +0000706inline _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000707typename enable_if<is_integral<_A1>::value, double>::type
Howard Hinnantcac0c462012-07-06 19:13:50 +0000708atan(_A1 __x) _NOEXCEPT {return atan((double)__x);}
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000709
710// atan2
711
712using ::atan2;
713using ::atan2f;
714
Howard Hinnant9f8884e2011-10-27 16:24:42 +0000715#ifndef _MSC_VER
Howard Hinnantcac0c462012-07-06 19:13:50 +0000716inline _LIBCPP_INLINE_VISIBILITY float atan2(float __y, float __x) _NOEXCEPT {return atan2f(__y, __x);}
717inline _LIBCPP_INLINE_VISIBILITY long double atan2(long double __y, long double __x) _NOEXCEPT {return atan2l(__y, __x);}
Howard Hinnant9f8884e2011-10-27 16:24:42 +0000718#endif
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000719
720template <class _A1, class _A2>
Howard Hinnant422a53f2010-09-21 21:28:23 +0000721inline _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000722typename enable_if
723<
724 is_arithmetic<_A1>::value &&
725 is_arithmetic<_A2>::value,
726 typename __promote<_A1, _A2>::type
727>::type
Howard Hinnantcac0c462012-07-06 19:13:50 +0000728atan2(_A1 __y, _A2 __x) _NOEXCEPT
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000729{
730 typedef typename __promote<_A1, _A2>::type __result_type;
731 static_assert((!(is_same<_A1, __result_type>::value &&
732 is_same<_A2, __result_type>::value)), "");
733 return atan2((__result_type)__y, (__result_type)__x);
734}
735
736// ceil
737
738using ::ceil;
739using ::ceilf;
740
Howard Hinnant9f8884e2011-10-27 16:24:42 +0000741#ifndef _MSC_VER
Howard Hinnantcac0c462012-07-06 19:13:50 +0000742inline _LIBCPP_INLINE_VISIBILITY float ceil(float __x) _NOEXCEPT {return ceilf(__x);}
743inline _LIBCPP_INLINE_VISIBILITY long double ceil(long double __x) _NOEXCEPT {return ceill(__x);}
Howard Hinnant9f8884e2011-10-27 16:24:42 +0000744#endif
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000745
746template <class _A1>
Howard Hinnant422a53f2010-09-21 21:28:23 +0000747inline _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000748typename enable_if<is_integral<_A1>::value, double>::type
Howard Hinnantcac0c462012-07-06 19:13:50 +0000749ceil(_A1 __x) _NOEXCEPT {return ceil((double)__x);}
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000750
751// cos
752
753using ::cos;
754using ::cosf;
755
Howard Hinnant9f8884e2011-10-27 16:24:42 +0000756#ifndef _MSC_VER
Howard Hinnantcac0c462012-07-06 19:13:50 +0000757inline _LIBCPP_INLINE_VISIBILITY float cos(float __x) _NOEXCEPT {return cosf(__x);}
758inline _LIBCPP_INLINE_VISIBILITY long double cos(long double __x) _NOEXCEPT {return cosl(__x);}
Howard Hinnant9f8884e2011-10-27 16:24:42 +0000759#endif
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000760
761template <class _A1>
Howard Hinnant422a53f2010-09-21 21:28:23 +0000762inline _LIBCPP_ALWAYS_INLINE _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000763typename enable_if<is_integral<_A1>::value, double>::type
Howard Hinnantcac0c462012-07-06 19:13:50 +0000764cos(_A1 __x) _NOEXCEPT {return cos((double)__x);}
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000765
766// cosh
767
768using ::cosh;
769using ::coshf;
770
Howard Hinnant9f8884e2011-10-27 16:24:42 +0000771#ifndef _MSC_VER
Howard Hinnantcac0c462012-07-06 19:13:50 +0000772inline _LIBCPP_INLINE_VISIBILITY float cosh(float __x) _NOEXCEPT {return coshf(__x);}
773inline _LIBCPP_INLINE_VISIBILITY long double cosh(long double __x) _NOEXCEPT {return coshl(__x);}
Howard Hinnant9f8884e2011-10-27 16:24:42 +0000774#endif
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000775
776template <class _A1>
Howard Hinnant422a53f2010-09-21 21:28:23 +0000777inline _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000778typename enable_if<is_integral<_A1>::value, double>::type
Howard Hinnantcac0c462012-07-06 19:13:50 +0000779cosh(_A1 __x) _NOEXCEPT {return cosh((double)__x);}
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000780
David Chisnall997e4542012-02-29 13:05:08 +0000781#endif // __sun__
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000782// exp
783
784using ::exp;
785using ::expf;
786
David Chisnall997e4542012-02-29 13:05:08 +0000787#ifndef __sun__
788
Howard Hinnant9f8884e2011-10-27 16:24:42 +0000789#ifndef _MSC_VER
Howard Hinnantcac0c462012-07-06 19:13:50 +0000790inline _LIBCPP_INLINE_VISIBILITY float exp(float __x) _NOEXCEPT {return expf(__x);}
791inline _LIBCPP_INLINE_VISIBILITY long double exp(long double __x) _NOEXCEPT {return expl(__x);}
Howard Hinnant9f8884e2011-10-27 16:24:42 +0000792#endif
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000793
David Chisnall997e4542012-02-29 13:05:08 +0000794
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000795template <class _A1>
Howard Hinnant422a53f2010-09-21 21:28:23 +0000796inline _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000797typename enable_if<is_integral<_A1>::value, double>::type
Howard Hinnantcac0c462012-07-06 19:13:50 +0000798exp(_A1 __x) _NOEXCEPT {return exp((double)__x);}
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000799
800// fabs
801
802using ::fabs;
803using ::fabsf;
804
Howard Hinnant9f8884e2011-10-27 16:24:42 +0000805#ifndef _MSC_VER
Howard Hinnantcac0c462012-07-06 19:13:50 +0000806inline _LIBCPP_INLINE_VISIBILITY float fabs(float __x) _NOEXCEPT {return fabsf(__x);}
807inline _LIBCPP_INLINE_VISIBILITY long double fabs(long double __x) _NOEXCEPT {return fabsl(__x);}
Howard Hinnant9f8884e2011-10-27 16:24:42 +0000808#endif
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000809
810template <class _A1>
Howard Hinnant422a53f2010-09-21 21:28:23 +0000811inline _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000812typename enable_if<is_integral<_A1>::value, double>::type
Howard Hinnantcac0c462012-07-06 19:13:50 +0000813fabs(_A1 __x) _NOEXCEPT {return fabs((double)__x);}
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000814
815// floor
816
817using ::floor;
818using ::floorf;
819
Howard Hinnant9f8884e2011-10-27 16:24:42 +0000820#ifndef _MSC_VER
Howard Hinnantcac0c462012-07-06 19:13:50 +0000821inline _LIBCPP_INLINE_VISIBILITY float floor(float __x) _NOEXCEPT {return floorf(__x);}
822inline _LIBCPP_INLINE_VISIBILITY long double floor(long double __x) _NOEXCEPT {return floorl(__x);}
Howard Hinnant9f8884e2011-10-27 16:24:42 +0000823#endif
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000824
825template <class _A1>
Howard Hinnant422a53f2010-09-21 21:28:23 +0000826inline _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000827typename enable_if<is_integral<_A1>::value, double>::type
Howard Hinnantcac0c462012-07-06 19:13:50 +0000828floor(_A1 __x) _NOEXCEPT {return floor((double)__x);}
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000829
830// fmod
831
David Chisnall997e4542012-02-29 13:05:08 +0000832#endif //__sun__
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000833using ::fmod;
834using ::fmodf;
David Chisnall997e4542012-02-29 13:05:08 +0000835#ifndef __sun__
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000836
Howard Hinnant9f8884e2011-10-27 16:24:42 +0000837#ifndef _MSC_VER
Howard Hinnantcac0c462012-07-06 19:13:50 +0000838inline _LIBCPP_INLINE_VISIBILITY float fmod(float __x, float __y) _NOEXCEPT {return fmodf(__x, __y);}
839inline _LIBCPP_INLINE_VISIBILITY long double fmod(long double __x, long double __y) _NOEXCEPT {return fmodl(__x, __y);}
Howard Hinnant9f8884e2011-10-27 16:24:42 +0000840#endif
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000841
842template <class _A1, class _A2>
Howard Hinnant422a53f2010-09-21 21:28:23 +0000843inline _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000844typename enable_if
845<
846 is_arithmetic<_A1>::value &&
847 is_arithmetic<_A2>::value,
848 typename __promote<_A1, _A2>::type
849>::type
Howard Hinnantcac0c462012-07-06 19:13:50 +0000850fmod(_A1 __x, _A2 __y) _NOEXCEPT
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000851{
852 typedef typename __promote<_A1, _A2>::type __result_type;
853 static_assert((!(is_same<_A1, __result_type>::value &&
854 is_same<_A2, __result_type>::value)), "");
855 return fmod((__result_type)__x, (__result_type)__y);
856}
857
David Chisnall997e4542012-02-29 13:05:08 +0000858
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000859// frexp
860
861using ::frexp;
862using ::frexpf;
863
Howard Hinnant9f8884e2011-10-27 16:24:42 +0000864#ifndef _MSC_VER
Howard Hinnantcac0c462012-07-06 19:13:50 +0000865inline _LIBCPP_INLINE_VISIBILITY float frexp(float __x, int* __e) _NOEXCEPT {return frexpf(__x, __e);}
866inline _LIBCPP_INLINE_VISIBILITY long double frexp(long double __x, int* __e) _NOEXCEPT {return frexpl(__x, __e);}
Howard Hinnant9f8884e2011-10-27 16:24:42 +0000867#endif
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000868
869template <class _A1>
Howard Hinnant422a53f2010-09-21 21:28:23 +0000870inline _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000871typename enable_if<is_integral<_A1>::value, double>::type
Howard Hinnantcac0c462012-07-06 19:13:50 +0000872frexp(_A1 __x, int* __e) _NOEXCEPT {return frexp((double)__x, __e);}
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000873
874// ldexp
875
876using ::ldexp;
877using ::ldexpf;
878
Howard Hinnant9f8884e2011-10-27 16:24:42 +0000879#ifndef _MSC_VER
Howard Hinnantcac0c462012-07-06 19:13:50 +0000880inline _LIBCPP_INLINE_VISIBILITY float ldexp(float __x, int __e) _NOEXCEPT {return ldexpf(__x, __e);}
881inline _LIBCPP_INLINE_VISIBILITY long double ldexp(long double __x, int __e) _NOEXCEPT {return ldexpl(__x, __e);}
Howard Hinnant9f8884e2011-10-27 16:24:42 +0000882#endif
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000883
884template <class _A1>
Howard Hinnant422a53f2010-09-21 21:28:23 +0000885inline _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000886typename enable_if<is_integral<_A1>::value, double>::type
Howard Hinnantcac0c462012-07-06 19:13:50 +0000887ldexp(_A1 __x, int __e) _NOEXCEPT {return ldexp((double)__x, __e);}
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000888
889// log
890
David Chisnall997e4542012-02-29 13:05:08 +0000891#endif // __sun__
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000892using ::log;
893using ::logf;
David Chisnall997e4542012-02-29 13:05:08 +0000894#ifndef __sun__
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000895
Howard Hinnant9f8884e2011-10-27 16:24:42 +0000896#ifndef _MSC_VER
Howard Hinnantcac0c462012-07-06 19:13:50 +0000897inline _LIBCPP_INLINE_VISIBILITY float log(float __x) _NOEXCEPT {return logf(__x);}
898inline _LIBCPP_INLINE_VISIBILITY long double log(long double __x) _NOEXCEPT {return logl(__x);}
Howard Hinnant9f8884e2011-10-27 16:24:42 +0000899#endif
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000900
901template <class _A1>
Howard Hinnant422a53f2010-09-21 21:28:23 +0000902inline _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000903typename enable_if<is_integral<_A1>::value, double>::type
Howard Hinnantcac0c462012-07-06 19:13:50 +0000904log(_A1 __x) _NOEXCEPT {return log((double)__x);}
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000905
David Chisnall997e4542012-02-29 13:05:08 +0000906
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000907// log10
908
909using ::log10;
910using ::log10f;
911
Howard Hinnant9f8884e2011-10-27 16:24:42 +0000912#ifndef _MSC_VER
Howard Hinnantcac0c462012-07-06 19:13:50 +0000913inline _LIBCPP_INLINE_VISIBILITY float log10(float __x) _NOEXCEPT {return log10f(__x);}
914inline _LIBCPP_INLINE_VISIBILITY long double log10(long double __x) _NOEXCEPT {return log10l(__x);}
Howard Hinnant9f8884e2011-10-27 16:24:42 +0000915#endif
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000916
917template <class _A1>
Howard Hinnant422a53f2010-09-21 21:28:23 +0000918inline _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000919typename enable_if<is_integral<_A1>::value, double>::type
Howard Hinnantcac0c462012-07-06 19:13:50 +0000920log10(_A1 __x) _NOEXCEPT {return log10((double)__x);}
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000921
922// modf
923
924using ::modf;
925using ::modff;
926
Howard Hinnant9f8884e2011-10-27 16:24:42 +0000927#ifndef _MSC_VER
Howard Hinnantcac0c462012-07-06 19:13:50 +0000928inline _LIBCPP_INLINE_VISIBILITY float modf(float __x, float* __y) _NOEXCEPT {return modff(__x, __y);}
929inline _LIBCPP_INLINE_VISIBILITY long double modf(long double __x, long double* __y) _NOEXCEPT {return modfl(__x, __y);}
Howard Hinnant9f8884e2011-10-27 16:24:42 +0000930#endif
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000931
932// pow
933
David Chisnall997e4542012-02-29 13:05:08 +0000934#endif // __sun__
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000935using ::pow;
936using ::powf;
937
David Chisnall997e4542012-02-29 13:05:08 +0000938#ifndef __sun__
939
Howard Hinnant9f8884e2011-10-27 16:24:42 +0000940#ifndef _MSC_VER
Howard Hinnantcac0c462012-07-06 19:13:50 +0000941inline _LIBCPP_INLINE_VISIBILITY float pow(float __x, float __y) _NOEXCEPT {return powf(__x, __y);}
942inline _LIBCPP_INLINE_VISIBILITY long double pow(long double __x, long double __y) _NOEXCEPT {return powl(__x, __y);}
Howard Hinnant9f8884e2011-10-27 16:24:42 +0000943#endif
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000944
945template <class _A1, class _A2>
Howard Hinnant422a53f2010-09-21 21:28:23 +0000946inline _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000947typename enable_if
948<
949 is_arithmetic<_A1>::value &&
950 is_arithmetic<_A2>::value,
951 typename __promote<_A1, _A2>::type
952>::type
Howard Hinnantcac0c462012-07-06 19:13:50 +0000953pow(_A1 __x, _A2 __y) _NOEXCEPT
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000954{
955 typedef typename __promote<_A1, _A2>::type __result_type;
956 static_assert((!(is_same<_A1, __result_type>::value &&
957 is_same<_A2, __result_type>::value)), "");
958 return pow((__result_type)__x, (__result_type)__y);
959}
960
David Chisnall997e4542012-02-29 13:05:08 +0000961
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000962// sin
963
964using ::sin;
965using ::sinf;
966
Howard Hinnant9f8884e2011-10-27 16:24:42 +0000967#ifndef _MSC_VER
Howard Hinnantcac0c462012-07-06 19:13:50 +0000968inline _LIBCPP_INLINE_VISIBILITY float sin(float __x) _NOEXCEPT {return sinf(__x);}
969inline _LIBCPP_INLINE_VISIBILITY long double sin(long double __x) _NOEXCEPT {return sinl(__x);}
Howard Hinnant9f8884e2011-10-27 16:24:42 +0000970#endif
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000971
972template <class _A1>
Howard Hinnant422a53f2010-09-21 21:28:23 +0000973inline _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000974typename enable_if<is_integral<_A1>::value, double>::type
Howard Hinnantcac0c462012-07-06 19:13:50 +0000975sin(_A1 __x) _NOEXCEPT {return sin((double)__x);}
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000976
977// sinh
978
979using ::sinh;
980using ::sinhf;
981
Howard Hinnant9f8884e2011-10-27 16:24:42 +0000982#ifndef _MSC_VER
Howard Hinnantcac0c462012-07-06 19:13:50 +0000983inline _LIBCPP_INLINE_VISIBILITY float sinh(float __x) _NOEXCEPT {return sinhf(__x);}
984inline _LIBCPP_INLINE_VISIBILITY long double sinh(long double __x) _NOEXCEPT {return sinhl(__x);}
Howard Hinnant9f8884e2011-10-27 16:24:42 +0000985#endif
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000986
987template <class _A1>
Howard Hinnant422a53f2010-09-21 21:28:23 +0000988inline _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000989typename enable_if<is_integral<_A1>::value, double>::type
Howard Hinnantcac0c462012-07-06 19:13:50 +0000990sinh(_A1 __x) _NOEXCEPT {return sinh((double)__x);}
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000991
992// sqrt
993
David Chisnall997e4542012-02-29 13:05:08 +0000994#endif // __sun__
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000995using ::sqrt;
996using ::sqrtf;
997
David Chisnall997e4542012-02-29 13:05:08 +0000998
999#if !(defined(_MSC_VER) || defined(__sun__))
Howard Hinnantcac0c462012-07-06 19:13:50 +00001000inline _LIBCPP_INLINE_VISIBILITY float sqrt(float __x) _NOEXCEPT {return sqrtf(__x);}
1001inline _LIBCPP_INLINE_VISIBILITY long double sqrt(long double __x) _NOEXCEPT {return sqrtl(__x);}
Howard Hinnant9f8884e2011-10-27 16:24:42 +00001002#endif
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001003
1004template <class _A1>
Howard Hinnant422a53f2010-09-21 21:28:23 +00001005inline _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001006typename enable_if<is_integral<_A1>::value, double>::type
Howard Hinnantcac0c462012-07-06 19:13:50 +00001007sqrt(_A1 __x) _NOEXCEPT {return sqrt((double)__x);}
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001008
1009// tan
1010
1011using ::tan;
1012using ::tanf;
David Chisnall997e4542012-02-29 13:05:08 +00001013#ifndef __sun__
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001014
Howard Hinnant9f8884e2011-10-27 16:24:42 +00001015#ifndef _MSC_VER
Howard Hinnantcac0c462012-07-06 19:13:50 +00001016inline _LIBCPP_INLINE_VISIBILITY float tan(float __x) _NOEXCEPT {return tanf(__x);}
1017inline _LIBCPP_INLINE_VISIBILITY long double tan(long double __x) _NOEXCEPT {return tanl(__x);}
Howard Hinnant9f8884e2011-10-27 16:24:42 +00001018#endif
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001019
1020template <class _A1>
Howard Hinnant422a53f2010-09-21 21:28:23 +00001021inline _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001022typename enable_if<is_integral<_A1>::value, double>::type
Howard Hinnantcac0c462012-07-06 19:13:50 +00001023tan(_A1 __x) _NOEXCEPT {return tan((double)__x);}
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001024
1025// tanh
1026
1027using ::tanh;
1028using ::tanhf;
1029
Howard Hinnant9f8884e2011-10-27 16:24:42 +00001030#ifndef _MSC_VER
Howard Hinnantcac0c462012-07-06 19:13:50 +00001031inline _LIBCPP_INLINE_VISIBILITY float tanh(float __x) _NOEXCEPT {return tanhf(__x);}
1032inline _LIBCPP_INLINE_VISIBILITY long double tanh(long double __x) _NOEXCEPT {return tanhl(__x);}
Howard Hinnant9f8884e2011-10-27 16:24:42 +00001033#endif
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001034
1035template <class _A1>
Howard Hinnant422a53f2010-09-21 21:28:23 +00001036inline _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001037typename enable_if<is_integral<_A1>::value, double>::type
Howard Hinnantcac0c462012-07-06 19:13:50 +00001038tanh(_A1 __x) _NOEXCEPT {return tanh((double)__x);}
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001039
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001040// acosh
1041
Howard Hinnant9f8884e2011-10-27 16:24:42 +00001042#ifndef _MSC_VER
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001043using ::acosh;
1044using ::acoshf;
1045
Howard Hinnantcac0c462012-07-06 19:13:50 +00001046inline _LIBCPP_INLINE_VISIBILITY float acosh(float __x) _NOEXCEPT {return acoshf(__x);}
1047inline _LIBCPP_INLINE_VISIBILITY long double acosh(long double __x) _NOEXCEPT {return acoshl(__x);}
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001048
1049template <class _A1>
Howard Hinnant422a53f2010-09-21 21:28:23 +00001050inline _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001051typename enable_if<is_integral<_A1>::value, double>::type
Howard Hinnantcac0c462012-07-06 19:13:50 +00001052acosh(_A1 __x) _NOEXCEPT {return acosh((double)__x);}
Howard Hinnant9f8884e2011-10-27 16:24:42 +00001053#endif
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001054
1055// asinh
1056
Howard Hinnant9f8884e2011-10-27 16:24:42 +00001057#ifndef _MSC_VER
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001058using ::asinh;
1059using ::asinhf;
1060
Howard Hinnantcac0c462012-07-06 19:13:50 +00001061inline _LIBCPP_INLINE_VISIBILITY float asinh(float __x) _NOEXCEPT {return asinhf(__x);}
1062inline _LIBCPP_INLINE_VISIBILITY long double asinh(long double __x) _NOEXCEPT {return asinhl(__x);}
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001063
1064template <class _A1>
Howard Hinnant422a53f2010-09-21 21:28:23 +00001065inline _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001066typename enable_if<is_integral<_A1>::value, double>::type
Howard Hinnantcac0c462012-07-06 19:13:50 +00001067asinh(_A1 __x) _NOEXCEPT {return asinh((double)__x);}
Howard Hinnant9f8884e2011-10-27 16:24:42 +00001068#endif
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001069
1070// atanh
1071
Howard Hinnant9f8884e2011-10-27 16:24:42 +00001072#ifndef _MSC_VER
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001073using ::atanh;
1074using ::atanhf;
1075
Howard Hinnantcac0c462012-07-06 19:13:50 +00001076inline _LIBCPP_INLINE_VISIBILITY float atanh(float __x) _NOEXCEPT {return atanhf(__x);}
1077inline _LIBCPP_INLINE_VISIBILITY long double atanh(long double __x) _NOEXCEPT {return atanhl(__x);}
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001078
1079template <class _A1>
Howard Hinnant422a53f2010-09-21 21:28:23 +00001080inline _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001081typename enable_if<is_integral<_A1>::value, double>::type
Howard Hinnantcac0c462012-07-06 19:13:50 +00001082atanh(_A1 __x) _NOEXCEPT {return atanh((double)__x);}
Howard Hinnant9f8884e2011-10-27 16:24:42 +00001083#endif
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001084
1085// cbrt
1086
Howard Hinnant9f8884e2011-10-27 16:24:42 +00001087#ifndef _MSC_VER
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001088using ::cbrt;
1089using ::cbrtf;
1090
Howard Hinnantcac0c462012-07-06 19:13:50 +00001091inline _LIBCPP_INLINE_VISIBILITY float cbrt(float __x) _NOEXCEPT {return cbrtf(__x);}
1092inline _LIBCPP_INLINE_VISIBILITY long double cbrt(long double __x) _NOEXCEPT {return cbrtl(__x);}
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001093
1094template <class _A1>
Howard Hinnant422a53f2010-09-21 21:28:23 +00001095inline _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001096typename enable_if<is_integral<_A1>::value, double>::type
Howard Hinnantcac0c462012-07-06 19:13:50 +00001097cbrt(_A1 __x) _NOEXCEPT {return cbrt((double)__x);}
Howard Hinnant9f8884e2011-10-27 16:24:42 +00001098#endif
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001099
1100// copysign
1101
1102using ::copysign;
1103using ::copysignf;
1104
Howard Hinnantcac0c462012-07-06 19:13:50 +00001105inline _LIBCPP_INLINE_VISIBILITY float copysign(float __x, float __y) _NOEXCEPT {return copysignf(__x, __y);}
1106inline _LIBCPP_INLINE_VISIBILITY long double copysign(long double __x, long double __y) _NOEXCEPT {return copysignl(__x, __y);}
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001107
1108template <class _A1, class _A2>
Howard Hinnant422a53f2010-09-21 21:28:23 +00001109inline _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001110typename enable_if
1111<
1112 is_arithmetic<_A1>::value &&
1113 is_arithmetic<_A2>::value,
1114 typename __promote<_A1, _A2>::type
1115>::type
Howard Hinnantcac0c462012-07-06 19:13:50 +00001116copysign(_A1 __x, _A2 __y) _NOEXCEPT
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001117{
1118 typedef typename __promote<_A1, _A2>::type __result_type;
1119 static_assert((!(is_same<_A1, __result_type>::value &&
1120 is_same<_A2, __result_type>::value)), "");
1121 return copysign((__result_type)__x, (__result_type)__y);
1122}
1123
Howard Hinnant9f8884e2011-10-27 16:24:42 +00001124#ifndef _MSC_VER
1125
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001126// erf
1127
1128using ::erf;
1129using ::erff;
1130
Howard Hinnantcac0c462012-07-06 19:13:50 +00001131inline _LIBCPP_INLINE_VISIBILITY float erf(float __x) _NOEXCEPT {return erff(__x);}
1132inline _LIBCPP_INLINE_VISIBILITY long double erf(long double __x) _NOEXCEPT {return erfl(__x);}
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001133
1134template <class _A1>
Howard Hinnant422a53f2010-09-21 21:28:23 +00001135inline _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001136typename enable_if<is_integral<_A1>::value, double>::type
Howard Hinnantcac0c462012-07-06 19:13:50 +00001137erf(_A1 __x) _NOEXCEPT {return erf((double)__x);}
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001138
1139// erfc
1140
1141using ::erfc;
1142using ::erfcf;
1143
Howard Hinnantcac0c462012-07-06 19:13:50 +00001144inline _LIBCPP_INLINE_VISIBILITY float erfc(float __x) _NOEXCEPT {return erfcf(__x);}
1145inline _LIBCPP_INLINE_VISIBILITY long double erfc(long double __x) _NOEXCEPT {return erfcl(__x);}
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001146
1147template <class _A1>
Howard Hinnant422a53f2010-09-21 21:28:23 +00001148inline _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001149typename enable_if<is_integral<_A1>::value, double>::type
Howard Hinnantcac0c462012-07-06 19:13:50 +00001150erfc(_A1 __x) _NOEXCEPT {return erfc((double)__x);}
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001151
1152// exp2
1153
1154using ::exp2;
1155using ::exp2f;
1156
Howard Hinnantcac0c462012-07-06 19:13:50 +00001157inline _LIBCPP_INLINE_VISIBILITY float exp2(float __x) _NOEXCEPT {return exp2f(__x);}
1158inline _LIBCPP_INLINE_VISIBILITY long double exp2(long double __x) _NOEXCEPT {return exp2l(__x);}
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001159
1160template <class _A1>
Howard Hinnant422a53f2010-09-21 21:28:23 +00001161inline _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001162typename enable_if<is_integral<_A1>::value, double>::type
Howard Hinnantcac0c462012-07-06 19:13:50 +00001163exp2(_A1 __x) _NOEXCEPT {return exp2((double)__x);}
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001164
1165// expm1
1166
1167using ::expm1;
1168using ::expm1f;
1169
Howard Hinnantcac0c462012-07-06 19:13:50 +00001170inline _LIBCPP_INLINE_VISIBILITY float expm1(float __x) _NOEXCEPT {return expm1f(__x);}
1171inline _LIBCPP_INLINE_VISIBILITY long double expm1(long double __x) _NOEXCEPT {return expm1l(__x);}
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001172
1173template <class _A1>
Howard Hinnant422a53f2010-09-21 21:28:23 +00001174inline _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001175typename enable_if<is_integral<_A1>::value, double>::type
Howard Hinnantcac0c462012-07-06 19:13:50 +00001176expm1(_A1 __x) _NOEXCEPT {return expm1((double)__x);}
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001177
1178// fdim
1179
1180using ::fdim;
1181using ::fdimf;
1182
Howard Hinnantcac0c462012-07-06 19:13:50 +00001183inline _LIBCPP_INLINE_VISIBILITY float fdim(float __x, float __y) _NOEXCEPT {return fdimf(__x, __y);}
1184inline _LIBCPP_INLINE_VISIBILITY long double fdim(long double __x, long double __y) _NOEXCEPT {return fdiml(__x, __y);}
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001185
1186template <class _A1, class _A2>
Howard Hinnant422a53f2010-09-21 21:28:23 +00001187inline _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001188typename enable_if
1189<
1190 is_arithmetic<_A1>::value &&
1191 is_arithmetic<_A2>::value,
1192 typename __promote<_A1, _A2>::type
1193>::type
Howard Hinnantcac0c462012-07-06 19:13:50 +00001194fdim(_A1 __x, _A2 __y) _NOEXCEPT
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001195{
1196 typedef typename __promote<_A1, _A2>::type __result_type;
1197 static_assert((!(is_same<_A1, __result_type>::value &&
1198 is_same<_A2, __result_type>::value)), "");
1199 return fdim((__result_type)__x, (__result_type)__y);
1200}
1201
1202// fma
1203
Howard Hinnantcac0c462012-07-06 19:13:50 +00001204inline _LIBCPP_INLINE_VISIBILITY float fmaf(float __x, float __y, float __z) _NOEXCEPT {return (float)((double)__x*__y + __z);}
Howard Hinnant0919dba2012-11-06 21:55:44 +00001205#ifndef FP_FAST_FMAF
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001206#define FP_FAST_FMAF
Howard Hinnant0919dba2012-11-06 21:55:44 +00001207#endif
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001208
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001209using ::fma;
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001210
Howard Hinnantcac0c462012-07-06 19:13:50 +00001211inline _LIBCPP_INLINE_VISIBILITY float fma(float __x, float __y, float __z) _NOEXCEPT {return fmaf(__x, __y, __z);}
1212inline _LIBCPP_INLINE_VISIBILITY long double fma(long double __x, long double __y, long double __z) _NOEXCEPT {return fmal(__x, __y, __z);}
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001213
1214template <class _A1, class _A2, class _A3>
Howard Hinnant422a53f2010-09-21 21:28:23 +00001215inline _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001216typename enable_if
1217<
1218 is_arithmetic<_A1>::value &&
1219 is_arithmetic<_A2>::value &&
1220 is_arithmetic<_A3>::value,
1221 typename __promote<_A1, _A2, _A3>::type
1222>::type
Howard Hinnantcac0c462012-07-06 19:13:50 +00001223fma(_A1 __x, _A2 __y, _A3 __z) _NOEXCEPT
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001224{
1225 typedef typename __promote<_A1, _A2, _A3>::type __result_type;
1226 static_assert((!(is_same<_A1, __result_type>::value &&
1227 is_same<_A2, __result_type>::value &&
1228 is_same<_A3, __result_type>::value)), "");
1229 return fma((__result_type)__x, (__result_type)__y, (__result_type)__z);
1230}
1231
1232// fmax
1233
1234using ::fmax;
1235using ::fmaxf;
1236
Howard Hinnantcac0c462012-07-06 19:13:50 +00001237inline _LIBCPP_INLINE_VISIBILITY float fmax(float __x, float __y) _NOEXCEPT {return fmaxf(__x, __y);}
1238inline _LIBCPP_INLINE_VISIBILITY long double fmax(long double __x, long double __y) _NOEXCEPT {return fmaxl(__x, __y);}
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001239
1240template <class _A1, class _A2>
Howard Hinnant422a53f2010-09-21 21:28:23 +00001241inline _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001242typename enable_if
1243<
1244 is_arithmetic<_A1>::value &&
1245 is_arithmetic<_A2>::value,
1246 typename __promote<_A1, _A2>::type
1247>::type
Howard Hinnantcac0c462012-07-06 19:13:50 +00001248fmax(_A1 __x, _A2 __y) _NOEXCEPT
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001249{
1250 typedef typename __promote<_A1, _A2>::type __result_type;
1251 static_assert((!(is_same<_A1, __result_type>::value &&
1252 is_same<_A2, __result_type>::value)), "");
1253 return fmax((__result_type)__x, (__result_type)__y);
1254}
1255
1256// fmin
1257
1258using ::fmin;
1259using ::fminf;
1260
Howard Hinnantcac0c462012-07-06 19:13:50 +00001261inline _LIBCPP_INLINE_VISIBILITY float fmin(float __x, float __y) _NOEXCEPT {return fminf(__x, __y);}
1262inline _LIBCPP_INLINE_VISIBILITY long double fmin(long double __x, long double __y) _NOEXCEPT {return fminl(__x, __y);}
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001263
1264template <class _A1, class _A2>
Howard Hinnant422a53f2010-09-21 21:28:23 +00001265inline _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001266typename enable_if
1267<
1268 is_arithmetic<_A1>::value &&
1269 is_arithmetic<_A2>::value,
1270 typename __promote<_A1, _A2>::type
1271>::type
Howard Hinnantcac0c462012-07-06 19:13:50 +00001272fmin(_A1 __x, _A2 __y) _NOEXCEPT
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001273{
1274 typedef typename __promote<_A1, _A2>::type __result_type;
1275 static_assert((!(is_same<_A1, __result_type>::value &&
1276 is_same<_A2, __result_type>::value)), "");
1277 return fmin((__result_type)__x, (__result_type)__y);
1278}
1279
1280// hypot
1281
1282using ::hypot;
1283using ::hypotf;
1284
Howard Hinnantcac0c462012-07-06 19:13:50 +00001285inline _LIBCPP_INLINE_VISIBILITY float hypot(float __x, float __y) _NOEXCEPT {return hypotf(__x, __y);}
1286inline _LIBCPP_INLINE_VISIBILITY long double hypot(long double __x, long double __y) _NOEXCEPT {return hypotl(__x, __y);}
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001287
1288template <class _A1, class _A2>
Howard Hinnant422a53f2010-09-21 21:28:23 +00001289inline _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001290typename enable_if
1291<
1292 is_arithmetic<_A1>::value &&
1293 is_arithmetic<_A2>::value,
1294 typename __promote<_A1, _A2>::type
1295>::type
Howard Hinnantcac0c462012-07-06 19:13:50 +00001296hypot(_A1 __x, _A2 __y) _NOEXCEPT
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001297{
1298 typedef typename __promote<_A1, _A2>::type __result_type;
1299 static_assert((!(is_same<_A1, __result_type>::value &&
1300 is_same<_A2, __result_type>::value)), "");
1301 return hypot((__result_type)__x, (__result_type)__y);
1302}
1303
1304// ilogb
1305
1306using ::ilogb;
1307using ::ilogbf;
1308
Howard Hinnantcac0c462012-07-06 19:13:50 +00001309inline _LIBCPP_INLINE_VISIBILITY int ilogb(float __x) _NOEXCEPT {return ilogbf(__x);}
1310inline _LIBCPP_INLINE_VISIBILITY int ilogb(long double __x) _NOEXCEPT {return ilogbl(__x);}
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001311
1312template <class _A1>
Howard Hinnant422a53f2010-09-21 21:28:23 +00001313inline _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001314typename enable_if<is_integral<_A1>::value, int>::type
Howard Hinnantcac0c462012-07-06 19:13:50 +00001315ilogb(_A1 __x) _NOEXCEPT {return ilogb((double)__x);}
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001316
1317// lgamma
1318
1319using ::lgamma;
1320using ::lgammaf;
1321
Howard Hinnantcac0c462012-07-06 19:13:50 +00001322inline _LIBCPP_INLINE_VISIBILITY float lgamma(float __x) _NOEXCEPT {return lgammaf(__x);}
1323inline _LIBCPP_INLINE_VISIBILITY long double lgamma(long double __x) _NOEXCEPT {return lgammal(__x);}
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001324
David Chisnall997e4542012-02-29 13:05:08 +00001325
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001326template <class _A1>
Howard Hinnant422a53f2010-09-21 21:28:23 +00001327inline _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001328typename enable_if<is_integral<_A1>::value, double>::type
Howard Hinnantcac0c462012-07-06 19:13:50 +00001329lgamma(_A1 __x) _NOEXCEPT {return lgamma((double)__x);}
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001330
David Chisnall997e4542012-02-29 13:05:08 +00001331
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001332// llrint
1333
1334using ::llrint;
1335using ::llrintf;
1336
Howard Hinnantcac0c462012-07-06 19:13:50 +00001337inline _LIBCPP_INLINE_VISIBILITY long long llrint(float __x) _NOEXCEPT {return llrintf(__x);}
1338inline _LIBCPP_INLINE_VISIBILITY long long llrint(long double __x) _NOEXCEPT {return llrintl(__x);}
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001339
1340template <class _A1>
Howard Hinnant422a53f2010-09-21 21:28:23 +00001341inline _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001342typename enable_if<is_integral<_A1>::value, long long>::type
Howard Hinnantcac0c462012-07-06 19:13:50 +00001343llrint(_A1 __x) _NOEXCEPT {return llrint((double)__x);}
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001344
1345// llround
1346
1347using ::llround;
1348using ::llroundf;
1349
Howard Hinnantcac0c462012-07-06 19:13:50 +00001350inline _LIBCPP_INLINE_VISIBILITY long long llround(float __x) _NOEXCEPT {return llroundf(__x);}
1351inline _LIBCPP_INLINE_VISIBILITY long long llround(long double __x) _NOEXCEPT {return llroundl(__x);}
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001352
1353template <class _A1>
Howard Hinnant422a53f2010-09-21 21:28:23 +00001354inline _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001355typename enable_if<is_integral<_A1>::value, long long>::type
Howard Hinnantcac0c462012-07-06 19:13:50 +00001356llround(_A1 __x) _NOEXCEPT {return llround((double)__x);}
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001357
1358// log1p
1359
1360using ::log1p;
1361using ::log1pf;
1362
Howard Hinnantcac0c462012-07-06 19:13:50 +00001363inline _LIBCPP_INLINE_VISIBILITY float log1p(float __x) _NOEXCEPT {return log1pf(__x);}
1364inline _LIBCPP_INLINE_VISIBILITY long double log1p(long double __x) _NOEXCEPT {return log1pl(__x);}
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001365
1366template <class _A1>
Howard Hinnant422a53f2010-09-21 21:28:23 +00001367inline _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001368typename enable_if<is_integral<_A1>::value, double>::type
Howard Hinnantcac0c462012-07-06 19:13:50 +00001369log1p(_A1 __x) _NOEXCEPT {return log1p((double)__x);}
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001370
1371// log2
1372
1373using ::log2;
1374using ::log2f;
1375
Howard Hinnantcac0c462012-07-06 19:13:50 +00001376inline _LIBCPP_INLINE_VISIBILITY float log2(float __x) _NOEXCEPT {return log2f(__x);}
1377inline _LIBCPP_INLINE_VISIBILITY long double log2(long double __x) _NOEXCEPT {return log2l(__x);}
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001378
1379template <class _A1>
Howard Hinnant422a53f2010-09-21 21:28:23 +00001380inline _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001381typename enable_if<is_integral<_A1>::value, double>::type
Howard Hinnantcac0c462012-07-06 19:13:50 +00001382log2(_A1 __x) _NOEXCEPT {return log2((double)__x);}
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001383
1384// logb
1385
1386using ::logb;
1387using ::logbf;
1388
Howard Hinnantcac0c462012-07-06 19:13:50 +00001389inline _LIBCPP_INLINE_VISIBILITY float logb(float __x) _NOEXCEPT {return logbf(__x);}
1390inline _LIBCPP_INLINE_VISIBILITY long double logb(long double __x) _NOEXCEPT {return logbl(__x);}
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001391
1392template <class _A1>
Howard Hinnant422a53f2010-09-21 21:28:23 +00001393inline _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001394typename enable_if<is_integral<_A1>::value, double>::type
Howard Hinnantcac0c462012-07-06 19:13:50 +00001395logb(_A1 __x) _NOEXCEPT {return logb((double)__x);}
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001396
1397// lrint
1398
1399using ::lrint;
1400using ::lrintf;
1401
Howard Hinnantcac0c462012-07-06 19:13:50 +00001402inline _LIBCPP_INLINE_VISIBILITY long lrint(float __x) _NOEXCEPT {return lrintf(__x);}
1403inline _LIBCPP_INLINE_VISIBILITY long lrint(long double __x) _NOEXCEPT {return lrintl(__x);}
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001404
1405template <class _A1>
Howard Hinnant422a53f2010-09-21 21:28:23 +00001406inline _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001407typename enable_if<is_integral<_A1>::value, long>::type
Howard Hinnantcac0c462012-07-06 19:13:50 +00001408lrint(_A1 __x) _NOEXCEPT {return lrint((double)__x);}
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001409
1410// lround
1411
1412using ::lround;
1413using ::lroundf;
1414
Howard Hinnantcac0c462012-07-06 19:13:50 +00001415inline _LIBCPP_INLINE_VISIBILITY long lround(float __x) _NOEXCEPT {return lroundf(__x);}
1416inline _LIBCPP_INLINE_VISIBILITY long lround(long double __x) _NOEXCEPT {return lroundl(__x);}
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001417
1418template <class _A1>
Howard Hinnant422a53f2010-09-21 21:28:23 +00001419inline _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001420typename enable_if<is_integral<_A1>::value, long>::type
Howard Hinnantcac0c462012-07-06 19:13:50 +00001421lround(_A1 __x) _NOEXCEPT {return lround((double)__x);}
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001422
1423// nan
David Chisnallb6e7c302012-02-29 16:41:21 +00001424#endif // _MSC_VER
David Chisnall997e4542012-02-29 13:05:08 +00001425#endif // __sun__
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001426using ::nan;
1427using ::nanf;
David Chisnall997e4542012-02-29 13:05:08 +00001428#ifndef __sun__
David Chisnallb6e7c302012-02-29 16:41:21 +00001429#ifndef _MSC_VER
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001430
1431// nearbyint
1432
1433using ::nearbyint;
1434using ::nearbyintf;
1435
Howard Hinnantcac0c462012-07-06 19:13:50 +00001436inline _LIBCPP_INLINE_VISIBILITY float nearbyint(float __x) _NOEXCEPT {return nearbyintf(__x);}
1437inline _LIBCPP_INLINE_VISIBILITY long double nearbyint(long double __x) _NOEXCEPT {return nearbyintl(__x);}
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001438
1439template <class _A1>
Howard Hinnant422a53f2010-09-21 21:28:23 +00001440inline _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001441typename enable_if<is_integral<_A1>::value, double>::type
Howard Hinnantcac0c462012-07-06 19:13:50 +00001442nearbyint(_A1 __x) _NOEXCEPT {return nearbyint((double)__x);}
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001443
1444// nextafter
1445
1446using ::nextafter;
1447using ::nextafterf;
1448
Howard Hinnantcac0c462012-07-06 19:13:50 +00001449inline _LIBCPP_INLINE_VISIBILITY float nextafter(float __x, float __y) _NOEXCEPT {return nextafterf(__x, __y);}
1450inline _LIBCPP_INLINE_VISIBILITY long double nextafter(long double __x, long double __y) _NOEXCEPT {return nextafterl(__x, __y);}
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001451
1452template <class _A1, class _A2>
Howard Hinnant422a53f2010-09-21 21:28:23 +00001453inline _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001454typename enable_if
1455<
1456 is_arithmetic<_A1>::value &&
1457 is_arithmetic<_A2>::value,
1458 typename __promote<_A1, _A2>::type
1459>::type
Howard Hinnantcac0c462012-07-06 19:13:50 +00001460nextafter(_A1 __x, _A2 __y) _NOEXCEPT
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001461{
1462 typedef typename __promote<_A1, _A2>::type __result_type;
1463 static_assert((!(is_same<_A1, __result_type>::value &&
1464 is_same<_A2, __result_type>::value)), "");
1465 return nextafter((__result_type)__x, (__result_type)__y);
1466}
1467
1468// nexttoward
1469
1470using ::nexttoward;
1471using ::nexttowardf;
1472
Howard Hinnantcac0c462012-07-06 19:13:50 +00001473inline _LIBCPP_INLINE_VISIBILITY float nexttoward(float __x, long double __y) _NOEXCEPT {return nexttowardf(__x, __y);}
1474inline _LIBCPP_INLINE_VISIBILITY long double nexttoward(long double __x, long double __y) _NOEXCEPT {return nexttowardl(__x, __y);}
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001475
1476template <class _A1>
Howard Hinnant422a53f2010-09-21 21:28:23 +00001477inline _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001478typename enable_if<is_integral<_A1>::value, double>::type
Howard Hinnantcac0c462012-07-06 19:13:50 +00001479nexttoward(_A1 __x, long double __y) _NOEXCEPT {return nexttoward((double)__x, __y);}
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001480
1481// remainder
1482
1483using ::remainder;
1484using ::remainderf;
1485
Howard Hinnantcac0c462012-07-06 19:13:50 +00001486inline _LIBCPP_INLINE_VISIBILITY float remainder(float __x, float __y) _NOEXCEPT {return remainderf(__x, __y);}
1487inline _LIBCPP_INLINE_VISIBILITY long double remainder(long double __x, long double __y) _NOEXCEPT {return remainderl(__x, __y);}
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001488
1489template <class _A1, class _A2>
Howard Hinnant422a53f2010-09-21 21:28:23 +00001490inline _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001491typename enable_if
1492<
1493 is_arithmetic<_A1>::value &&
1494 is_arithmetic<_A2>::value,
1495 typename __promote<_A1, _A2>::type
1496>::type
Howard Hinnantcac0c462012-07-06 19:13:50 +00001497remainder(_A1 __x, _A2 __y) _NOEXCEPT
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001498{
1499 typedef typename __promote<_A1, _A2>::type __result_type;
1500 static_assert((!(is_same<_A1, __result_type>::value &&
1501 is_same<_A2, __result_type>::value)), "");
1502 return remainder((__result_type)__x, (__result_type)__y);
1503}
1504
1505// remquo
1506
1507using ::remquo;
1508using ::remquof;
1509
Howard Hinnantcac0c462012-07-06 19:13:50 +00001510inline _LIBCPP_INLINE_VISIBILITY float remquo(float __x, float __y, int* __z) _NOEXCEPT {return remquof(__x, __y, __z);}
1511inline _LIBCPP_INLINE_VISIBILITY long double remquo(long double __x, long double __y, int* __z) _NOEXCEPT {return remquol(__x, __y, __z);}
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001512
1513template <class _A1, class _A2>
Howard Hinnant422a53f2010-09-21 21:28:23 +00001514inline _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001515typename enable_if
1516<
1517 is_arithmetic<_A1>::value &&
1518 is_arithmetic<_A2>::value,
1519 typename __promote<_A1, _A2>::type
1520>::type
Howard Hinnantcac0c462012-07-06 19:13:50 +00001521remquo(_A1 __x, _A2 __y, int* __z) _NOEXCEPT
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001522{
1523 typedef typename __promote<_A1, _A2>::type __result_type;
1524 static_assert((!(is_same<_A1, __result_type>::value &&
1525 is_same<_A2, __result_type>::value)), "");
1526 return remquo((__result_type)__x, (__result_type)__y, __z);
1527}
1528
1529// rint
1530
1531using ::rint;
1532using ::rintf;
1533
Howard Hinnantcac0c462012-07-06 19:13:50 +00001534inline _LIBCPP_INLINE_VISIBILITY float rint(float __x) _NOEXCEPT {return rintf(__x);}
1535inline _LIBCPP_INLINE_VISIBILITY long double rint(long double __x) _NOEXCEPT {return rintl(__x);}
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001536
1537template <class _A1>
Howard Hinnant422a53f2010-09-21 21:28:23 +00001538inline _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001539typename enable_if<is_integral<_A1>::value, double>::type
Howard Hinnantcac0c462012-07-06 19:13:50 +00001540rint(_A1 __x) _NOEXCEPT {return rint((double)__x);}
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001541
1542// round
1543
1544using ::round;
1545using ::roundf;
1546
Howard Hinnantcac0c462012-07-06 19:13:50 +00001547inline _LIBCPP_INLINE_VISIBILITY float round(float __x) _NOEXCEPT {return roundf(__x);}
1548inline _LIBCPP_INLINE_VISIBILITY long double round(long double __x) _NOEXCEPT {return roundl(__x);}
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001549
1550template <class _A1>
Howard Hinnant422a53f2010-09-21 21:28:23 +00001551inline _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001552typename enable_if<is_integral<_A1>::value, double>::type
Howard Hinnantcac0c462012-07-06 19:13:50 +00001553round(_A1 __x) _NOEXCEPT {return round((double)__x);}
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001554
1555// scalbln
1556
1557using ::scalbln;
1558using ::scalblnf;
1559
Howard Hinnantcac0c462012-07-06 19:13:50 +00001560inline _LIBCPP_INLINE_VISIBILITY float scalbln(float __x, long __y) _NOEXCEPT {return scalblnf(__x, __y);}
1561inline _LIBCPP_INLINE_VISIBILITY long double scalbln(long double __x, long __y) _NOEXCEPT {return scalblnl(__x, __y);}
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001562
1563template <class _A1>
Howard Hinnant422a53f2010-09-21 21:28:23 +00001564inline _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001565typename enable_if<is_integral<_A1>::value, double>::type
Howard Hinnantcac0c462012-07-06 19:13:50 +00001566scalbln(_A1 __x, long __y) _NOEXCEPT {return scalbln((double)__x, __y);}
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001567
1568// scalbn
1569
1570using ::scalbn;
1571using ::scalbnf;
1572
Howard Hinnantcac0c462012-07-06 19:13:50 +00001573inline _LIBCPP_INLINE_VISIBILITY float scalbn(float __x, int __y) _NOEXCEPT {return scalbnf(__x, __y);}
1574inline _LIBCPP_INLINE_VISIBILITY long double scalbn(long double __x, int __y) _NOEXCEPT {return scalbnl(__x, __y);}
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001575
1576template <class _A1>
Howard Hinnant422a53f2010-09-21 21:28:23 +00001577inline _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001578typename enable_if<is_integral<_A1>::value, double>::type
Howard Hinnantcac0c462012-07-06 19:13:50 +00001579scalbn(_A1 __x, int __y) _NOEXCEPT {return scalbn((double)__x, __y);}
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001580
1581// tgamma
1582
1583using ::tgamma;
1584using ::tgammaf;
1585
Howard Hinnantcac0c462012-07-06 19:13:50 +00001586inline _LIBCPP_INLINE_VISIBILITY float tgamma(float __x) _NOEXCEPT {return tgammaf(__x);}
1587inline _LIBCPP_INLINE_VISIBILITY long double tgamma(long double __x) _NOEXCEPT {return tgammal(__x);}
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001588
1589template <class _A1>
Howard Hinnant422a53f2010-09-21 21:28:23 +00001590inline _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001591typename enable_if<is_integral<_A1>::value, double>::type
Howard Hinnantcac0c462012-07-06 19:13:50 +00001592tgamma(_A1 __x) _NOEXCEPT {return tgamma((double)__x);}
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001593
1594// trunc
1595
1596using ::trunc;
1597using ::truncf;
1598
Howard Hinnantcac0c462012-07-06 19:13:50 +00001599inline _LIBCPP_INLINE_VISIBILITY float trunc(float __x) _NOEXCEPT {return truncf(__x);}
1600inline _LIBCPP_INLINE_VISIBILITY long double trunc(long double __x) _NOEXCEPT {return truncl(__x);}
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001601
1602template <class _A1>
Howard Hinnant422a53f2010-09-21 21:28:23 +00001603inline _LIBCPP_INLINE_VISIBILITY
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001604typename enable_if<is_integral<_A1>::value, double>::type
Howard Hinnantcac0c462012-07-06 19:13:50 +00001605trunc(_A1 __x) _NOEXCEPT {return trunc((double)__x);}
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001606
Howard Hinnant9f8884e2011-10-27 16:24:42 +00001607#endif // !_MSC_VER
1608
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001609using ::acosl;
1610using ::asinl;
1611using ::atanl;
1612using ::atan2l;
1613using ::ceill;
1614using ::cosl;
1615using ::coshl;
1616using ::expl;
1617using ::fabsl;
1618using ::floorl;
1619using ::fmodl;
1620using ::frexpl;
1621using ::ldexpl;
1622using ::logl;
1623using ::log10l;
1624using ::modfl;
1625using ::powl;
1626using ::sinl;
1627using ::sinhl;
1628using ::sqrtl;
1629using ::tanl;
Howard Hinnant9f8884e2011-10-27 16:24:42 +00001630#ifndef _MSC_VER
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001631using ::tanhl;
1632using ::acoshl;
1633using ::asinhl;
1634using ::atanhl;
1635using ::cbrtl;
Howard Hinnantec3773c2011-12-01 20:21:04 +00001636#endif // !_MSC_VER
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001637using ::copysignl;
Howard Hinnant9f8884e2011-10-27 16:24:42 +00001638#ifndef _MSC_VER
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001639using ::erfl;
1640using ::erfcl;
1641using ::exp2l;
1642using ::expm1l;
1643using ::fdiml;
1644using ::fmal;
1645using ::fmaxl;
1646using ::fminl;
1647using ::hypotl;
1648using ::ilogbl;
1649using ::lgammal;
1650using ::llrintl;
1651using ::llroundl;
1652using ::log1pl;
1653using ::log2l;
1654using ::logbl;
1655using ::lrintl;
1656using ::lroundl;
1657using ::nanl;
1658using ::nearbyintl;
1659using ::nextafterl;
1660using ::nexttowardl;
1661using ::remainderl;
1662using ::remquol;
1663using ::rintl;
1664using ::roundl;
1665using ::scalblnl;
1666using ::scalbnl;
1667using ::tgammal;
1668using ::truncl;
Howard Hinnant9f8884e2011-10-27 16:24:42 +00001669#endif // !_MSC_VER
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001670
David Chisnall997e4542012-02-29 13:05:08 +00001671#else
1672using ::lgamma;
1673using ::lgammaf;
1674#endif // __sun__
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001675_LIBCPP_END_NAMESPACE_STD
1676
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001677#endif // _LIBCPP_CMATH