cmath revision 278724
1304732Scy// -*- C++ -*-
2304732Scy//===---------------------------- cmath -----------------------------------===//
3304732Scy//
4304732Scy//                     The LLVM Compiler Infrastructure
5304732Scy//
6304732Scy// This file is dual licensed under the MIT and the University of Illinois Open
7304732Scy// Source Licenses. See LICENSE.TXT for details.
8304732Scy//
9304732Scy//===----------------------------------------------------------------------===//
10304732Scy
11304732Scy#ifndef _LIBCPP_CMATH
12304732Scy#define _LIBCPP_CMATH
13304732Scy
14304732Scy/*
15304732Scy    cmath synopsis
16304732Scy
17304732ScyMacros:
18304732Scy
19304732Scy    HUGE_VAL
20304732Scy    HUGE_VALF               // C99
21304732Scy    HUGE_VALL               // C99
22304732Scy    INFINITY                // C99
23304732Scy    NAN                     // C99
24304732Scy    FP_INFINITE             // C99
25304732Scy    FP_NAN                  // C99
26304732Scy    FP_NORMAL               // C99
27304732Scy    FP_SUBNORMAL            // C99
28304732Scy    FP_ZERO                 // C99
29304732Scy    FP_FAST_FMA             // C99
30304732Scy    FP_FAST_FMAF            // C99
31304732Scy    FP_FAST_FMAL            // C99
32304732Scy    FP_ILOGB0               // C99
33304732Scy    FP_ILOGBNAN             // C99
34304732Scy    MATH_ERRNO              // C99
35304732Scy    MATH_ERREXCEPT          // C99
36304732Scy    math_errhandling        // C99
37304732Scy
38304732Scynamespace std
39304732Scy{
40304732Scy
41304732ScyTypes:
42304732Scy
43304732Scy    float_t                 // C99
44304732Scy    double_t                // C99
45304732Scy
46304732Scy// C90
47304732Scy
48304732Scyfloating_point abs(floating_point x);
49304732Scy
50304732Scyfloating_point acos (arithmetic x);
51304732Scyfloat          acosf(float x);
52304732Scylong double    acosl(long double x);
53304732Scy
54304732Scyfloating_point asin (arithmetic x);
55304732Scyfloat          asinf(float x);
56304732Scylong double    asinl(long double x);
57304732Scy
58304732Scyfloating_point atan (arithmetic x);
59304732Scyfloat          atanf(float x);
60304732Scylong double    atanl(long double x);
61304732Scy
62304732Scyfloating_point atan2 (arithmetic y, arithmetic x);
63304732Scyfloat          atan2f(float y, float x);
64304732Scylong double    atan2l(long double y, long double x);
65304732Scy
66304732Scyfloating_point ceil (arithmetic x);
67304732Scyfloat          ceilf(float x);
68304732Scylong double    ceill(long double x);
69304732Scy
70304732Scyfloating_point cos (arithmetic x);
71304732Scyfloat          cosf(float x);
72304732Scylong double    cosl(long double x);
73304732Scy
74304732Scyfloating_point cosh (arithmetic x);
75304732Scyfloat          coshf(float x);
76304732Scylong double    coshl(long double x);
77304732Scy
78304732Scyfloating_point exp (arithmetic x);
79304732Scyfloat          expf(float x);
80304732Scylong double    expl(long double x);
81304732Scy
82304732Scyfloating_point fabs (arithmetic x);
83304732Scyfloat          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(arithmetic x);
141
142int fpclassify(arithmetic x);
143
144bool isfinite(arithmetic x);
145bool isinf(arithmetic x);
146bool isnan(arithmetic x);
147bool isnormal(arithmetic x);
148
149bool 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);
155
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
304#ifdef _LIBCPP_MSVCRT
305#include "support/win32/math_win32.h"
306#endif
307
308#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
309#pragma GCC system_header
310#endif
311
312// signbit
313
314#ifdef signbit
315
316template <class _A1>
317_LIBCPP_ALWAYS_INLINE
318bool
319__libcpp_signbit(_A1 __lcpp_x) _NOEXCEPT
320{
321    return signbit(__lcpp_x);
322}
323
324#undef signbit
325
326template <class _A1>
327inline _LIBCPP_INLINE_VISIBILITY
328typename std::enable_if<std::is_arithmetic<_A1>::value, bool>::type
329signbit(_A1 __lcpp_x) _NOEXCEPT
330{
331    return __libcpp_signbit((typename std::__promote<_A1>::type)__lcpp_x);
332}
333
334#endif  // signbit
335
336// fpclassify
337
338#ifdef fpclassify
339
340template <class _A1>
341_LIBCPP_ALWAYS_INLINE
342int
343__libcpp_fpclassify(_A1 __lcpp_x) _NOEXCEPT
344{
345    return fpclassify(__lcpp_x);
346}
347
348#undef fpclassify
349
350template <class _A1>
351inline _LIBCPP_INLINE_VISIBILITY
352typename std::enable_if<std::is_arithmetic<_A1>::value, int>::type
353fpclassify(_A1 __lcpp_x) _NOEXCEPT
354{
355    return __libcpp_fpclassify((typename std::__promote<_A1>::type)__lcpp_x);
356}
357
358#endif  // fpclassify
359
360// isfinite
361
362#ifdef isfinite
363
364template <class _A1>
365_LIBCPP_ALWAYS_INLINE
366bool
367__libcpp_isfinite(_A1 __lcpp_x) _NOEXCEPT
368{
369    return isfinite(__lcpp_x);
370}
371
372#undef isfinite
373
374template <class _A1>
375inline _LIBCPP_INLINE_VISIBILITY
376typename std::enable_if<std::is_arithmetic<_A1>::value, bool>::type
377isfinite(_A1 __lcpp_x) _NOEXCEPT
378{
379    return __libcpp_isfinite((typename std::__promote<_A1>::type)__lcpp_x);
380}
381
382#endif  // isfinite
383
384// isinf
385
386#ifdef isinf
387
388template <class _A1>
389_LIBCPP_ALWAYS_INLINE
390bool
391__libcpp_isinf(_A1 __lcpp_x) _NOEXCEPT
392{
393    return isinf(__lcpp_x);
394}
395
396#undef isinf
397
398template <class _A1>
399inline _LIBCPP_INLINE_VISIBILITY
400typename std::enable_if<std::is_arithmetic<_A1>::value, bool>::type
401isinf(_A1 __lcpp_x) _NOEXCEPT
402{
403    return __libcpp_isinf((typename std::__promote<_A1>::type)__lcpp_x);
404}
405
406#endif  // isinf
407
408// isnan
409
410#ifdef isnan
411
412template <class _A1>
413_LIBCPP_ALWAYS_INLINE
414bool
415__libcpp_isnan(_A1 __lcpp_x) _NOEXCEPT
416{
417    return isnan(__lcpp_x);
418}
419
420#undef isnan
421
422template <class _A1>
423inline _LIBCPP_INLINE_VISIBILITY
424typename std::enable_if<std::is_arithmetic<_A1>::value, bool>::type
425isnan(_A1 __lcpp_x) _NOEXCEPT
426{
427    return __libcpp_isnan((typename std::__promote<_A1>::type)__lcpp_x);
428}
429
430#endif  // isnan
431
432// isnormal
433
434#ifdef isnormal
435
436template <class _A1>
437_LIBCPP_ALWAYS_INLINE
438bool
439__libcpp_isnormal(_A1 __lcpp_x) _NOEXCEPT
440{
441    return isnormal(__lcpp_x);
442}
443
444#undef isnormal
445
446template <class _A1>
447inline _LIBCPP_INLINE_VISIBILITY
448typename std::enable_if<std::is_arithmetic<_A1>::value, bool>::type
449isnormal(_A1 __lcpp_x) _NOEXCEPT
450{
451    return __libcpp_isnormal((typename std::__promote<_A1>::type)__lcpp_x);
452}
453
454#endif  // isnormal
455
456// isgreater
457
458#ifdef isgreater
459
460template <class _A1, class _A2>
461_LIBCPP_ALWAYS_INLINE
462bool
463__libcpp_isgreater(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
464{
465    return isgreater(__lcpp_x, __lcpp_y);
466}
467
468#undef isgreater
469
470template <class _A1, class _A2>
471inline _LIBCPP_INLINE_VISIBILITY
472typename std::enable_if
473<
474    std::is_arithmetic<_A1>::value &&
475    std::is_arithmetic<_A2>::value,
476    bool
477>::type
478isgreater(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
479{
480    typedef typename std::__promote<_A1, _A2>::type type;
481    return __libcpp_isgreater((type)__lcpp_x, (type)__lcpp_y);
482}
483
484#endif  // isgreater
485
486// isgreaterequal
487
488#ifdef isgreaterequal
489
490template <class _A1, class _A2>
491_LIBCPP_ALWAYS_INLINE
492bool
493__libcpp_isgreaterequal(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
494{
495    return isgreaterequal(__lcpp_x, __lcpp_y);
496}
497
498#undef isgreaterequal
499
500template <class _A1, class _A2>
501inline _LIBCPP_INLINE_VISIBILITY
502typename std::enable_if
503<
504    std::is_arithmetic<_A1>::value &&
505    std::is_arithmetic<_A2>::value,
506    bool
507>::type
508isgreaterequal(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
509{
510    typedef typename std::__promote<_A1, _A2>::type type;
511    return __libcpp_isgreaterequal((type)__lcpp_x, (type)__lcpp_y);
512}
513
514#endif  // isgreaterequal
515
516// isless
517
518#ifdef isless
519
520template <class _A1, class _A2>
521_LIBCPP_ALWAYS_INLINE
522bool
523__libcpp_isless(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
524{
525    return isless(__lcpp_x, __lcpp_y);
526}
527
528#undef isless
529
530template <class _A1, class _A2>
531inline _LIBCPP_INLINE_VISIBILITY
532typename std::enable_if
533<
534    std::is_arithmetic<_A1>::value &&
535    std::is_arithmetic<_A2>::value,
536    bool
537>::type
538isless(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
539{
540    typedef typename std::__promote<_A1, _A2>::type type;
541    return __libcpp_isless((type)__lcpp_x, (type)__lcpp_y);
542}
543
544#endif  // isless
545
546// islessequal
547
548#ifdef islessequal
549
550template <class _A1, class _A2>
551_LIBCPP_ALWAYS_INLINE
552bool
553__libcpp_islessequal(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
554{
555    return islessequal(__lcpp_x, __lcpp_y);
556}
557
558#undef islessequal
559
560template <class _A1, class _A2>
561inline _LIBCPP_INLINE_VISIBILITY
562typename std::enable_if
563<
564    std::is_arithmetic<_A1>::value &&
565    std::is_arithmetic<_A2>::value,
566    bool
567>::type
568islessequal(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
569{
570    typedef typename std::__promote<_A1, _A2>::type type;
571    return __libcpp_islessequal((type)__lcpp_x, (type)__lcpp_y);
572}
573
574#endif  // islessequal
575
576// islessgreater
577
578#ifdef islessgreater
579
580template <class _A1, class _A2>
581_LIBCPP_ALWAYS_INLINE
582bool
583__libcpp_islessgreater(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
584{
585    return islessgreater(__lcpp_x, __lcpp_y);
586}
587
588#undef islessgreater
589
590template <class _A1, class _A2>
591inline _LIBCPP_INLINE_VISIBILITY
592typename std::enable_if
593<
594    std::is_arithmetic<_A1>::value &&
595    std::is_arithmetic<_A2>::value,
596    bool
597>::type
598islessgreater(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
599{
600    typedef typename std::__promote<_A1, _A2>::type type;
601    return __libcpp_islessgreater((type)__lcpp_x, (type)__lcpp_y);
602}
603
604#endif  // islessgreater
605
606// isunordered
607
608#ifdef isunordered
609
610template <class _A1, class _A2>
611_LIBCPP_ALWAYS_INLINE
612bool
613__libcpp_isunordered(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
614{
615    return isunordered(__lcpp_x, __lcpp_y);
616}
617
618#undef isunordered
619
620template <class _A1, class _A2>
621inline _LIBCPP_INLINE_VISIBILITY
622typename std::enable_if
623<
624    std::is_arithmetic<_A1>::value &&
625    std::is_arithmetic<_A2>::value,
626    bool
627>::type
628isunordered(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
629{
630    typedef typename std::__promote<_A1, _A2>::type type;
631    return __libcpp_isunordered((type)__lcpp_x, (type)__lcpp_y);
632}
633
634#endif  // isunordered
635
636_LIBCPP_BEGIN_NAMESPACE_STD
637
638using ::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
652using ::float_t;
653using ::double_t;
654
655// abs
656
657#if !defined(_AIX)
658inline _LIBCPP_INLINE_VISIBILITY
659float
660abs(float __lcpp_x) _NOEXCEPT {return fabsf(__lcpp_x);}
661
662inline _LIBCPP_INLINE_VISIBILITY
663double
664abs(double __lcpp_x) _NOEXCEPT {return fabs(__lcpp_x);}
665
666inline _LIBCPP_INLINE_VISIBILITY
667long double
668abs(long double __lcpp_x) _NOEXCEPT {return fabsl(__lcpp_x);}
669#endif // !defined(_AIX)
670
671#ifndef __sun__
672
673// acos
674
675using ::acos;
676using ::acosf;
677
678#if !(defined(_LIBCPP_MSVCRT) || defined(_AIX))
679inline _LIBCPP_INLINE_VISIBILITY float       acos(float __lcpp_x) _NOEXCEPT       {return acosf(__lcpp_x);}
680inline _LIBCPP_INLINE_VISIBILITY long double acos(long double __lcpp_x) _NOEXCEPT {return acosl(__lcpp_x);}
681#endif
682
683template <class _A1>
684inline _LIBCPP_INLINE_VISIBILITY
685typename enable_if<is_integral<_A1>::value, double>::type
686acos(_A1 __lcpp_x) _NOEXCEPT {return acos((double)__lcpp_x);}
687
688// asin
689
690using ::asin;
691using ::asinf;
692
693#if !(defined(_LIBCPP_MSVCRT) || defined(_AIX))
694inline _LIBCPP_INLINE_VISIBILITY float       asin(float __lcpp_x) _NOEXCEPT       {return asinf(__lcpp_x);}
695inline _LIBCPP_INLINE_VISIBILITY long double asin(long double __lcpp_x) _NOEXCEPT {return asinl(__lcpp_x);}
696#endif
697
698template <class _A1>
699inline _LIBCPP_INLINE_VISIBILITY
700typename enable_if<is_integral<_A1>::value, double>::type
701asin(_A1 __lcpp_x) _NOEXCEPT {return asin((double)__lcpp_x);}
702
703// atan
704
705using ::atan;
706using ::atanf;
707
708#if !(defined(_LIBCPP_MSVCRT) || defined(_AIX))
709inline _LIBCPP_INLINE_VISIBILITY float       atan(float __lcpp_x) _NOEXCEPT       {return atanf(__lcpp_x);}
710inline _LIBCPP_INLINE_VISIBILITY long double atan(long double __lcpp_x) _NOEXCEPT {return atanl(__lcpp_x);}
711#endif
712
713template <class _A1>
714inline _LIBCPP_INLINE_VISIBILITY
715typename enable_if<is_integral<_A1>::value, double>::type
716atan(_A1 __lcpp_x) _NOEXCEPT {return atan((double)__lcpp_x);}
717
718// atan2
719
720using ::atan2;
721using ::atan2f;
722
723#if !(defined(_LIBCPP_MSVCRT) || defined(_AIX))
724inline _LIBCPP_INLINE_VISIBILITY float       atan2(float __lcpp_y, float __lcpp_x) _NOEXCEPT             {return atan2f(__lcpp_y, __lcpp_x);}
725inline _LIBCPP_INLINE_VISIBILITY long double atan2(long double __lcpp_y, long double __lcpp_x) _NOEXCEPT {return atan2l(__lcpp_y, __lcpp_x);}
726#endif
727
728template <class _A1, class _A2>
729inline _LIBCPP_INLINE_VISIBILITY
730typename __lazy_enable_if
731<
732    is_arithmetic<_A1>::value &&
733    is_arithmetic<_A2>::value,
734    __promote<_A1, _A2>
735>::type
736atan2(_A1 __lcpp_y, _A2 __lcpp_x) _NOEXCEPT
737{
738    typedef typename __promote<_A1, _A2>::type __result_type;
739    static_assert((!(is_same<_A1, __result_type>::value &&
740                      is_same<_A2, __result_type>::value)), "");
741    return atan2((__result_type)__lcpp_y, (__result_type)__lcpp_x);
742}
743
744// ceil
745
746using ::ceil;
747using ::ceilf;
748
749#if !(defined(_LIBCPP_MSVCRT) || defined(_AIX))
750inline _LIBCPP_INLINE_VISIBILITY float       ceil(float __lcpp_x) _NOEXCEPT       {return ceilf(__lcpp_x);}
751inline _LIBCPP_INLINE_VISIBILITY long double ceil(long double __lcpp_x) _NOEXCEPT {return ceill(__lcpp_x);}
752#endif
753
754template <class _A1>
755inline _LIBCPP_INLINE_VISIBILITY
756typename enable_if<is_integral<_A1>::value, double>::type
757ceil(_A1 __lcpp_x) _NOEXCEPT {return ceil((double)__lcpp_x);}
758
759// cos
760
761using ::cos;
762using ::cosf;
763
764#if !(defined(_LIBCPP_MSVCRT) || defined(_AIX))
765inline _LIBCPP_INLINE_VISIBILITY float       cos(float __lcpp_x) _NOEXCEPT       {return cosf(__lcpp_x);}
766inline _LIBCPP_INLINE_VISIBILITY long double cos(long double __lcpp_x) _NOEXCEPT {return cosl(__lcpp_x);}
767#endif
768
769template <class _A1>
770inline _LIBCPP_INLINE_VISIBILITY
771typename enable_if<is_integral<_A1>::value, double>::type
772cos(_A1 __lcpp_x) _NOEXCEPT {return cos((double)__lcpp_x);}
773
774// cosh
775
776using ::cosh;
777using ::coshf;
778
779#if !(defined(_LIBCPP_MSVCRT) || defined(_AIX))
780inline _LIBCPP_INLINE_VISIBILITY float       cosh(float __lcpp_x) _NOEXCEPT       {return coshf(__lcpp_x);}
781inline _LIBCPP_INLINE_VISIBILITY long double cosh(long double __lcpp_x) _NOEXCEPT {return coshl(__lcpp_x);}
782#endif
783
784template <class _A1>
785inline _LIBCPP_INLINE_VISIBILITY
786typename enable_if<is_integral<_A1>::value, double>::type
787cosh(_A1 __lcpp_x) _NOEXCEPT {return cosh((double)__lcpp_x);}
788
789#endif // __sun__
790// exp
791
792using ::exp;
793using ::expf;
794
795#ifndef __sun__
796
797#if !(defined(_LIBCPP_MSVCRT) || defined(_AIX))
798inline _LIBCPP_INLINE_VISIBILITY float       exp(float __lcpp_x) _NOEXCEPT       {return expf(__lcpp_x);}
799inline _LIBCPP_INLINE_VISIBILITY long double exp(long double __lcpp_x) _NOEXCEPT {return expl(__lcpp_x);}
800#endif
801
802
803template <class _A1>
804inline _LIBCPP_INLINE_VISIBILITY
805typename enable_if<is_integral<_A1>::value, double>::type
806exp(_A1 __lcpp_x) _NOEXCEPT {return exp((double)__lcpp_x);}
807
808// fabs
809
810using ::fabs;
811using ::fabsf;
812
813#if !(defined(_LIBCPP_MSVCRT) || defined(_AIX))
814inline _LIBCPP_INLINE_VISIBILITY float       fabs(float __lcpp_x) _NOEXCEPT       {return fabsf(__lcpp_x);}
815inline _LIBCPP_INLINE_VISIBILITY long double fabs(long double __lcpp_x) _NOEXCEPT {return fabsl(__lcpp_x);}
816#endif
817
818template <class _A1>
819inline _LIBCPP_INLINE_VISIBILITY
820typename enable_if<is_integral<_A1>::value, double>::type
821fabs(_A1 __lcpp_x) _NOEXCEPT {return fabs((double)__lcpp_x);}
822
823// floor
824
825using ::floor;
826using ::floorf;
827
828#if !(defined(_LIBCPP_MSVCRT) || defined(_AIX))
829inline _LIBCPP_INLINE_VISIBILITY float       floor(float __lcpp_x) _NOEXCEPT       {return floorf(__lcpp_x);}
830inline _LIBCPP_INLINE_VISIBILITY long double floor(long double __lcpp_x) _NOEXCEPT {return floorl(__lcpp_x);}
831#endif
832
833template <class _A1>
834inline _LIBCPP_INLINE_VISIBILITY
835typename enable_if<is_integral<_A1>::value, double>::type
836floor(_A1 __lcpp_x) _NOEXCEPT {return floor((double)__lcpp_x);}
837
838// fmod
839
840#endif //__sun__
841using ::fmod;
842using ::fmodf;
843#ifndef __sun__
844
845#if !(defined(_LIBCPP_MSVCRT) || defined(_AIX))
846inline _LIBCPP_INLINE_VISIBILITY float       fmod(float __lcpp_x, float __lcpp_y) _NOEXCEPT             {return fmodf(__lcpp_x, __lcpp_y);}
847inline _LIBCPP_INLINE_VISIBILITY long double fmod(long double __lcpp_x, long double __lcpp_y) _NOEXCEPT {return fmodl(__lcpp_x, __lcpp_y);}
848#endif
849
850template <class _A1, class _A2>
851inline _LIBCPP_INLINE_VISIBILITY
852typename __lazy_enable_if
853<
854    is_arithmetic<_A1>::value &&
855    is_arithmetic<_A2>::value,
856    __promote<_A1, _A2>
857>::type
858fmod(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
859{
860    typedef typename __promote<_A1, _A2>::type __result_type;
861    static_assert((!(is_same<_A1, __result_type>::value &&
862                      is_same<_A2, __result_type>::value)), "");
863    return fmod((__result_type)__lcpp_x, (__result_type)__lcpp_y);
864}
865
866
867// frexp
868
869using ::frexp;
870using ::frexpf;
871
872#if !(defined(_LIBCPP_MSVCRT) || defined(_AIX))
873inline _LIBCPP_INLINE_VISIBILITY float       frexp(float __lcpp_x, int* __lcpp_e) _NOEXCEPT       {return frexpf(__lcpp_x, __lcpp_e);}
874inline _LIBCPP_INLINE_VISIBILITY long double frexp(long double __lcpp_x, int* __lcpp_e) _NOEXCEPT {return frexpl(__lcpp_x, __lcpp_e);}
875#endif
876
877template <class _A1>
878inline _LIBCPP_INLINE_VISIBILITY
879typename enable_if<is_integral<_A1>::value, double>::type
880frexp(_A1 __lcpp_x, int* __lcpp_e) _NOEXCEPT {return frexp((double)__lcpp_x, __lcpp_e);}
881
882// ldexp
883
884using ::ldexp;
885using ::ldexpf;
886
887#if !(defined(_LIBCPP_MSVCRT) || defined(_AIX))
888inline _LIBCPP_INLINE_VISIBILITY float       ldexp(float __lcpp_x, int __lcpp_e) _NOEXCEPT       {return ldexpf(__lcpp_x, __lcpp_e);}
889inline _LIBCPP_INLINE_VISIBILITY long double ldexp(long double __lcpp_x, int __lcpp_e) _NOEXCEPT {return ldexpl(__lcpp_x, __lcpp_e);}
890#endif
891
892template <class _A1>
893inline _LIBCPP_INLINE_VISIBILITY
894typename enable_if<is_integral<_A1>::value, double>::type
895ldexp(_A1 __lcpp_x, int __lcpp_e) _NOEXCEPT {return ldexp((double)__lcpp_x, __lcpp_e);}
896
897// log
898
899#endif // __sun__
900using ::log;
901using ::logf;
902#ifndef __sun__
903
904#if !(defined(_LIBCPP_MSVCRT) || defined(_AIX))
905inline _LIBCPP_INLINE_VISIBILITY float       log(float __lcpp_x) _NOEXCEPT       {return logf(__lcpp_x);}
906inline _LIBCPP_INLINE_VISIBILITY long double log(long double __lcpp_x) _NOEXCEPT {return logl(__lcpp_x);}
907#endif
908
909template <class _A1>
910inline _LIBCPP_INLINE_VISIBILITY
911typename enable_if<is_integral<_A1>::value, double>::type
912log(_A1 __lcpp_x) _NOEXCEPT {return log((double)__lcpp_x);}
913
914
915// log10
916
917using ::log10;
918using ::log10f;
919
920#if !(defined(_LIBCPP_MSVCRT) || defined(_AIX))
921inline _LIBCPP_INLINE_VISIBILITY float       log10(float __lcpp_x) _NOEXCEPT       {return log10f(__lcpp_x);}
922inline _LIBCPP_INLINE_VISIBILITY long double log10(long double __lcpp_x) _NOEXCEPT {return log10l(__lcpp_x);}
923#endif
924
925template <class _A1>
926inline _LIBCPP_INLINE_VISIBILITY
927typename enable_if<is_integral<_A1>::value, double>::type
928log10(_A1 __lcpp_x) _NOEXCEPT {return log10((double)__lcpp_x);}
929
930// modf
931
932using ::modf;
933using ::modff;
934
935#if !(defined(_LIBCPP_MSVCRT) || defined(_AIX))
936inline _LIBCPP_INLINE_VISIBILITY float       modf(float __lcpp_x, float* __lcpp_y) _NOEXCEPT             {return modff(__lcpp_x, __lcpp_y);}
937inline _LIBCPP_INLINE_VISIBILITY long double modf(long double __lcpp_x, long double* __lcpp_y) _NOEXCEPT {return modfl(__lcpp_x, __lcpp_y);}
938#endif
939
940// pow
941
942#endif // __sun__ 
943using ::pow;
944using ::powf;
945
946#ifndef __sun__
947
948#if !(defined(_LIBCPP_MSVCRT) || defined(_AIX))
949inline _LIBCPP_INLINE_VISIBILITY float       pow(float __lcpp_x, float __lcpp_y) _NOEXCEPT             {return powf(__lcpp_x, __lcpp_y);}
950inline _LIBCPP_INLINE_VISIBILITY long double pow(long double __lcpp_x, long double __lcpp_y) _NOEXCEPT {return powl(__lcpp_x, __lcpp_y);}
951#endif
952
953template <class _A1, class _A2>
954inline _LIBCPP_INLINE_VISIBILITY
955typename __lazy_enable_if
956<
957    is_arithmetic<_A1>::value &&
958    is_arithmetic<_A2>::value,
959    __promote<_A1, _A2>
960>::type
961pow(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
962{
963    typedef typename __promote<_A1, _A2>::type __result_type;
964    static_assert((!(is_same<_A1, __result_type>::value &&
965                      is_same<_A2, __result_type>::value)), "");
966    return pow((__result_type)__lcpp_x, (__result_type)__lcpp_y);
967}
968
969// sin
970
971using ::sin;
972using ::sinf;
973
974#if !(defined(_LIBCPP_MSVCRT) || defined(_AIX))
975inline _LIBCPP_INLINE_VISIBILITY float       sin(float __lcpp_x) _NOEXCEPT       {return sinf(__lcpp_x);}
976inline _LIBCPP_INLINE_VISIBILITY long double sin(long double __lcpp_x) _NOEXCEPT {return sinl(__lcpp_x);}
977#endif
978
979template <class _A1>
980inline _LIBCPP_INLINE_VISIBILITY
981typename enable_if<is_integral<_A1>::value, double>::type
982sin(_A1 __lcpp_x) _NOEXCEPT {return sin((double)__lcpp_x);}
983
984// sinh
985
986using ::sinh;
987using ::sinhf;
988
989#if !(defined(_LIBCPP_MSVCRT) || defined(_AIX))
990inline _LIBCPP_INLINE_VISIBILITY float       sinh(float __lcpp_x) _NOEXCEPT       {return sinhf(__lcpp_x);}
991inline _LIBCPP_INLINE_VISIBILITY long double sinh(long double __lcpp_x) _NOEXCEPT {return sinhl(__lcpp_x);}
992#endif
993
994template <class _A1>
995inline _LIBCPP_INLINE_VISIBILITY
996typename enable_if<is_integral<_A1>::value, double>::type
997sinh(_A1 __lcpp_x) _NOEXCEPT {return sinh((double)__lcpp_x);}
998
999// sqrt
1000
1001#endif // __sun__
1002using ::sqrt;
1003using ::sqrtf;
1004
1005
1006#if !(defined(_LIBCPP_MSVCRT) || defined(__sun__) || defined(_AIX))
1007inline _LIBCPP_INLINE_VISIBILITY float       sqrt(float __lcpp_x) _NOEXCEPT       {return sqrtf(__lcpp_x);}
1008inline _LIBCPP_INLINE_VISIBILITY long double sqrt(long double __lcpp_x) _NOEXCEPT {return sqrtl(__lcpp_x);}
1009#endif
1010
1011template <class _A1>
1012inline _LIBCPP_INLINE_VISIBILITY
1013typename enable_if<is_integral<_A1>::value, double>::type
1014sqrt(_A1 __lcpp_x) _NOEXCEPT {return sqrt((double)__lcpp_x);}
1015
1016// tan
1017
1018using ::tan;
1019using ::tanf;
1020#ifndef __sun__
1021
1022#if !(defined(_LIBCPP_MSVCRT) || defined(_AIX))
1023inline _LIBCPP_INLINE_VISIBILITY float       tan(float __lcpp_x) _NOEXCEPT       {return tanf(__lcpp_x);}
1024inline _LIBCPP_INLINE_VISIBILITY long double tan(long double __lcpp_x) _NOEXCEPT {return tanl(__lcpp_x);}
1025#endif
1026
1027template <class _A1>
1028inline _LIBCPP_INLINE_VISIBILITY
1029typename enable_if<is_integral<_A1>::value, double>::type
1030tan(_A1 __lcpp_x) _NOEXCEPT {return tan((double)__lcpp_x);}
1031
1032// tanh
1033
1034using ::tanh;
1035using ::tanhf;
1036
1037#if !(defined(_LIBCPP_MSVCRT) || defined(_AIX))
1038inline _LIBCPP_INLINE_VISIBILITY float       tanh(float __lcpp_x) _NOEXCEPT       {return tanhf(__lcpp_x);}
1039inline _LIBCPP_INLINE_VISIBILITY long double tanh(long double __lcpp_x) _NOEXCEPT {return tanhl(__lcpp_x);}
1040#endif
1041
1042template <class _A1>
1043inline _LIBCPP_INLINE_VISIBILITY
1044typename enable_if<is_integral<_A1>::value, double>::type
1045tanh(_A1 __lcpp_x) _NOEXCEPT {return tanh((double)__lcpp_x);}
1046
1047// acosh
1048
1049#ifndef _LIBCPP_MSVCRT
1050using ::acosh;
1051using ::acoshf;
1052
1053inline _LIBCPP_INLINE_VISIBILITY float       acosh(float __lcpp_x) _NOEXCEPT       {return acoshf(__lcpp_x);}
1054inline _LIBCPP_INLINE_VISIBILITY long double acosh(long double __lcpp_x) _NOEXCEPT {return acoshl(__lcpp_x);}
1055
1056template <class _A1>
1057inline _LIBCPP_INLINE_VISIBILITY
1058typename enable_if<is_integral<_A1>::value, double>::type
1059acosh(_A1 __lcpp_x) _NOEXCEPT {return acosh((double)__lcpp_x);}
1060#endif
1061
1062// asinh
1063
1064#ifndef _LIBCPP_MSVCRT
1065using ::asinh;
1066using ::asinhf;
1067
1068inline _LIBCPP_INLINE_VISIBILITY float       asinh(float __lcpp_x) _NOEXCEPT       {return asinhf(__lcpp_x);}
1069inline _LIBCPP_INLINE_VISIBILITY long double asinh(long double __lcpp_x) _NOEXCEPT {return asinhl(__lcpp_x);}
1070
1071template <class _A1>
1072inline _LIBCPP_INLINE_VISIBILITY
1073typename enable_if<is_integral<_A1>::value, double>::type
1074asinh(_A1 __lcpp_x) _NOEXCEPT {return asinh((double)__lcpp_x);}
1075#endif
1076
1077// atanh
1078
1079#ifndef _LIBCPP_MSVCRT
1080using ::atanh;
1081using ::atanhf;
1082
1083inline _LIBCPP_INLINE_VISIBILITY float       atanh(float __lcpp_x) _NOEXCEPT       {return atanhf(__lcpp_x);}
1084inline _LIBCPP_INLINE_VISIBILITY long double atanh(long double __lcpp_x) _NOEXCEPT {return atanhl(__lcpp_x);}
1085
1086template <class _A1>
1087inline _LIBCPP_INLINE_VISIBILITY
1088typename enable_if<is_integral<_A1>::value, double>::type
1089atanh(_A1 __lcpp_x) _NOEXCEPT {return atanh((double)__lcpp_x);}
1090#endif
1091
1092// cbrt
1093
1094#ifndef _LIBCPP_MSVCRT
1095using ::cbrt;
1096using ::cbrtf;
1097
1098inline _LIBCPP_INLINE_VISIBILITY float       cbrt(float __lcpp_x) _NOEXCEPT       {return cbrtf(__lcpp_x);}
1099inline _LIBCPP_INLINE_VISIBILITY long double cbrt(long double __lcpp_x) _NOEXCEPT {return cbrtl(__lcpp_x);}
1100
1101template <class _A1>
1102inline _LIBCPP_INLINE_VISIBILITY
1103typename enable_if<is_integral<_A1>::value, double>::type
1104cbrt(_A1 __lcpp_x) _NOEXCEPT {return cbrt((double)__lcpp_x);}
1105#endif
1106
1107// copysign
1108
1109using ::copysign;
1110using ::copysignf;
1111
1112inline _LIBCPP_INLINE_VISIBILITY float       copysign(float __lcpp_x, float __lcpp_y) _NOEXCEPT             {return copysignf(__lcpp_x, __lcpp_y);}
1113inline _LIBCPP_INLINE_VISIBILITY long double copysign(long double __lcpp_x, long double __lcpp_y) _NOEXCEPT {return copysignl(__lcpp_x, __lcpp_y);}
1114
1115template <class _A1, class _A2>
1116inline _LIBCPP_INLINE_VISIBILITY
1117typename __lazy_enable_if
1118<
1119    is_arithmetic<_A1>::value &&
1120    is_arithmetic<_A2>::value,
1121    __promote<_A1, _A2>
1122>::type
1123copysign(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
1124{
1125    typedef typename __promote<_A1, _A2>::type __result_type;
1126    static_assert((!(is_same<_A1, __result_type>::value &&
1127                      is_same<_A2, __result_type>::value)), "");
1128    return copysign((__result_type)__lcpp_x, (__result_type)__lcpp_y);
1129}
1130
1131#ifndef _LIBCPP_MSVCRT
1132
1133// erf
1134
1135using ::erf;
1136using ::erff;
1137
1138inline _LIBCPP_INLINE_VISIBILITY float       erf(float __lcpp_x) _NOEXCEPT       {return erff(__lcpp_x);}
1139inline _LIBCPP_INLINE_VISIBILITY long double erf(long double __lcpp_x) _NOEXCEPT {return erfl(__lcpp_x);}
1140
1141template <class _A1>
1142inline _LIBCPP_INLINE_VISIBILITY
1143typename enable_if<is_integral<_A1>::value, double>::type
1144erf(_A1 __lcpp_x) _NOEXCEPT {return erf((double)__lcpp_x);}
1145
1146// erfc
1147
1148using ::erfc;
1149using ::erfcf;
1150
1151inline _LIBCPP_INLINE_VISIBILITY float       erfc(float __lcpp_x) _NOEXCEPT       {return erfcf(__lcpp_x);}
1152inline _LIBCPP_INLINE_VISIBILITY long double erfc(long double __lcpp_x) _NOEXCEPT {return erfcl(__lcpp_x);}
1153
1154template <class _A1>
1155inline _LIBCPP_INLINE_VISIBILITY
1156typename enable_if<is_integral<_A1>::value, double>::type
1157erfc(_A1 __lcpp_x) _NOEXCEPT {return erfc((double)__lcpp_x);}
1158
1159// exp2
1160
1161using ::exp2;
1162using ::exp2f;
1163
1164inline _LIBCPP_INLINE_VISIBILITY float       exp2(float __lcpp_x) _NOEXCEPT       {return exp2f(__lcpp_x);}
1165inline _LIBCPP_INLINE_VISIBILITY long double exp2(long double __lcpp_x) _NOEXCEPT {return exp2l(__lcpp_x);}
1166
1167template <class _A1>
1168inline _LIBCPP_INLINE_VISIBILITY
1169typename enable_if<is_integral<_A1>::value, double>::type
1170exp2(_A1 __lcpp_x) _NOEXCEPT {return exp2((double)__lcpp_x);}
1171
1172// expm1
1173
1174using ::expm1;
1175using ::expm1f;
1176
1177inline _LIBCPP_INLINE_VISIBILITY float       expm1(float __lcpp_x) _NOEXCEPT       {return expm1f(__lcpp_x);}
1178inline _LIBCPP_INLINE_VISIBILITY long double expm1(long double __lcpp_x) _NOEXCEPT {return expm1l(__lcpp_x);}
1179
1180template <class _A1>
1181inline _LIBCPP_INLINE_VISIBILITY
1182typename enable_if<is_integral<_A1>::value, double>::type
1183expm1(_A1 __lcpp_x) _NOEXCEPT {return expm1((double)__lcpp_x);}
1184
1185// fdim
1186
1187using ::fdim;
1188using ::fdimf;
1189
1190inline _LIBCPP_INLINE_VISIBILITY float       fdim(float __lcpp_x, float __lcpp_y) _NOEXCEPT             {return fdimf(__lcpp_x, __lcpp_y);}
1191inline _LIBCPP_INLINE_VISIBILITY long double fdim(long double __lcpp_x, long double __lcpp_y) _NOEXCEPT {return fdiml(__lcpp_x, __lcpp_y);}
1192
1193template <class _A1, class _A2>
1194inline _LIBCPP_INLINE_VISIBILITY
1195typename __lazy_enable_if
1196<
1197    is_arithmetic<_A1>::value &&
1198    is_arithmetic<_A2>::value,
1199    __promote<_A1, _A2>
1200>::type
1201fdim(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
1202{
1203    typedef typename __promote<_A1, _A2>::type __result_type;
1204    static_assert((!(is_same<_A1, __result_type>::value &&
1205                      is_same<_A2, __result_type>::value)), "");
1206    return fdim((__result_type)__lcpp_x, (__result_type)__lcpp_y);
1207}
1208
1209// fma
1210
1211using ::fmaf;
1212using ::fma;
1213
1214inline _LIBCPP_INLINE_VISIBILITY float       fma(float __lcpp_x, float __lcpp_y, float __lcpp_z) _NOEXCEPT                   {return fmaf(__lcpp_x, __lcpp_y, __lcpp_z);}
1215inline _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);}
1216
1217template <class _A1, class _A2, class _A3>
1218inline _LIBCPP_INLINE_VISIBILITY
1219typename __lazy_enable_if
1220<
1221    is_arithmetic<_A1>::value &&
1222    is_arithmetic<_A2>::value &&
1223    is_arithmetic<_A3>::value,
1224    __promote<_A1, _A2, _A3>
1225>::type
1226fma(_A1 __lcpp_x, _A2 __lcpp_y, _A3 __lcpp_z) _NOEXCEPT
1227{
1228    typedef typename __promote<_A1, _A2, _A3>::type __result_type;
1229    static_assert((!(is_same<_A1, __result_type>::value &&
1230                      is_same<_A2, __result_type>::value &&
1231                      is_same<_A3, __result_type>::value)), "");
1232    return fma((__result_type)__lcpp_x, (__result_type)__lcpp_y, (__result_type)__lcpp_z);
1233}
1234
1235// fmax
1236
1237using ::fmax;
1238using ::fmaxf;
1239
1240inline _LIBCPP_INLINE_VISIBILITY float       fmax(float __lcpp_x, float __lcpp_y) _NOEXCEPT             {return fmaxf(__lcpp_x, __lcpp_y);}
1241inline _LIBCPP_INLINE_VISIBILITY long double fmax(long double __lcpp_x, long double __lcpp_y) _NOEXCEPT {return fmaxl(__lcpp_x, __lcpp_y);}
1242
1243template <class _A1, class _A2>
1244inline _LIBCPP_INLINE_VISIBILITY
1245typename __lazy_enable_if
1246<
1247    is_arithmetic<_A1>::value &&
1248    is_arithmetic<_A2>::value,
1249    __promote<_A1, _A2>
1250>::type
1251fmax(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
1252{
1253    typedef typename __promote<_A1, _A2>::type __result_type;
1254    static_assert((!(is_same<_A1, __result_type>::value &&
1255                      is_same<_A2, __result_type>::value)), "");
1256    return fmax((__result_type)__lcpp_x, (__result_type)__lcpp_y);
1257}
1258
1259// fmin
1260
1261using ::fmin;
1262using ::fminf;
1263
1264inline _LIBCPP_INLINE_VISIBILITY float       fmin(float __lcpp_x, float __lcpp_y) _NOEXCEPT             {return fminf(__lcpp_x, __lcpp_y);}
1265inline _LIBCPP_INLINE_VISIBILITY long double fmin(long double __lcpp_x, long double __lcpp_y) _NOEXCEPT {return fminl(__lcpp_x, __lcpp_y);}
1266
1267template <class _A1, class _A2>
1268inline _LIBCPP_INLINE_VISIBILITY
1269typename __lazy_enable_if
1270<
1271    is_arithmetic<_A1>::value &&
1272    is_arithmetic<_A2>::value,
1273    __promote<_A1, _A2>
1274>::type
1275fmin(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
1276{
1277    typedef typename __promote<_A1, _A2>::type __result_type;
1278    static_assert((!(is_same<_A1, __result_type>::value &&
1279                      is_same<_A2, __result_type>::value)), "");
1280    return fmin((__result_type)__lcpp_x, (__result_type)__lcpp_y);
1281}
1282
1283// hypot
1284
1285using ::hypot;
1286using ::hypotf;
1287
1288inline _LIBCPP_INLINE_VISIBILITY float       hypot(float __lcpp_x, float __lcpp_y) _NOEXCEPT             {return hypotf(__lcpp_x, __lcpp_y);}
1289inline _LIBCPP_INLINE_VISIBILITY long double hypot(long double __lcpp_x, long double __lcpp_y) _NOEXCEPT {return hypotl(__lcpp_x, __lcpp_y);}
1290
1291template <class _A1, class _A2>
1292inline _LIBCPP_INLINE_VISIBILITY
1293typename __lazy_enable_if
1294<
1295    is_arithmetic<_A1>::value &&
1296    is_arithmetic<_A2>::value,
1297    __promote<_A1, _A2>
1298>::type
1299hypot(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
1300{
1301    typedef typename __promote<_A1, _A2>::type __result_type;
1302    static_assert((!(is_same<_A1, __result_type>::value &&
1303                      is_same<_A2, __result_type>::value)), "");
1304    return hypot((__result_type)__lcpp_x, (__result_type)__lcpp_y);
1305}
1306
1307// ilogb
1308
1309using ::ilogb;
1310using ::ilogbf;
1311
1312inline _LIBCPP_INLINE_VISIBILITY int ilogb(float __lcpp_x) _NOEXCEPT       {return ilogbf(__lcpp_x);}
1313inline _LIBCPP_INLINE_VISIBILITY int ilogb(long double __lcpp_x) _NOEXCEPT {return ilogbl(__lcpp_x);}
1314
1315template <class _A1>
1316inline _LIBCPP_INLINE_VISIBILITY
1317typename enable_if<is_integral<_A1>::value, int>::type
1318ilogb(_A1 __lcpp_x) _NOEXCEPT {return ilogb((double)__lcpp_x);}
1319
1320// lgamma
1321
1322using ::lgamma;
1323using ::lgammaf;
1324
1325inline _LIBCPP_INLINE_VISIBILITY float       lgamma(float __lcpp_x) _NOEXCEPT       {return lgammaf(__lcpp_x);}
1326inline _LIBCPP_INLINE_VISIBILITY long double lgamma(long double __lcpp_x) _NOEXCEPT {return lgammal(__lcpp_x);}
1327
1328
1329template <class _A1>
1330inline _LIBCPP_INLINE_VISIBILITY
1331typename enable_if<is_integral<_A1>::value, double>::type
1332lgamma(_A1 __lcpp_x) _NOEXCEPT {return lgamma((double)__lcpp_x);}
1333
1334
1335// llrint
1336
1337using ::llrint;
1338using ::llrintf;
1339
1340inline _LIBCPP_INLINE_VISIBILITY long long llrint(float __lcpp_x) _NOEXCEPT       {return llrintf(__lcpp_x);}
1341inline _LIBCPP_INLINE_VISIBILITY long long llrint(long double __lcpp_x) _NOEXCEPT {return llrintl(__lcpp_x);}
1342
1343template <class _A1>
1344inline _LIBCPP_INLINE_VISIBILITY
1345typename enable_if<is_integral<_A1>::value, long long>::type
1346llrint(_A1 __lcpp_x) _NOEXCEPT {return llrint((double)__lcpp_x);}
1347
1348// llround
1349
1350using ::llround;
1351using ::llroundf;
1352
1353inline _LIBCPP_INLINE_VISIBILITY long long llround(float __lcpp_x) _NOEXCEPT       {return llroundf(__lcpp_x);}
1354inline _LIBCPP_INLINE_VISIBILITY long long llround(long double __lcpp_x) _NOEXCEPT {return llroundl(__lcpp_x);}
1355
1356template <class _A1>
1357inline _LIBCPP_INLINE_VISIBILITY
1358typename enable_if<is_integral<_A1>::value, long long>::type
1359llround(_A1 __lcpp_x) _NOEXCEPT {return llround((double)__lcpp_x);}
1360
1361// log1p
1362
1363using ::log1p;
1364using ::log1pf;
1365
1366inline _LIBCPP_INLINE_VISIBILITY float       log1p(float __lcpp_x) _NOEXCEPT       {return log1pf(__lcpp_x);}
1367inline _LIBCPP_INLINE_VISIBILITY long double log1p(long double __lcpp_x) _NOEXCEPT {return log1pl(__lcpp_x);}
1368
1369template <class _A1>
1370inline _LIBCPP_INLINE_VISIBILITY
1371typename enable_if<is_integral<_A1>::value, double>::type
1372log1p(_A1 __lcpp_x) _NOEXCEPT {return log1p((double)__lcpp_x);}
1373
1374// log2
1375
1376using ::log2;
1377using ::log2f;
1378
1379inline _LIBCPP_INLINE_VISIBILITY float       log2(float __lcpp_x) _NOEXCEPT       {return log2f(__lcpp_x);}
1380inline _LIBCPP_INLINE_VISIBILITY long double log2(long double __lcpp_x) _NOEXCEPT {return log2l(__lcpp_x);}
1381
1382template <class _A1>
1383inline _LIBCPP_INLINE_VISIBILITY
1384typename enable_if<is_integral<_A1>::value, double>::type
1385log2(_A1 __lcpp_x) _NOEXCEPT {return log2((double)__lcpp_x);}
1386
1387// logb
1388
1389using ::logb;
1390using ::logbf;
1391
1392inline _LIBCPP_INLINE_VISIBILITY float       logb(float __lcpp_x) _NOEXCEPT       {return logbf(__lcpp_x);}
1393inline _LIBCPP_INLINE_VISIBILITY long double logb(long double __lcpp_x) _NOEXCEPT {return logbl(__lcpp_x);}
1394
1395template <class _A1>
1396inline _LIBCPP_INLINE_VISIBILITY
1397typename enable_if<is_integral<_A1>::value, double>::type
1398logb(_A1 __lcpp_x) _NOEXCEPT {return logb((double)__lcpp_x);}
1399
1400// lrint
1401
1402using ::lrint;
1403using ::lrintf;
1404
1405inline _LIBCPP_INLINE_VISIBILITY long lrint(float __lcpp_x) _NOEXCEPT       {return lrintf(__lcpp_x);}
1406inline _LIBCPP_INLINE_VISIBILITY long lrint(long double __lcpp_x) _NOEXCEPT {return lrintl(__lcpp_x);}
1407
1408template <class _A1>
1409inline _LIBCPP_INLINE_VISIBILITY
1410typename enable_if<is_integral<_A1>::value, long>::type
1411lrint(_A1 __lcpp_x) _NOEXCEPT {return lrint((double)__lcpp_x);}
1412
1413// lround
1414
1415using ::lround;
1416using ::lroundf;
1417
1418inline _LIBCPP_INLINE_VISIBILITY long lround(float __lcpp_x) _NOEXCEPT       {return lroundf(__lcpp_x);}
1419inline _LIBCPP_INLINE_VISIBILITY long lround(long double __lcpp_x) _NOEXCEPT {return lroundl(__lcpp_x);}
1420
1421template <class _A1>
1422inline _LIBCPP_INLINE_VISIBILITY
1423typename enable_if<is_integral<_A1>::value, long>::type
1424lround(_A1 __lcpp_x) _NOEXCEPT {return lround((double)__lcpp_x);}
1425
1426#endif // _LIBCPP_MSVCRT
1427#endif // __sun__
1428
1429// nan
1430
1431#ifndef _LIBCPP_MSVCRT
1432using ::nan;
1433using ::nanf;
1434#endif // _LIBCPP_MSVCRT
1435
1436#ifndef __sun__
1437#ifndef _LIBCPP_MSVCRT
1438
1439// nearbyint
1440
1441using ::nearbyint;
1442using ::nearbyintf;
1443
1444inline _LIBCPP_INLINE_VISIBILITY float       nearbyint(float __lcpp_x) _NOEXCEPT       {return nearbyintf(__lcpp_x);}
1445inline _LIBCPP_INLINE_VISIBILITY long double nearbyint(long double __lcpp_x) _NOEXCEPT {return nearbyintl(__lcpp_x);}
1446
1447template <class _A1>
1448inline _LIBCPP_INLINE_VISIBILITY
1449typename enable_if<is_integral<_A1>::value, double>::type
1450nearbyint(_A1 __lcpp_x) _NOEXCEPT {return nearbyint((double)__lcpp_x);}
1451
1452// nextafter
1453
1454using ::nextafter;
1455using ::nextafterf;
1456
1457inline _LIBCPP_INLINE_VISIBILITY float       nextafter(float __lcpp_x, float __lcpp_y) _NOEXCEPT             {return nextafterf(__lcpp_x, __lcpp_y);}
1458inline _LIBCPP_INLINE_VISIBILITY long double nextafter(long double __lcpp_x, long double __lcpp_y) _NOEXCEPT {return nextafterl(__lcpp_x, __lcpp_y);}
1459
1460template <class _A1, class _A2>
1461inline _LIBCPP_INLINE_VISIBILITY
1462typename __lazy_enable_if
1463<
1464    is_arithmetic<_A1>::value &&
1465    is_arithmetic<_A2>::value,
1466    __promote<_A1, _A2>
1467>::type
1468nextafter(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
1469{
1470    typedef typename __promote<_A1, _A2>::type __result_type;
1471    static_assert((!(is_same<_A1, __result_type>::value &&
1472                      is_same<_A2, __result_type>::value)), "");
1473    return nextafter((__result_type)__lcpp_x, (__result_type)__lcpp_y);
1474}
1475
1476// nexttoward
1477
1478using ::nexttoward;
1479using ::nexttowardf;
1480
1481inline _LIBCPP_INLINE_VISIBILITY float       nexttoward(float __lcpp_x, long double __lcpp_y) _NOEXCEPT       {return nexttowardf(__lcpp_x, __lcpp_y);}
1482inline _LIBCPP_INLINE_VISIBILITY long double nexttoward(long double __lcpp_x, long double __lcpp_y) _NOEXCEPT {return nexttowardl(__lcpp_x, __lcpp_y);}
1483
1484template <class _A1>
1485inline _LIBCPP_INLINE_VISIBILITY
1486typename enable_if<is_integral<_A1>::value, double>::type
1487nexttoward(_A1 __lcpp_x, long double __lcpp_y) _NOEXCEPT {return nexttoward((double)__lcpp_x, __lcpp_y);}
1488
1489// remainder
1490
1491using ::remainder;
1492using ::remainderf;
1493
1494inline _LIBCPP_INLINE_VISIBILITY float       remainder(float __lcpp_x, float __lcpp_y) _NOEXCEPT             {return remainderf(__lcpp_x, __lcpp_y);}
1495inline _LIBCPP_INLINE_VISIBILITY long double remainder(long double __lcpp_x, long double __lcpp_y) _NOEXCEPT {return remainderl(__lcpp_x, __lcpp_y);}
1496
1497template <class _A1, class _A2>
1498inline _LIBCPP_INLINE_VISIBILITY
1499typename __lazy_enable_if
1500<
1501    is_arithmetic<_A1>::value &&
1502    is_arithmetic<_A2>::value,
1503    __promote<_A1, _A2>
1504>::type
1505remainder(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
1506{
1507    typedef typename __promote<_A1, _A2>::type __result_type;
1508    static_assert((!(is_same<_A1, __result_type>::value &&
1509                      is_same<_A2, __result_type>::value)), "");
1510    return remainder((__result_type)__lcpp_x, (__result_type)__lcpp_y);
1511}
1512
1513// remquo
1514
1515using ::remquo;
1516using ::remquof;
1517
1518inline _LIBCPP_INLINE_VISIBILITY float       remquo(float __lcpp_x, float __lcpp_y, int* __lcpp_z) _NOEXCEPT             {return remquof(__lcpp_x, __lcpp_y, __lcpp_z);}
1519inline _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);}
1520
1521template <class _A1, class _A2>
1522inline _LIBCPP_INLINE_VISIBILITY
1523typename __lazy_enable_if
1524<
1525    is_arithmetic<_A1>::value &&
1526    is_arithmetic<_A2>::value,
1527    __promote<_A1, _A2>
1528>::type
1529remquo(_A1 __lcpp_x, _A2 __lcpp_y, int* __lcpp_z) _NOEXCEPT
1530{
1531    typedef typename __promote<_A1, _A2>::type __result_type;
1532    static_assert((!(is_same<_A1, __result_type>::value &&
1533                      is_same<_A2, __result_type>::value)), "");
1534    return remquo((__result_type)__lcpp_x, (__result_type)__lcpp_y, __lcpp_z);
1535}
1536
1537// rint
1538
1539using ::rint;
1540using ::rintf;
1541
1542inline _LIBCPP_INLINE_VISIBILITY float       rint(float __lcpp_x) _NOEXCEPT       {return rintf(__lcpp_x);}
1543inline _LIBCPP_INLINE_VISIBILITY long double rint(long double __lcpp_x) _NOEXCEPT {return rintl(__lcpp_x);}
1544
1545template <class _A1>
1546inline _LIBCPP_INLINE_VISIBILITY
1547typename enable_if<is_integral<_A1>::value, double>::type
1548rint(_A1 __lcpp_x) _NOEXCEPT {return rint((double)__lcpp_x);}
1549
1550// round
1551
1552using ::round;
1553using ::roundf;
1554
1555inline _LIBCPP_INLINE_VISIBILITY float       round(float __lcpp_x) _NOEXCEPT       {return roundf(__lcpp_x);}
1556inline _LIBCPP_INLINE_VISIBILITY long double round(long double __lcpp_x) _NOEXCEPT {return roundl(__lcpp_x);}
1557
1558template <class _A1>
1559inline _LIBCPP_INLINE_VISIBILITY
1560typename enable_if<is_integral<_A1>::value, double>::type
1561round(_A1 __lcpp_x) _NOEXCEPT {return round((double)__lcpp_x);}
1562
1563// scalbln
1564
1565using ::scalbln;
1566using ::scalblnf;
1567
1568inline _LIBCPP_INLINE_VISIBILITY float       scalbln(float __lcpp_x, long __lcpp_y) _NOEXCEPT       {return scalblnf(__lcpp_x, __lcpp_y);}
1569inline _LIBCPP_INLINE_VISIBILITY long double scalbln(long double __lcpp_x, long __lcpp_y) _NOEXCEPT {return scalblnl(__lcpp_x, __lcpp_y);}
1570
1571template <class _A1>
1572inline _LIBCPP_INLINE_VISIBILITY
1573typename enable_if<is_integral<_A1>::value, double>::type
1574scalbln(_A1 __lcpp_x, long __lcpp_y) _NOEXCEPT {return scalbln((double)__lcpp_x, __lcpp_y);}
1575
1576// scalbn
1577
1578using ::scalbn;
1579using ::scalbnf;
1580
1581inline _LIBCPP_INLINE_VISIBILITY float       scalbn(float __lcpp_x, int __lcpp_y) _NOEXCEPT       {return scalbnf(__lcpp_x, __lcpp_y);}
1582inline _LIBCPP_INLINE_VISIBILITY long double scalbn(long double __lcpp_x, int __lcpp_y) _NOEXCEPT {return scalbnl(__lcpp_x, __lcpp_y);}
1583
1584template <class _A1>
1585inline _LIBCPP_INLINE_VISIBILITY
1586typename enable_if<is_integral<_A1>::value, double>::type
1587scalbn(_A1 __lcpp_x, int __lcpp_y) _NOEXCEPT {return scalbn((double)__lcpp_x, __lcpp_y);}
1588
1589// tgamma
1590
1591using ::tgamma;
1592using ::tgammaf;
1593
1594inline _LIBCPP_INLINE_VISIBILITY float       tgamma(float __lcpp_x) _NOEXCEPT       {return tgammaf(__lcpp_x);}
1595inline _LIBCPP_INLINE_VISIBILITY long double tgamma(long double __lcpp_x) _NOEXCEPT {return tgammal(__lcpp_x);}
1596
1597template <class _A1>
1598inline _LIBCPP_INLINE_VISIBILITY
1599typename enable_if<is_integral<_A1>::value, double>::type
1600tgamma(_A1 __lcpp_x) _NOEXCEPT {return tgamma((double)__lcpp_x);}
1601
1602// trunc
1603
1604using ::trunc;
1605using ::truncf;
1606
1607inline _LIBCPP_INLINE_VISIBILITY float       trunc(float __lcpp_x) _NOEXCEPT       {return truncf(__lcpp_x);}
1608inline _LIBCPP_INLINE_VISIBILITY long double trunc(long double __lcpp_x) _NOEXCEPT {return truncl(__lcpp_x);}
1609
1610template <class _A1>
1611inline _LIBCPP_INLINE_VISIBILITY
1612typename enable_if<is_integral<_A1>::value, double>::type
1613trunc(_A1 __lcpp_x) _NOEXCEPT {return trunc((double)__lcpp_x);}
1614
1615#endif // !_LIBCPP_MSVCRT
1616
1617using ::acosl;
1618using ::asinl;
1619using ::atanl;
1620using ::atan2l;
1621using ::ceill;
1622using ::cosl;
1623using ::coshl;
1624using ::expl;
1625using ::fabsl;
1626using ::floorl;
1627using ::fmodl;
1628using ::frexpl;
1629using ::ldexpl;
1630using ::logl;
1631using ::log10l;
1632using ::modfl;
1633using ::powl;
1634using ::sinl;
1635using ::sinhl;
1636using ::sqrtl;
1637using ::tanl;
1638#ifndef _LIBCPP_MSVCRT
1639using ::tanhl;
1640using ::acoshl;
1641using ::asinhl;
1642using ::atanhl;
1643using ::cbrtl;
1644#endif  // !_LIBCPP_MSVCRT
1645using ::copysignl;
1646#ifndef _LIBCPP_MSVCRT
1647using ::erfl;
1648using ::erfcl;
1649using ::exp2l;
1650using ::expm1l;
1651using ::fdiml;
1652using ::fmal;
1653using ::fmaxl;
1654using ::fminl;
1655using ::hypotl;
1656using ::ilogbl;
1657using ::lgammal;
1658using ::llrintl;
1659using ::llroundl;
1660using ::log1pl;
1661using ::log2l;
1662using ::logbl;
1663using ::lrintl;
1664using ::lroundl;
1665using ::nanl;
1666using ::nearbyintl;
1667using ::nextafterl;
1668using ::nexttowardl;
1669using ::remainderl;
1670using ::remquol;
1671using ::rintl;
1672using ::roundl;
1673using ::scalblnl;
1674using ::scalbnl;
1675using ::tgammal;
1676using ::truncl;
1677#endif // !_LIBCPP_MSVCRT
1678
1679#else 
1680using ::lgamma;
1681using ::lgammaf;
1682#endif // __sun__
1683_LIBCPP_END_NAMESPACE_STD
1684
1685#endif  // _LIBCPP_CMATH
1686