xref: /freebsd/contrib/llvm-project/libcxx/include/math.h (revision 5ffd83dbcc34f10e07f6d3e968ae6365869615f4)
10b57cec5SDimitry Andric // -*- C++ -*-
20b57cec5SDimitry Andric //===---------------------------- math.h ----------------------------------===//
30b57cec5SDimitry Andric //
40b57cec5SDimitry Andric // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
50b57cec5SDimitry Andric // See https://llvm.org/LICENSE.txt for license information.
60b57cec5SDimitry Andric // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
70b57cec5SDimitry Andric //
80b57cec5SDimitry Andric //===----------------------------------------------------------------------===//
90b57cec5SDimitry Andric 
100b57cec5SDimitry Andric #ifndef _LIBCPP_MATH_H
110b57cec5SDimitry Andric #define _LIBCPP_MATH_H
120b57cec5SDimitry Andric 
130b57cec5SDimitry Andric /*
140b57cec5SDimitry Andric     math.h synopsis
150b57cec5SDimitry Andric 
160b57cec5SDimitry Andric Macros:
170b57cec5SDimitry Andric 
180b57cec5SDimitry Andric     HUGE_VAL
190b57cec5SDimitry Andric     HUGE_VALF               // C99
200b57cec5SDimitry Andric     HUGE_VALL               // C99
210b57cec5SDimitry Andric     INFINITY                // C99
220b57cec5SDimitry Andric     NAN                     // C99
230b57cec5SDimitry Andric     FP_INFINITE             // C99
240b57cec5SDimitry Andric     FP_NAN                  // C99
250b57cec5SDimitry Andric     FP_NORMAL               // C99
260b57cec5SDimitry Andric     FP_SUBNORMAL            // C99
270b57cec5SDimitry Andric     FP_ZERO                 // C99
280b57cec5SDimitry Andric     FP_FAST_FMA             // C99
290b57cec5SDimitry Andric     FP_FAST_FMAF            // C99
300b57cec5SDimitry Andric     FP_FAST_FMAL            // C99
310b57cec5SDimitry Andric     FP_ILOGB0               // C99
320b57cec5SDimitry Andric     FP_ILOGBNAN             // C99
330b57cec5SDimitry Andric     MATH_ERRNO              // C99
340b57cec5SDimitry Andric     MATH_ERREXCEPT          // C99
350b57cec5SDimitry Andric     math_errhandling        // C99
360b57cec5SDimitry Andric 
370b57cec5SDimitry Andric Types:
380b57cec5SDimitry Andric 
390b57cec5SDimitry Andric     float_t                 // C99
400b57cec5SDimitry Andric     double_t                // C99
410b57cec5SDimitry Andric 
420b57cec5SDimitry Andric // C90
430b57cec5SDimitry Andric 
440b57cec5SDimitry Andric floating_point abs(floating_point x);
450b57cec5SDimitry Andric 
460b57cec5SDimitry Andric floating_point acos (arithmetic x);
470b57cec5SDimitry Andric float          acosf(float x);
480b57cec5SDimitry Andric long double    acosl(long double x);
490b57cec5SDimitry Andric 
500b57cec5SDimitry Andric floating_point asin (arithmetic x);
510b57cec5SDimitry Andric float          asinf(float x);
520b57cec5SDimitry Andric long double    asinl(long double x);
530b57cec5SDimitry Andric 
540b57cec5SDimitry Andric floating_point atan (arithmetic x);
550b57cec5SDimitry Andric float          atanf(float x);
560b57cec5SDimitry Andric long double    atanl(long double x);
570b57cec5SDimitry Andric 
580b57cec5SDimitry Andric floating_point atan2 (arithmetic y, arithmetic x);
590b57cec5SDimitry Andric float          atan2f(float y, float x);
600b57cec5SDimitry Andric long double    atan2l(long double y, long double x);
610b57cec5SDimitry Andric 
620b57cec5SDimitry Andric floating_point ceil (arithmetic x);
630b57cec5SDimitry Andric float          ceilf(float x);
640b57cec5SDimitry Andric long double    ceill(long double x);
650b57cec5SDimitry Andric 
660b57cec5SDimitry Andric floating_point cos (arithmetic x);
670b57cec5SDimitry Andric float          cosf(float x);
680b57cec5SDimitry Andric long double    cosl(long double x);
690b57cec5SDimitry Andric 
700b57cec5SDimitry Andric floating_point cosh (arithmetic x);
710b57cec5SDimitry Andric float          coshf(float x);
720b57cec5SDimitry Andric long double    coshl(long double x);
730b57cec5SDimitry Andric 
740b57cec5SDimitry Andric floating_point exp (arithmetic x);
750b57cec5SDimitry Andric float          expf(float x);
760b57cec5SDimitry Andric long double    expl(long double x);
770b57cec5SDimitry Andric 
780b57cec5SDimitry Andric floating_point fabs (arithmetic x);
790b57cec5SDimitry Andric float          fabsf(float x);
800b57cec5SDimitry Andric long double    fabsl(long double x);
810b57cec5SDimitry Andric 
820b57cec5SDimitry Andric floating_point floor (arithmetic x);
830b57cec5SDimitry Andric float          floorf(float x);
840b57cec5SDimitry Andric long double    floorl(long double x);
850b57cec5SDimitry Andric 
860b57cec5SDimitry Andric floating_point fmod (arithmetic x, arithmetic y);
870b57cec5SDimitry Andric float          fmodf(float x, float y);
880b57cec5SDimitry Andric long double    fmodl(long double x, long double y);
890b57cec5SDimitry Andric 
900b57cec5SDimitry Andric floating_point frexp (arithmetic value, int* exp);
910b57cec5SDimitry Andric float          frexpf(float value, int* exp);
920b57cec5SDimitry Andric long double    frexpl(long double value, int* exp);
930b57cec5SDimitry Andric 
940b57cec5SDimitry Andric floating_point ldexp (arithmetic value, int exp);
950b57cec5SDimitry Andric float          ldexpf(float value, int exp);
960b57cec5SDimitry Andric long double    ldexpl(long double value, int exp);
970b57cec5SDimitry Andric 
980b57cec5SDimitry Andric floating_point log (arithmetic x);
990b57cec5SDimitry Andric float          logf(float x);
1000b57cec5SDimitry Andric long double    logl(long double x);
1010b57cec5SDimitry Andric 
1020b57cec5SDimitry Andric floating_point log10 (arithmetic x);
1030b57cec5SDimitry Andric float          log10f(float x);
1040b57cec5SDimitry Andric long double    log10l(long double x);
1050b57cec5SDimitry Andric 
1060b57cec5SDimitry Andric floating_point modf (floating_point value, floating_point* iptr);
1070b57cec5SDimitry Andric float          modff(float value, float* iptr);
1080b57cec5SDimitry Andric long double    modfl(long double value, long double* iptr);
1090b57cec5SDimitry Andric 
1100b57cec5SDimitry Andric floating_point pow (arithmetic x, arithmetic y);
1110b57cec5SDimitry Andric float          powf(float x, float y);
1120b57cec5SDimitry Andric long double    powl(long double x, long double y);
1130b57cec5SDimitry Andric 
1140b57cec5SDimitry Andric floating_point sin (arithmetic x);
1150b57cec5SDimitry Andric float          sinf(float x);
1160b57cec5SDimitry Andric long double    sinl(long double x);
1170b57cec5SDimitry Andric 
1180b57cec5SDimitry Andric floating_point sinh (arithmetic x);
1190b57cec5SDimitry Andric float          sinhf(float x);
1200b57cec5SDimitry Andric long double    sinhl(long double x);
1210b57cec5SDimitry Andric 
1220b57cec5SDimitry Andric floating_point sqrt (arithmetic x);
1230b57cec5SDimitry Andric float          sqrtf(float x);
1240b57cec5SDimitry Andric long double    sqrtl(long double x);
1250b57cec5SDimitry Andric 
1260b57cec5SDimitry Andric floating_point tan (arithmetic x);
1270b57cec5SDimitry Andric float          tanf(float x);
1280b57cec5SDimitry Andric long double    tanl(long double x);
1290b57cec5SDimitry Andric 
1300b57cec5SDimitry Andric floating_point tanh (arithmetic x);
1310b57cec5SDimitry Andric float          tanhf(float x);
1320b57cec5SDimitry Andric long double    tanhl(long double x);
1330b57cec5SDimitry Andric 
1340b57cec5SDimitry Andric //  C99
1350b57cec5SDimitry Andric 
1360b57cec5SDimitry Andric bool signbit(arithmetic x);
1370b57cec5SDimitry Andric 
1380b57cec5SDimitry Andric int fpclassify(arithmetic x);
1390b57cec5SDimitry Andric 
1400b57cec5SDimitry Andric bool isfinite(arithmetic x);
1410b57cec5SDimitry Andric bool isinf(arithmetic x);
1420b57cec5SDimitry Andric bool isnan(arithmetic x);
1430b57cec5SDimitry Andric bool isnormal(arithmetic x);
1440b57cec5SDimitry Andric 
1450b57cec5SDimitry Andric bool isgreater(arithmetic x, arithmetic y);
1460b57cec5SDimitry Andric bool isgreaterequal(arithmetic x, arithmetic y);
1470b57cec5SDimitry Andric bool isless(arithmetic x, arithmetic y);
1480b57cec5SDimitry Andric bool islessequal(arithmetic x, arithmetic y);
1490b57cec5SDimitry Andric bool islessgreater(arithmetic x, arithmetic y);
1500b57cec5SDimitry Andric bool isunordered(arithmetic x, arithmetic y);
1510b57cec5SDimitry Andric 
1520b57cec5SDimitry Andric floating_point acosh (arithmetic x);
1530b57cec5SDimitry Andric float          acoshf(float x);
1540b57cec5SDimitry Andric long double    acoshl(long double x);
1550b57cec5SDimitry Andric 
1560b57cec5SDimitry Andric floating_point asinh (arithmetic x);
1570b57cec5SDimitry Andric float          asinhf(float x);
1580b57cec5SDimitry Andric long double    asinhl(long double x);
1590b57cec5SDimitry Andric 
1600b57cec5SDimitry Andric floating_point atanh (arithmetic x);
1610b57cec5SDimitry Andric float          atanhf(float x);
1620b57cec5SDimitry Andric long double    atanhl(long double x);
1630b57cec5SDimitry Andric 
1640b57cec5SDimitry Andric floating_point cbrt (arithmetic x);
1650b57cec5SDimitry Andric float          cbrtf(float x);
1660b57cec5SDimitry Andric long double    cbrtl(long double x);
1670b57cec5SDimitry Andric 
1680b57cec5SDimitry Andric floating_point copysign (arithmetic x, arithmetic y);
1690b57cec5SDimitry Andric float          copysignf(float x, float y);
1700b57cec5SDimitry Andric long double    copysignl(long double x, long double y);
1710b57cec5SDimitry Andric 
1720b57cec5SDimitry Andric floating_point erf (arithmetic x);
1730b57cec5SDimitry Andric float          erff(float x);
1740b57cec5SDimitry Andric long double    erfl(long double x);
1750b57cec5SDimitry Andric 
1760b57cec5SDimitry Andric floating_point erfc (arithmetic x);
1770b57cec5SDimitry Andric float          erfcf(float x);
1780b57cec5SDimitry Andric long double    erfcl(long double x);
1790b57cec5SDimitry Andric 
1800b57cec5SDimitry Andric floating_point exp2 (arithmetic x);
1810b57cec5SDimitry Andric float          exp2f(float x);
1820b57cec5SDimitry Andric long double    exp2l(long double x);
1830b57cec5SDimitry Andric 
1840b57cec5SDimitry Andric floating_point expm1 (arithmetic x);
1850b57cec5SDimitry Andric float          expm1f(float x);
1860b57cec5SDimitry Andric long double    expm1l(long double x);
1870b57cec5SDimitry Andric 
1880b57cec5SDimitry Andric floating_point fdim (arithmetic x, arithmetic y);
1890b57cec5SDimitry Andric float          fdimf(float x, float y);
1900b57cec5SDimitry Andric long double    fdiml(long double x, long double y);
1910b57cec5SDimitry Andric 
1920b57cec5SDimitry Andric floating_point fma (arithmetic x, arithmetic y, arithmetic z);
1930b57cec5SDimitry Andric float          fmaf(float x, float y, float z);
1940b57cec5SDimitry Andric long double    fmal(long double x, long double y, long double z);
1950b57cec5SDimitry Andric 
1960b57cec5SDimitry Andric floating_point fmax (arithmetic x, arithmetic y);
1970b57cec5SDimitry Andric float          fmaxf(float x, float y);
1980b57cec5SDimitry Andric long double    fmaxl(long double x, long double y);
1990b57cec5SDimitry Andric 
2000b57cec5SDimitry Andric floating_point fmin (arithmetic x, arithmetic y);
2010b57cec5SDimitry Andric float          fminf(float x, float y);
2020b57cec5SDimitry Andric long double    fminl(long double x, long double y);
2030b57cec5SDimitry Andric 
2040b57cec5SDimitry Andric floating_point hypot (arithmetic x, arithmetic y);
2050b57cec5SDimitry Andric float          hypotf(float x, float y);
2060b57cec5SDimitry Andric long double    hypotl(long double x, long double y);
2070b57cec5SDimitry Andric 
2080b57cec5SDimitry Andric int ilogb (arithmetic x);
2090b57cec5SDimitry Andric int ilogbf(float x);
2100b57cec5SDimitry Andric int ilogbl(long double x);
2110b57cec5SDimitry Andric 
2120b57cec5SDimitry Andric floating_point lgamma (arithmetic x);
2130b57cec5SDimitry Andric float          lgammaf(float x);
2140b57cec5SDimitry Andric long double    lgammal(long double x);
2150b57cec5SDimitry Andric 
2160b57cec5SDimitry Andric long long llrint (arithmetic x);
2170b57cec5SDimitry Andric long long llrintf(float x);
2180b57cec5SDimitry Andric long long llrintl(long double x);
2190b57cec5SDimitry Andric 
2200b57cec5SDimitry Andric long long llround (arithmetic x);
2210b57cec5SDimitry Andric long long llroundf(float x);
2220b57cec5SDimitry Andric long long llroundl(long double x);
2230b57cec5SDimitry Andric 
2240b57cec5SDimitry Andric floating_point log1p (arithmetic x);
2250b57cec5SDimitry Andric float          log1pf(float x);
2260b57cec5SDimitry Andric long double    log1pl(long double x);
2270b57cec5SDimitry Andric 
2280b57cec5SDimitry Andric floating_point log2 (arithmetic x);
2290b57cec5SDimitry Andric float          log2f(float x);
2300b57cec5SDimitry Andric long double    log2l(long double x);
2310b57cec5SDimitry Andric 
2320b57cec5SDimitry Andric floating_point logb (arithmetic x);
2330b57cec5SDimitry Andric float          logbf(float x);
2340b57cec5SDimitry Andric long double    logbl(long double x);
2350b57cec5SDimitry Andric 
2360b57cec5SDimitry Andric long lrint (arithmetic x);
2370b57cec5SDimitry Andric long lrintf(float x);
2380b57cec5SDimitry Andric long lrintl(long double x);
2390b57cec5SDimitry Andric 
2400b57cec5SDimitry Andric long lround (arithmetic x);
2410b57cec5SDimitry Andric long lroundf(float x);
2420b57cec5SDimitry Andric long lroundl(long double x);
2430b57cec5SDimitry Andric 
2440b57cec5SDimitry Andric double      nan (const char* str);
2450b57cec5SDimitry Andric float       nanf(const char* str);
2460b57cec5SDimitry Andric long double nanl(const char* str);
2470b57cec5SDimitry Andric 
2480b57cec5SDimitry Andric floating_point nearbyint (arithmetic x);
2490b57cec5SDimitry Andric float          nearbyintf(float x);
2500b57cec5SDimitry Andric long double    nearbyintl(long double x);
2510b57cec5SDimitry Andric 
2520b57cec5SDimitry Andric floating_point nextafter (arithmetic x, arithmetic y);
2530b57cec5SDimitry Andric float          nextafterf(float x, float y);
2540b57cec5SDimitry Andric long double    nextafterl(long double x, long double y);
2550b57cec5SDimitry Andric 
2560b57cec5SDimitry Andric floating_point nexttoward (arithmetic x, long double y);
2570b57cec5SDimitry Andric float          nexttowardf(float x, long double y);
2580b57cec5SDimitry Andric long double    nexttowardl(long double x, long double y);
2590b57cec5SDimitry Andric 
2600b57cec5SDimitry Andric floating_point remainder (arithmetic x, arithmetic y);
2610b57cec5SDimitry Andric float          remainderf(float x, float y);
2620b57cec5SDimitry Andric long double    remainderl(long double x, long double y);
2630b57cec5SDimitry Andric 
2640b57cec5SDimitry Andric floating_point remquo (arithmetic x, arithmetic y, int* pquo);
2650b57cec5SDimitry Andric float          remquof(float x, float y, int* pquo);
2660b57cec5SDimitry Andric long double    remquol(long double x, long double y, int* pquo);
2670b57cec5SDimitry Andric 
2680b57cec5SDimitry Andric floating_point rint (arithmetic x);
2690b57cec5SDimitry Andric float          rintf(float x);
2700b57cec5SDimitry Andric long double    rintl(long double x);
2710b57cec5SDimitry Andric 
2720b57cec5SDimitry Andric floating_point round (arithmetic x);
2730b57cec5SDimitry Andric float          roundf(float x);
2740b57cec5SDimitry Andric long double    roundl(long double x);
2750b57cec5SDimitry Andric 
2760b57cec5SDimitry Andric floating_point scalbln (arithmetic x, long ex);
2770b57cec5SDimitry Andric float          scalblnf(float x, long ex);
2780b57cec5SDimitry Andric long double    scalblnl(long double x, long ex);
2790b57cec5SDimitry Andric 
2800b57cec5SDimitry Andric floating_point scalbn (arithmetic x, int ex);
2810b57cec5SDimitry Andric float          scalbnf(float x, int ex);
2820b57cec5SDimitry Andric long double    scalbnl(long double x, int ex);
2830b57cec5SDimitry Andric 
2840b57cec5SDimitry Andric floating_point tgamma (arithmetic x);
2850b57cec5SDimitry Andric float          tgammaf(float x);
2860b57cec5SDimitry Andric long double    tgammal(long double x);
2870b57cec5SDimitry Andric 
2880b57cec5SDimitry Andric floating_point trunc (arithmetic x);
2890b57cec5SDimitry Andric float          truncf(float x);
2900b57cec5SDimitry Andric long double    truncl(long double x);
2910b57cec5SDimitry Andric 
2920b57cec5SDimitry Andric */
2930b57cec5SDimitry Andric 
2940b57cec5SDimitry Andric #include <__config>
2950b57cec5SDimitry Andric 
2960b57cec5SDimitry Andric #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
2970b57cec5SDimitry Andric #pragma GCC system_header
2980b57cec5SDimitry Andric #endif
2990b57cec5SDimitry Andric 
3000b57cec5SDimitry Andric #include_next <math.h>
3010b57cec5SDimitry Andric 
3020b57cec5SDimitry Andric #ifdef __cplusplus
3030b57cec5SDimitry Andric 
3040b57cec5SDimitry Andric // We support including .h headers inside 'extern "C"' contexts, so switch
3050b57cec5SDimitry Andric // back to C++ linkage before including these C++ headers.
3060b57cec5SDimitry Andric extern "C++" {
3070b57cec5SDimitry Andric 
308*5ffd83dbSDimitry Andric #include <stdlib.h>
3090b57cec5SDimitry Andric #include <type_traits>
3100b57cec5SDimitry Andric #include <limits>
3110b57cec5SDimitry Andric 
3120b57cec5SDimitry Andric // signbit
3130b57cec5SDimitry Andric 
3140b57cec5SDimitry Andric #ifdef signbit
3150b57cec5SDimitry Andric 
3160b57cec5SDimitry Andric template <class _A1>
3170b57cec5SDimitry Andric _LIBCPP_INLINE_VISIBILITY
3180b57cec5SDimitry Andric bool
3190b57cec5SDimitry Andric __libcpp_signbit(_A1 __lcpp_x) _NOEXCEPT
3200b57cec5SDimitry Andric {
3210b57cec5SDimitry Andric     return signbit(__lcpp_x);
3220b57cec5SDimitry Andric }
3230b57cec5SDimitry Andric 
3240b57cec5SDimitry Andric #undef signbit
3250b57cec5SDimitry Andric 
3260b57cec5SDimitry Andric template <class _A1>
3270b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY
3280b57cec5SDimitry Andric typename std::enable_if<std::is_floating_point<_A1>::value, bool>::type
3290b57cec5SDimitry Andric signbit(_A1 __lcpp_x) _NOEXCEPT
3300b57cec5SDimitry Andric {
3310b57cec5SDimitry Andric     return __libcpp_signbit((typename std::__promote<_A1>::type)__lcpp_x);
3320b57cec5SDimitry Andric }
3330b57cec5SDimitry Andric 
3340b57cec5SDimitry Andric template <class _A1>
3350b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY
3360b57cec5SDimitry Andric typename std::enable_if<
3370b57cec5SDimitry Andric     std::is_integral<_A1>::value && std::is_signed<_A1>::value, bool>::type
3380b57cec5SDimitry Andric signbit(_A1 __lcpp_x) _NOEXCEPT
3390b57cec5SDimitry Andric { return __lcpp_x < 0; }
3400b57cec5SDimitry Andric 
3410b57cec5SDimitry Andric template <class _A1>
3420b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY
3430b57cec5SDimitry Andric typename std::enable_if<
3440b57cec5SDimitry Andric     std::is_integral<_A1>::value && !std::is_signed<_A1>::value, bool>::type
3450b57cec5SDimitry Andric signbit(_A1) _NOEXCEPT
3460b57cec5SDimitry Andric { return false; }
3470b57cec5SDimitry Andric 
3480b57cec5SDimitry Andric #elif defined(_LIBCPP_MSVCRT)
3490b57cec5SDimitry Andric 
3500b57cec5SDimitry Andric template <typename _A1>
3510b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY
3520b57cec5SDimitry Andric typename std::enable_if<std::is_floating_point<_A1>::value, bool>::type
3530b57cec5SDimitry Andric signbit(_A1 __lcpp_x) _NOEXCEPT
3540b57cec5SDimitry Andric {
3550b57cec5SDimitry Andric   return ::signbit(static_cast<typename std::__promote<_A1>::type>(__lcpp_x));
3560b57cec5SDimitry Andric }
3570b57cec5SDimitry Andric 
3580b57cec5SDimitry Andric template <class _A1>
3590b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY
3600b57cec5SDimitry Andric typename std::enable_if<
3610b57cec5SDimitry Andric     std::is_integral<_A1>::value && std::is_signed<_A1>::value, bool>::type
3620b57cec5SDimitry Andric signbit(_A1 __lcpp_x) _NOEXCEPT
3630b57cec5SDimitry Andric { return __lcpp_x < 0; }
3640b57cec5SDimitry Andric 
3650b57cec5SDimitry Andric template <class _A1>
3660b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY
3670b57cec5SDimitry Andric typename std::enable_if<
3680b57cec5SDimitry Andric     std::is_integral<_A1>::value && !std::is_signed<_A1>::value, bool>::type
3690b57cec5SDimitry Andric signbit(_A1) _NOEXCEPT
3700b57cec5SDimitry Andric { return false; }
3710b57cec5SDimitry Andric 
3720b57cec5SDimitry Andric #endif  // signbit
3730b57cec5SDimitry Andric 
3740b57cec5SDimitry Andric // fpclassify
3750b57cec5SDimitry Andric 
3760b57cec5SDimitry Andric #ifdef fpclassify
3770b57cec5SDimitry Andric 
3780b57cec5SDimitry Andric template <class _A1>
3790b57cec5SDimitry Andric _LIBCPP_INLINE_VISIBILITY
3800b57cec5SDimitry Andric int
3810b57cec5SDimitry Andric __libcpp_fpclassify(_A1 __lcpp_x) _NOEXCEPT
3820b57cec5SDimitry Andric {
3830b57cec5SDimitry Andric     return fpclassify(__lcpp_x);
3840b57cec5SDimitry Andric }
3850b57cec5SDimitry Andric 
3860b57cec5SDimitry Andric #undef fpclassify
3870b57cec5SDimitry Andric 
3880b57cec5SDimitry Andric template <class _A1>
3890b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY
3900b57cec5SDimitry Andric typename std::enable_if<std::is_floating_point<_A1>::value, int>::type
3910b57cec5SDimitry Andric fpclassify(_A1 __lcpp_x) _NOEXCEPT
3920b57cec5SDimitry Andric {
3930b57cec5SDimitry Andric     return __libcpp_fpclassify((typename std::__promote<_A1>::type)__lcpp_x);
3940b57cec5SDimitry Andric }
3950b57cec5SDimitry Andric 
3960b57cec5SDimitry Andric template <class _A1>
3970b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY
3980b57cec5SDimitry Andric typename std::enable_if<std::is_integral<_A1>::value, int>::type
3990b57cec5SDimitry Andric fpclassify(_A1 __lcpp_x) _NOEXCEPT
4000b57cec5SDimitry Andric { return __lcpp_x == 0 ? FP_ZERO : FP_NORMAL; }
4010b57cec5SDimitry Andric 
4020b57cec5SDimitry Andric #elif defined(_LIBCPP_MSVCRT)
4030b57cec5SDimitry Andric 
4040b57cec5SDimitry Andric template <typename _A1>
4050b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY
4060b57cec5SDimitry Andric typename std::enable_if<std::is_floating_point<_A1>::value, bool>::type
4070b57cec5SDimitry Andric fpclassify(_A1 __lcpp_x) _NOEXCEPT
4080b57cec5SDimitry Andric {
4090b57cec5SDimitry Andric   return ::fpclassify(static_cast<typename std::__promote<_A1>::type>(__lcpp_x));
4100b57cec5SDimitry Andric }
4110b57cec5SDimitry Andric 
4120b57cec5SDimitry Andric template <class _A1>
4130b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY
4140b57cec5SDimitry Andric typename std::enable_if<std::is_integral<_A1>::value, int>::type
4150b57cec5SDimitry Andric fpclassify(_A1 __lcpp_x) _NOEXCEPT
4160b57cec5SDimitry Andric { return __lcpp_x == 0 ? FP_ZERO : FP_NORMAL; }
4170b57cec5SDimitry Andric 
4180b57cec5SDimitry Andric #endif  // fpclassify
4190b57cec5SDimitry Andric 
4200b57cec5SDimitry Andric // isfinite
4210b57cec5SDimitry Andric 
4220b57cec5SDimitry Andric #ifdef isfinite
4230b57cec5SDimitry Andric 
4240b57cec5SDimitry Andric template <class _A1>
4250b57cec5SDimitry Andric _LIBCPP_INLINE_VISIBILITY
4260b57cec5SDimitry Andric bool
4270b57cec5SDimitry Andric __libcpp_isfinite(_A1 __lcpp_x) _NOEXCEPT
4280b57cec5SDimitry Andric {
4290b57cec5SDimitry Andric     return isfinite(__lcpp_x);
4300b57cec5SDimitry Andric }
4310b57cec5SDimitry Andric 
4320b57cec5SDimitry Andric #undef isfinite
4330b57cec5SDimitry Andric 
4340b57cec5SDimitry Andric template <class _A1>
4350b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY
4360b57cec5SDimitry Andric typename std::enable_if<
4370b57cec5SDimitry Andric     std::is_arithmetic<_A1>::value && std::numeric_limits<_A1>::has_infinity,
4380b57cec5SDimitry Andric     bool>::type
4390b57cec5SDimitry Andric isfinite(_A1 __lcpp_x) _NOEXCEPT
4400b57cec5SDimitry Andric {
4410b57cec5SDimitry Andric     return __libcpp_isfinite((typename std::__promote<_A1>::type)__lcpp_x);
4420b57cec5SDimitry Andric }
4430b57cec5SDimitry Andric 
4440b57cec5SDimitry Andric template <class _A1>
4450b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY
4460b57cec5SDimitry Andric typename std::enable_if<
4470b57cec5SDimitry Andric     std::is_arithmetic<_A1>::value && !std::numeric_limits<_A1>::has_infinity,
4480b57cec5SDimitry Andric     bool>::type
4490b57cec5SDimitry Andric isfinite(_A1) _NOEXCEPT
4500b57cec5SDimitry Andric { return true; }
4510b57cec5SDimitry Andric 
4520b57cec5SDimitry Andric #endif  // isfinite
4530b57cec5SDimitry Andric 
4540b57cec5SDimitry Andric // isinf
4550b57cec5SDimitry Andric 
4560b57cec5SDimitry Andric #ifdef isinf
4570b57cec5SDimitry Andric 
4580b57cec5SDimitry Andric template <class _A1>
4590b57cec5SDimitry Andric _LIBCPP_INLINE_VISIBILITY
4600b57cec5SDimitry Andric bool
4610b57cec5SDimitry Andric __libcpp_isinf(_A1 __lcpp_x) _NOEXCEPT
4620b57cec5SDimitry Andric {
4630b57cec5SDimitry Andric     return isinf(__lcpp_x);
4640b57cec5SDimitry Andric }
4650b57cec5SDimitry Andric 
4660b57cec5SDimitry Andric #undef isinf
4670b57cec5SDimitry Andric 
4680b57cec5SDimitry Andric template <class _A1>
4690b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY
4700b57cec5SDimitry Andric typename std::enable_if<
4710b57cec5SDimitry Andric     std::is_arithmetic<_A1>::value && std::numeric_limits<_A1>::has_infinity,
4720b57cec5SDimitry Andric     bool>::type
4730b57cec5SDimitry Andric isinf(_A1 __lcpp_x) _NOEXCEPT
4740b57cec5SDimitry Andric {
4750b57cec5SDimitry Andric     return __libcpp_isinf((typename std::__promote<_A1>::type)__lcpp_x);
4760b57cec5SDimitry Andric }
4770b57cec5SDimitry Andric 
4780b57cec5SDimitry Andric template <class _A1>
4790b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY
4800b57cec5SDimitry Andric typename std::enable_if<
4810b57cec5SDimitry Andric     std::is_arithmetic<_A1>::value && !std::numeric_limits<_A1>::has_infinity,
4820b57cec5SDimitry Andric     bool>::type
4830b57cec5SDimitry Andric isinf(_A1) _NOEXCEPT
4840b57cec5SDimitry Andric { return false; }
4850b57cec5SDimitry Andric 
4860b57cec5SDimitry Andric #ifdef _LIBCPP_PREFERRED_OVERLOAD
4870b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY
4880b57cec5SDimitry Andric bool
4890b57cec5SDimitry Andric isinf(float __lcpp_x) _NOEXCEPT { return __libcpp_isinf(__lcpp_x); }
4900b57cec5SDimitry Andric 
4910b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_PREFERRED_OVERLOAD
4920b57cec5SDimitry Andric bool
4930b57cec5SDimitry Andric isinf(double __lcpp_x) _NOEXCEPT { return __libcpp_isinf(__lcpp_x); }
4940b57cec5SDimitry Andric 
4950b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY
4960b57cec5SDimitry Andric bool
4970b57cec5SDimitry Andric isinf(long double __lcpp_x) _NOEXCEPT { return __libcpp_isinf(__lcpp_x); }
4980b57cec5SDimitry Andric #endif
4990b57cec5SDimitry Andric 
5000b57cec5SDimitry Andric #endif  // isinf
5010b57cec5SDimitry Andric 
5020b57cec5SDimitry Andric // isnan
5030b57cec5SDimitry Andric 
5040b57cec5SDimitry Andric #ifdef isnan
5050b57cec5SDimitry Andric 
5060b57cec5SDimitry Andric template <class _A1>
5070b57cec5SDimitry Andric _LIBCPP_INLINE_VISIBILITY
5080b57cec5SDimitry Andric bool
5090b57cec5SDimitry Andric __libcpp_isnan(_A1 __lcpp_x) _NOEXCEPT
5100b57cec5SDimitry Andric {
511480093f4SDimitry Andric #if __has_builtin(__builtin_isnan)
512480093f4SDimitry Andric     return __builtin_isnan(__lcpp_x);
513480093f4SDimitry Andric #else
5140b57cec5SDimitry Andric     return isnan(__lcpp_x);
515480093f4SDimitry Andric #endif
5160b57cec5SDimitry Andric }
5170b57cec5SDimitry Andric 
5180b57cec5SDimitry Andric #undef isnan
5190b57cec5SDimitry Andric 
5200b57cec5SDimitry Andric template <class _A1>
5210b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY
5220b57cec5SDimitry Andric typename std::enable_if<std::is_floating_point<_A1>::value, bool>::type
5230b57cec5SDimitry Andric isnan(_A1 __lcpp_x) _NOEXCEPT
5240b57cec5SDimitry Andric {
5250b57cec5SDimitry Andric     return __libcpp_isnan((typename std::__promote<_A1>::type)__lcpp_x);
5260b57cec5SDimitry Andric }
5270b57cec5SDimitry Andric 
5280b57cec5SDimitry Andric template <class _A1>
5290b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY
5300b57cec5SDimitry Andric typename std::enable_if<std::is_integral<_A1>::value, bool>::type
5310b57cec5SDimitry Andric isnan(_A1) _NOEXCEPT
5320b57cec5SDimitry Andric { return false; }
5330b57cec5SDimitry Andric 
5340b57cec5SDimitry Andric #ifdef _LIBCPP_PREFERRED_OVERLOAD
5350b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY
5360b57cec5SDimitry Andric bool
5370b57cec5SDimitry Andric isnan(float __lcpp_x) _NOEXCEPT { return __libcpp_isnan(__lcpp_x); }
5380b57cec5SDimitry Andric 
5390b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_PREFERRED_OVERLOAD
5400b57cec5SDimitry Andric bool
5410b57cec5SDimitry Andric isnan(double __lcpp_x) _NOEXCEPT { return __libcpp_isnan(__lcpp_x); }
5420b57cec5SDimitry Andric 
5430b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY
5440b57cec5SDimitry Andric bool
5450b57cec5SDimitry Andric isnan(long double __lcpp_x) _NOEXCEPT { return __libcpp_isnan(__lcpp_x); }
5460b57cec5SDimitry Andric #endif
5470b57cec5SDimitry Andric 
5480b57cec5SDimitry Andric #endif  // isnan
5490b57cec5SDimitry Andric 
5500b57cec5SDimitry Andric // isnormal
5510b57cec5SDimitry Andric 
5520b57cec5SDimitry Andric #ifdef isnormal
5530b57cec5SDimitry Andric 
5540b57cec5SDimitry Andric template <class _A1>
5550b57cec5SDimitry Andric _LIBCPP_INLINE_VISIBILITY
5560b57cec5SDimitry Andric bool
5570b57cec5SDimitry Andric __libcpp_isnormal(_A1 __lcpp_x) _NOEXCEPT
5580b57cec5SDimitry Andric {
5590b57cec5SDimitry Andric     return isnormal(__lcpp_x);
5600b57cec5SDimitry Andric }
5610b57cec5SDimitry Andric 
5620b57cec5SDimitry Andric #undef isnormal
5630b57cec5SDimitry Andric 
5640b57cec5SDimitry Andric template <class _A1>
5650b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY
5660b57cec5SDimitry Andric typename std::enable_if<std::is_floating_point<_A1>::value, bool>::type
5670b57cec5SDimitry Andric isnormal(_A1 __lcpp_x) _NOEXCEPT
5680b57cec5SDimitry Andric {
5690b57cec5SDimitry Andric     return __libcpp_isnormal((typename std::__promote<_A1>::type)__lcpp_x);
5700b57cec5SDimitry Andric }
5710b57cec5SDimitry Andric 
5720b57cec5SDimitry Andric template <class _A1>
5730b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY
5740b57cec5SDimitry Andric typename std::enable_if<std::is_integral<_A1>::value, bool>::type
5750b57cec5SDimitry Andric isnormal(_A1 __lcpp_x) _NOEXCEPT
5760b57cec5SDimitry Andric { return __lcpp_x != 0; }
5770b57cec5SDimitry Andric 
5780b57cec5SDimitry Andric #endif  // isnormal
5790b57cec5SDimitry Andric 
5800b57cec5SDimitry Andric // isgreater
5810b57cec5SDimitry Andric 
5820b57cec5SDimitry Andric #ifdef isgreater
5830b57cec5SDimitry Andric 
5840b57cec5SDimitry Andric template <class _A1, class _A2>
5850b57cec5SDimitry Andric _LIBCPP_INLINE_VISIBILITY
5860b57cec5SDimitry Andric bool
5870b57cec5SDimitry Andric __libcpp_isgreater(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
5880b57cec5SDimitry Andric {
5890b57cec5SDimitry Andric     return isgreater(__lcpp_x, __lcpp_y);
5900b57cec5SDimitry Andric }
5910b57cec5SDimitry Andric 
5920b57cec5SDimitry Andric #undef isgreater
5930b57cec5SDimitry Andric 
5940b57cec5SDimitry Andric template <class _A1, class _A2>
5950b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY
5960b57cec5SDimitry Andric typename std::enable_if
5970b57cec5SDimitry Andric <
5980b57cec5SDimitry Andric     std::is_arithmetic<_A1>::value &&
5990b57cec5SDimitry Andric     std::is_arithmetic<_A2>::value,
6000b57cec5SDimitry Andric     bool
6010b57cec5SDimitry Andric >::type
6020b57cec5SDimitry Andric isgreater(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
6030b57cec5SDimitry Andric {
6040b57cec5SDimitry Andric     typedef typename std::__promote<_A1, _A2>::type type;
6050b57cec5SDimitry Andric     return __libcpp_isgreater((type)__lcpp_x, (type)__lcpp_y);
6060b57cec5SDimitry Andric }
6070b57cec5SDimitry Andric 
6080b57cec5SDimitry Andric #endif  // isgreater
6090b57cec5SDimitry Andric 
6100b57cec5SDimitry Andric // isgreaterequal
6110b57cec5SDimitry Andric 
6120b57cec5SDimitry Andric #ifdef isgreaterequal
6130b57cec5SDimitry Andric 
6140b57cec5SDimitry Andric template <class _A1, class _A2>
6150b57cec5SDimitry Andric _LIBCPP_INLINE_VISIBILITY
6160b57cec5SDimitry Andric bool
6170b57cec5SDimitry Andric __libcpp_isgreaterequal(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
6180b57cec5SDimitry Andric {
6190b57cec5SDimitry Andric     return isgreaterequal(__lcpp_x, __lcpp_y);
6200b57cec5SDimitry Andric }
6210b57cec5SDimitry Andric 
6220b57cec5SDimitry Andric #undef isgreaterequal
6230b57cec5SDimitry Andric 
6240b57cec5SDimitry Andric template <class _A1, class _A2>
6250b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY
6260b57cec5SDimitry Andric typename std::enable_if
6270b57cec5SDimitry Andric <
6280b57cec5SDimitry Andric     std::is_arithmetic<_A1>::value &&
6290b57cec5SDimitry Andric     std::is_arithmetic<_A2>::value,
6300b57cec5SDimitry Andric     bool
6310b57cec5SDimitry Andric >::type
6320b57cec5SDimitry Andric isgreaterequal(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
6330b57cec5SDimitry Andric {
6340b57cec5SDimitry Andric     typedef typename std::__promote<_A1, _A2>::type type;
6350b57cec5SDimitry Andric     return __libcpp_isgreaterequal((type)__lcpp_x, (type)__lcpp_y);
6360b57cec5SDimitry Andric }
6370b57cec5SDimitry Andric 
6380b57cec5SDimitry Andric #endif  // isgreaterequal
6390b57cec5SDimitry Andric 
6400b57cec5SDimitry Andric // isless
6410b57cec5SDimitry Andric 
6420b57cec5SDimitry Andric #ifdef isless
6430b57cec5SDimitry Andric 
6440b57cec5SDimitry Andric template <class _A1, class _A2>
6450b57cec5SDimitry Andric _LIBCPP_INLINE_VISIBILITY
6460b57cec5SDimitry Andric bool
6470b57cec5SDimitry Andric __libcpp_isless(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
6480b57cec5SDimitry Andric {
6490b57cec5SDimitry Andric     return isless(__lcpp_x, __lcpp_y);
6500b57cec5SDimitry Andric }
6510b57cec5SDimitry Andric 
6520b57cec5SDimitry Andric #undef isless
6530b57cec5SDimitry Andric 
6540b57cec5SDimitry Andric template <class _A1, class _A2>
6550b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY
6560b57cec5SDimitry Andric typename std::enable_if
6570b57cec5SDimitry Andric <
6580b57cec5SDimitry Andric     std::is_arithmetic<_A1>::value &&
6590b57cec5SDimitry Andric     std::is_arithmetic<_A2>::value,
6600b57cec5SDimitry Andric     bool
6610b57cec5SDimitry Andric >::type
6620b57cec5SDimitry Andric isless(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
6630b57cec5SDimitry Andric {
6640b57cec5SDimitry Andric     typedef typename std::__promote<_A1, _A2>::type type;
6650b57cec5SDimitry Andric     return __libcpp_isless((type)__lcpp_x, (type)__lcpp_y);
6660b57cec5SDimitry Andric }
6670b57cec5SDimitry Andric 
6680b57cec5SDimitry Andric #endif  // isless
6690b57cec5SDimitry Andric 
6700b57cec5SDimitry Andric // islessequal
6710b57cec5SDimitry Andric 
6720b57cec5SDimitry Andric #ifdef islessequal
6730b57cec5SDimitry Andric 
6740b57cec5SDimitry Andric template <class _A1, class _A2>
6750b57cec5SDimitry Andric _LIBCPP_INLINE_VISIBILITY
6760b57cec5SDimitry Andric bool
6770b57cec5SDimitry Andric __libcpp_islessequal(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
6780b57cec5SDimitry Andric {
6790b57cec5SDimitry Andric     return islessequal(__lcpp_x, __lcpp_y);
6800b57cec5SDimitry Andric }
6810b57cec5SDimitry Andric 
6820b57cec5SDimitry Andric #undef islessequal
6830b57cec5SDimitry Andric 
6840b57cec5SDimitry Andric template <class _A1, class _A2>
6850b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY
6860b57cec5SDimitry Andric typename std::enable_if
6870b57cec5SDimitry Andric <
6880b57cec5SDimitry Andric     std::is_arithmetic<_A1>::value &&
6890b57cec5SDimitry Andric     std::is_arithmetic<_A2>::value,
6900b57cec5SDimitry Andric     bool
6910b57cec5SDimitry Andric >::type
6920b57cec5SDimitry Andric islessequal(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
6930b57cec5SDimitry Andric {
6940b57cec5SDimitry Andric     typedef typename std::__promote<_A1, _A2>::type type;
6950b57cec5SDimitry Andric     return __libcpp_islessequal((type)__lcpp_x, (type)__lcpp_y);
6960b57cec5SDimitry Andric }
6970b57cec5SDimitry Andric 
6980b57cec5SDimitry Andric #endif  // islessequal
6990b57cec5SDimitry Andric 
7000b57cec5SDimitry Andric // islessgreater
7010b57cec5SDimitry Andric 
7020b57cec5SDimitry Andric #ifdef islessgreater
7030b57cec5SDimitry Andric 
7040b57cec5SDimitry Andric template <class _A1, class _A2>
7050b57cec5SDimitry Andric _LIBCPP_INLINE_VISIBILITY
7060b57cec5SDimitry Andric bool
7070b57cec5SDimitry Andric __libcpp_islessgreater(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
7080b57cec5SDimitry Andric {
7090b57cec5SDimitry Andric     return islessgreater(__lcpp_x, __lcpp_y);
7100b57cec5SDimitry Andric }
7110b57cec5SDimitry Andric 
7120b57cec5SDimitry Andric #undef islessgreater
7130b57cec5SDimitry Andric 
7140b57cec5SDimitry Andric template <class _A1, class _A2>
7150b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY
7160b57cec5SDimitry Andric typename std::enable_if
7170b57cec5SDimitry Andric <
7180b57cec5SDimitry Andric     std::is_arithmetic<_A1>::value &&
7190b57cec5SDimitry Andric     std::is_arithmetic<_A2>::value,
7200b57cec5SDimitry Andric     bool
7210b57cec5SDimitry Andric >::type
7220b57cec5SDimitry Andric islessgreater(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
7230b57cec5SDimitry Andric {
7240b57cec5SDimitry Andric     typedef typename std::__promote<_A1, _A2>::type type;
7250b57cec5SDimitry Andric     return __libcpp_islessgreater((type)__lcpp_x, (type)__lcpp_y);
7260b57cec5SDimitry Andric }
7270b57cec5SDimitry Andric 
7280b57cec5SDimitry Andric #endif  // islessgreater
7290b57cec5SDimitry Andric 
7300b57cec5SDimitry Andric // isunordered
7310b57cec5SDimitry Andric 
7320b57cec5SDimitry Andric #ifdef isunordered
7330b57cec5SDimitry Andric 
7340b57cec5SDimitry Andric template <class _A1, class _A2>
7350b57cec5SDimitry Andric _LIBCPP_INLINE_VISIBILITY
7360b57cec5SDimitry Andric bool
7370b57cec5SDimitry Andric __libcpp_isunordered(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
7380b57cec5SDimitry Andric {
7390b57cec5SDimitry Andric     return isunordered(__lcpp_x, __lcpp_y);
7400b57cec5SDimitry Andric }
7410b57cec5SDimitry Andric 
7420b57cec5SDimitry Andric #undef isunordered
7430b57cec5SDimitry Andric 
7440b57cec5SDimitry Andric template <class _A1, class _A2>
7450b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY
7460b57cec5SDimitry Andric typename std::enable_if
7470b57cec5SDimitry Andric <
7480b57cec5SDimitry Andric     std::is_arithmetic<_A1>::value &&
7490b57cec5SDimitry Andric     std::is_arithmetic<_A2>::value,
7500b57cec5SDimitry Andric     bool
7510b57cec5SDimitry Andric >::type
7520b57cec5SDimitry Andric isunordered(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
7530b57cec5SDimitry Andric {
7540b57cec5SDimitry Andric     typedef typename std::__promote<_A1, _A2>::type type;
7550b57cec5SDimitry Andric     return __libcpp_isunordered((type)__lcpp_x, (type)__lcpp_y);
7560b57cec5SDimitry Andric }
7570b57cec5SDimitry Andric 
7580b57cec5SDimitry Andric #endif  // isunordered
7590b57cec5SDimitry Andric 
7600b57cec5SDimitry Andric // abs
761*5ffd83dbSDimitry Andric //
762*5ffd83dbSDimitry Andric // handled in stdlib.h
7630b57cec5SDimitry Andric 
7640b57cec5SDimitry Andric // div
765*5ffd83dbSDimitry Andric //
766*5ffd83dbSDimitry Andric // handled in stdlib.h
7670b57cec5SDimitry Andric 
7680b57cec5SDimitry Andric // acos
7690b57cec5SDimitry Andric 
7700b57cec5SDimitry Andric #if !(defined(_AIX) || defined(__sun__))
7710b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY float       acos(float __lcpp_x) _NOEXCEPT       {return ::acosf(__lcpp_x);}
7720b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY long double acos(long double __lcpp_x) _NOEXCEPT {return ::acosl(__lcpp_x);}
7730b57cec5SDimitry Andric #endif
7740b57cec5SDimitry Andric 
7750b57cec5SDimitry Andric template <class _A1>
7760b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY
7770b57cec5SDimitry Andric typename std::enable_if<std::is_integral<_A1>::value, double>::type
7780b57cec5SDimitry Andric acos(_A1 __lcpp_x) _NOEXCEPT {return ::acos((double)__lcpp_x);}
7790b57cec5SDimitry Andric 
7800b57cec5SDimitry Andric // asin
7810b57cec5SDimitry Andric 
7820b57cec5SDimitry Andric #if !(defined(_AIX) || defined(__sun__))
7830b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY float       asin(float __lcpp_x) _NOEXCEPT       {return ::asinf(__lcpp_x);}
7840b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY long double asin(long double __lcpp_x) _NOEXCEPT {return ::asinl(__lcpp_x);}
7850b57cec5SDimitry Andric #endif
7860b57cec5SDimitry Andric 
7870b57cec5SDimitry Andric template <class _A1>
7880b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY
7890b57cec5SDimitry Andric typename std::enable_if<std::is_integral<_A1>::value, double>::type
7900b57cec5SDimitry Andric asin(_A1 __lcpp_x) _NOEXCEPT {return ::asin((double)__lcpp_x);}
7910b57cec5SDimitry Andric 
7920b57cec5SDimitry Andric // atan
7930b57cec5SDimitry Andric 
7940b57cec5SDimitry Andric #if !(defined(_AIX) || defined(__sun__))
7950b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY float       atan(float __lcpp_x) _NOEXCEPT       {return ::atanf(__lcpp_x);}
7960b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY long double atan(long double __lcpp_x) _NOEXCEPT {return ::atanl(__lcpp_x);}
7970b57cec5SDimitry Andric #endif
7980b57cec5SDimitry Andric 
7990b57cec5SDimitry Andric template <class _A1>
8000b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY
8010b57cec5SDimitry Andric typename std::enable_if<std::is_integral<_A1>::value, double>::type
8020b57cec5SDimitry Andric atan(_A1 __lcpp_x) _NOEXCEPT {return ::atan((double)__lcpp_x);}
8030b57cec5SDimitry Andric 
8040b57cec5SDimitry Andric // atan2
8050b57cec5SDimitry Andric 
8060b57cec5SDimitry Andric #if !(defined(_AIX) || defined(__sun__))
8070b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY float       atan2(float __lcpp_y, float __lcpp_x) _NOEXCEPT             {return ::atan2f(__lcpp_y, __lcpp_x);}
8080b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY long double atan2(long double __lcpp_y, long double __lcpp_x) _NOEXCEPT {return ::atan2l(__lcpp_y, __lcpp_x);}
8090b57cec5SDimitry Andric #endif
8100b57cec5SDimitry Andric 
8110b57cec5SDimitry Andric template <class _A1, class _A2>
8120b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY
8130b57cec5SDimitry Andric typename std::_EnableIf
8140b57cec5SDimitry Andric <
8150b57cec5SDimitry Andric     std::is_arithmetic<_A1>::value &&
8160b57cec5SDimitry Andric     std::is_arithmetic<_A2>::value,
8170b57cec5SDimitry Andric     std::__promote<_A1, _A2>
8180b57cec5SDimitry Andric >::type
8190b57cec5SDimitry Andric atan2(_A1 __lcpp_y, _A2 __lcpp_x) _NOEXCEPT
8200b57cec5SDimitry Andric {
8210b57cec5SDimitry Andric     typedef typename std::__promote<_A1, _A2>::type __result_type;
8220b57cec5SDimitry Andric     static_assert((!(std::_IsSame<_A1, __result_type>::value &&
8230b57cec5SDimitry Andric                      std::_IsSame<_A2, __result_type>::value)), "");
8240b57cec5SDimitry Andric     return ::atan2((__result_type)__lcpp_y, (__result_type)__lcpp_x);
8250b57cec5SDimitry Andric }
8260b57cec5SDimitry Andric 
8270b57cec5SDimitry Andric // ceil
8280b57cec5SDimitry Andric 
8290b57cec5SDimitry Andric #if !(defined(_AIX) || defined(__sun__))
8300b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY float       ceil(float __lcpp_x) _NOEXCEPT       {return ::ceilf(__lcpp_x);}
8310b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY long double ceil(long double __lcpp_x) _NOEXCEPT {return ::ceill(__lcpp_x);}
8320b57cec5SDimitry Andric #endif
8330b57cec5SDimitry Andric 
8340b57cec5SDimitry Andric template <class _A1>
8350b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY
8360b57cec5SDimitry Andric typename std::enable_if<std::is_integral<_A1>::value, double>::type
8370b57cec5SDimitry Andric ceil(_A1 __lcpp_x) _NOEXCEPT {return ::ceil((double)__lcpp_x);}
8380b57cec5SDimitry Andric 
8390b57cec5SDimitry Andric // cos
8400b57cec5SDimitry Andric 
8410b57cec5SDimitry Andric #if !(defined(_AIX) || defined(__sun__))
8420b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY float       cos(float __lcpp_x) _NOEXCEPT       {return ::cosf(__lcpp_x);}
8430b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY long double cos(long double __lcpp_x) _NOEXCEPT {return ::cosl(__lcpp_x);}
8440b57cec5SDimitry Andric #endif
8450b57cec5SDimitry Andric 
8460b57cec5SDimitry Andric template <class _A1>
8470b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY
8480b57cec5SDimitry Andric typename std::enable_if<std::is_integral<_A1>::value, double>::type
8490b57cec5SDimitry Andric cos(_A1 __lcpp_x) _NOEXCEPT {return ::cos((double)__lcpp_x);}
8500b57cec5SDimitry Andric 
8510b57cec5SDimitry Andric // cosh
8520b57cec5SDimitry Andric 
8530b57cec5SDimitry Andric #if !(defined(_AIX) || defined(__sun__))
8540b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY float       cosh(float __lcpp_x) _NOEXCEPT       {return ::coshf(__lcpp_x);}
8550b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY long double cosh(long double __lcpp_x) _NOEXCEPT {return ::coshl(__lcpp_x);}
8560b57cec5SDimitry Andric #endif
8570b57cec5SDimitry Andric 
8580b57cec5SDimitry Andric template <class _A1>
8590b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY
8600b57cec5SDimitry Andric typename std::enable_if<std::is_integral<_A1>::value, double>::type
8610b57cec5SDimitry Andric cosh(_A1 __lcpp_x) _NOEXCEPT {return ::cosh((double)__lcpp_x);}
8620b57cec5SDimitry Andric 
8630b57cec5SDimitry Andric // exp
8640b57cec5SDimitry Andric 
8650b57cec5SDimitry Andric #if !(defined(_AIX) || defined(__sun__))
8660b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY float       exp(float __lcpp_x) _NOEXCEPT       {return ::expf(__lcpp_x);}
8670b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY long double exp(long double __lcpp_x) _NOEXCEPT {return ::expl(__lcpp_x);}
8680b57cec5SDimitry Andric #endif
8690b57cec5SDimitry Andric 
8700b57cec5SDimitry Andric template <class _A1>
8710b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY
8720b57cec5SDimitry Andric typename std::enable_if<std::is_integral<_A1>::value, double>::type
8730b57cec5SDimitry Andric exp(_A1 __lcpp_x) _NOEXCEPT {return ::exp((double)__lcpp_x);}
8740b57cec5SDimitry Andric 
8750b57cec5SDimitry Andric // fabs
8760b57cec5SDimitry Andric 
8770b57cec5SDimitry Andric #if !(defined(_AIX) || defined(__sun__))
8780b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY float       fabs(float __lcpp_x) _NOEXCEPT       {return ::fabsf(__lcpp_x);}
8790b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY long double fabs(long double __lcpp_x) _NOEXCEPT {return ::fabsl(__lcpp_x);}
8800b57cec5SDimitry Andric #endif
8810b57cec5SDimitry Andric 
8820b57cec5SDimitry Andric template <class _A1>
8830b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY
8840b57cec5SDimitry Andric typename std::enable_if<std::is_integral<_A1>::value, double>::type
8850b57cec5SDimitry Andric fabs(_A1 __lcpp_x) _NOEXCEPT {return ::fabs((double)__lcpp_x);}
8860b57cec5SDimitry Andric 
8870b57cec5SDimitry Andric // floor
8880b57cec5SDimitry Andric 
8890b57cec5SDimitry Andric #if !(defined(_AIX) || defined(__sun__))
8900b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY float       floor(float __lcpp_x) _NOEXCEPT       {return ::floorf(__lcpp_x);}
8910b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY long double floor(long double __lcpp_x) _NOEXCEPT {return ::floorl(__lcpp_x);}
8920b57cec5SDimitry Andric #endif
8930b57cec5SDimitry Andric 
8940b57cec5SDimitry Andric template <class _A1>
8950b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY
8960b57cec5SDimitry Andric typename std::enable_if<std::is_integral<_A1>::value, double>::type
8970b57cec5SDimitry Andric floor(_A1 __lcpp_x) _NOEXCEPT {return ::floor((double)__lcpp_x);}
8980b57cec5SDimitry Andric 
8990b57cec5SDimitry Andric // fmod
9000b57cec5SDimitry Andric 
9010b57cec5SDimitry Andric #if !(defined(_AIX) || defined(__sun__))
9020b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY float       fmod(float __lcpp_x, float __lcpp_y) _NOEXCEPT             {return ::fmodf(__lcpp_x, __lcpp_y);}
9030b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY long double fmod(long double __lcpp_x, long double __lcpp_y) _NOEXCEPT {return ::fmodl(__lcpp_x, __lcpp_y);}
9040b57cec5SDimitry Andric #endif
9050b57cec5SDimitry Andric 
9060b57cec5SDimitry Andric template <class _A1, class _A2>
9070b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY
9080b57cec5SDimitry Andric typename std::_EnableIf
9090b57cec5SDimitry Andric <
9100b57cec5SDimitry Andric     std::is_arithmetic<_A1>::value &&
9110b57cec5SDimitry Andric     std::is_arithmetic<_A2>::value,
9120b57cec5SDimitry Andric     std::__promote<_A1, _A2>
9130b57cec5SDimitry Andric >::type
9140b57cec5SDimitry Andric fmod(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
9150b57cec5SDimitry Andric {
9160b57cec5SDimitry Andric     typedef typename std::__promote<_A1, _A2>::type __result_type;
9170b57cec5SDimitry Andric     static_assert((!(std::_IsSame<_A1, __result_type>::value &&
9180b57cec5SDimitry Andric                      std::_IsSame<_A2, __result_type>::value)), "");
9190b57cec5SDimitry Andric     return ::fmod((__result_type)__lcpp_x, (__result_type)__lcpp_y);
9200b57cec5SDimitry Andric }
9210b57cec5SDimitry Andric 
9220b57cec5SDimitry Andric // frexp
9230b57cec5SDimitry Andric 
9240b57cec5SDimitry Andric #if !(defined(_AIX) || defined(__sun__))
9250b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY float       frexp(float __lcpp_x, int* __lcpp_e) _NOEXCEPT       {return ::frexpf(__lcpp_x, __lcpp_e);}
9260b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY long double frexp(long double __lcpp_x, int* __lcpp_e) _NOEXCEPT {return ::frexpl(__lcpp_x, __lcpp_e);}
9270b57cec5SDimitry Andric #endif
9280b57cec5SDimitry Andric 
9290b57cec5SDimitry Andric template <class _A1>
9300b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY
9310b57cec5SDimitry Andric typename std::enable_if<std::is_integral<_A1>::value, double>::type
9320b57cec5SDimitry Andric frexp(_A1 __lcpp_x, int* __lcpp_e) _NOEXCEPT {return ::frexp((double)__lcpp_x, __lcpp_e);}
9330b57cec5SDimitry Andric 
9340b57cec5SDimitry Andric // ldexp
9350b57cec5SDimitry Andric 
9360b57cec5SDimitry Andric #if !(defined(_AIX) || defined(__sun__))
9370b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY float       ldexp(float __lcpp_x, int __lcpp_e) _NOEXCEPT       {return ::ldexpf(__lcpp_x, __lcpp_e);}
9380b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY long double ldexp(long double __lcpp_x, int __lcpp_e) _NOEXCEPT {return ::ldexpl(__lcpp_x, __lcpp_e);}
9390b57cec5SDimitry Andric #endif
9400b57cec5SDimitry Andric 
9410b57cec5SDimitry Andric template <class _A1>
9420b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY
9430b57cec5SDimitry Andric typename std::enable_if<std::is_integral<_A1>::value, double>::type
9440b57cec5SDimitry Andric ldexp(_A1 __lcpp_x, int __lcpp_e) _NOEXCEPT {return ::ldexp((double)__lcpp_x, __lcpp_e);}
9450b57cec5SDimitry Andric 
9460b57cec5SDimitry Andric // log
9470b57cec5SDimitry Andric 
9480b57cec5SDimitry Andric #if !(defined(_AIX) || defined(__sun__))
9490b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY float       log(float __lcpp_x) _NOEXCEPT       {return ::logf(__lcpp_x);}
9500b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY long double log(long double __lcpp_x) _NOEXCEPT {return ::logl(__lcpp_x);}
9510b57cec5SDimitry Andric #endif
9520b57cec5SDimitry Andric 
9530b57cec5SDimitry Andric template <class _A1>
9540b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY
9550b57cec5SDimitry Andric typename std::enable_if<std::is_integral<_A1>::value, double>::type
9560b57cec5SDimitry Andric log(_A1 __lcpp_x) _NOEXCEPT {return ::log((double)__lcpp_x);}
9570b57cec5SDimitry Andric 
9580b57cec5SDimitry Andric // log10
9590b57cec5SDimitry Andric 
9600b57cec5SDimitry Andric #if !(defined(_AIX) || defined(__sun__))
9610b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY float       log10(float __lcpp_x) _NOEXCEPT       {return ::log10f(__lcpp_x);}
9620b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY long double log10(long double __lcpp_x) _NOEXCEPT {return ::log10l(__lcpp_x);}
9630b57cec5SDimitry Andric #endif
9640b57cec5SDimitry Andric 
9650b57cec5SDimitry Andric template <class _A1>
9660b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY
9670b57cec5SDimitry Andric typename std::enable_if<std::is_integral<_A1>::value, double>::type
9680b57cec5SDimitry Andric log10(_A1 __lcpp_x) _NOEXCEPT {return ::log10((double)__lcpp_x);}
9690b57cec5SDimitry Andric 
9700b57cec5SDimitry Andric // modf
9710b57cec5SDimitry Andric 
9720b57cec5SDimitry Andric #if !(defined(_AIX) || defined(__sun__))
9730b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY float       modf(float __lcpp_x, float* __lcpp_y) _NOEXCEPT             {return ::modff(__lcpp_x, __lcpp_y);}
9740b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY long double modf(long double __lcpp_x, long double* __lcpp_y) _NOEXCEPT {return ::modfl(__lcpp_x, __lcpp_y);}
9750b57cec5SDimitry Andric #endif
9760b57cec5SDimitry Andric 
9770b57cec5SDimitry Andric // pow
9780b57cec5SDimitry Andric 
9790b57cec5SDimitry Andric #if !(defined(_AIX) || defined(__sun__))
9800b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY float       pow(float __lcpp_x, float __lcpp_y) _NOEXCEPT             {return ::powf(__lcpp_x, __lcpp_y);}
9810b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY long double pow(long double __lcpp_x, long double __lcpp_y) _NOEXCEPT {return ::powl(__lcpp_x, __lcpp_y);}
9820b57cec5SDimitry Andric #endif
9830b57cec5SDimitry Andric 
9840b57cec5SDimitry Andric template <class _A1, class _A2>
9850b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY
9860b57cec5SDimitry Andric typename std::_EnableIf
9870b57cec5SDimitry Andric <
9880b57cec5SDimitry Andric     std::is_arithmetic<_A1>::value &&
9890b57cec5SDimitry Andric     std::is_arithmetic<_A2>::value,
9900b57cec5SDimitry Andric     std::__promote<_A1, _A2>
9910b57cec5SDimitry Andric >::type
9920b57cec5SDimitry Andric pow(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
9930b57cec5SDimitry Andric {
9940b57cec5SDimitry Andric     typedef typename std::__promote<_A1, _A2>::type __result_type;
9950b57cec5SDimitry Andric     static_assert((!(std::_IsSame<_A1, __result_type>::value &&
9960b57cec5SDimitry Andric                      std::_IsSame<_A2, __result_type>::value)), "");
9970b57cec5SDimitry Andric     return ::pow((__result_type)__lcpp_x, (__result_type)__lcpp_y);
9980b57cec5SDimitry Andric }
9990b57cec5SDimitry Andric 
10000b57cec5SDimitry Andric // sin
10010b57cec5SDimitry Andric 
10020b57cec5SDimitry Andric #if !(defined(_AIX) || defined(__sun__))
10030b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY float       sin(float __lcpp_x) _NOEXCEPT       {return ::sinf(__lcpp_x);}
10040b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY long double sin(long double __lcpp_x) _NOEXCEPT {return ::sinl(__lcpp_x);}
10050b57cec5SDimitry Andric #endif
10060b57cec5SDimitry Andric 
10070b57cec5SDimitry Andric template <class _A1>
10080b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY
10090b57cec5SDimitry Andric typename std::enable_if<std::is_integral<_A1>::value, double>::type
10100b57cec5SDimitry Andric sin(_A1 __lcpp_x) _NOEXCEPT {return ::sin((double)__lcpp_x);}
10110b57cec5SDimitry Andric 
10120b57cec5SDimitry Andric // sinh
10130b57cec5SDimitry Andric 
10140b57cec5SDimitry Andric #if !(defined(_AIX) || defined(__sun__))
10150b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY float       sinh(float __lcpp_x) _NOEXCEPT       {return ::sinhf(__lcpp_x);}
10160b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY long double sinh(long double __lcpp_x) _NOEXCEPT {return ::sinhl(__lcpp_x);}
10170b57cec5SDimitry Andric #endif
10180b57cec5SDimitry Andric 
10190b57cec5SDimitry Andric template <class _A1>
10200b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY
10210b57cec5SDimitry Andric typename std::enable_if<std::is_integral<_A1>::value, double>::type
10220b57cec5SDimitry Andric sinh(_A1 __lcpp_x) _NOEXCEPT {return ::sinh((double)__lcpp_x);}
10230b57cec5SDimitry Andric 
10240b57cec5SDimitry Andric // sqrt
10250b57cec5SDimitry Andric 
10260b57cec5SDimitry Andric #if !(defined(_AIX) || defined(__sun__))
10270b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY float       sqrt(float __lcpp_x) _NOEXCEPT       {return ::sqrtf(__lcpp_x);}
10280b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY long double sqrt(long double __lcpp_x) _NOEXCEPT {return ::sqrtl(__lcpp_x);}
10290b57cec5SDimitry Andric #endif
10300b57cec5SDimitry Andric 
10310b57cec5SDimitry Andric template <class _A1>
10320b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY
10330b57cec5SDimitry Andric typename std::enable_if<std::is_integral<_A1>::value, double>::type
10340b57cec5SDimitry Andric sqrt(_A1 __lcpp_x) _NOEXCEPT {return ::sqrt((double)__lcpp_x);}
10350b57cec5SDimitry Andric 
10360b57cec5SDimitry Andric // tan
10370b57cec5SDimitry Andric 
10380b57cec5SDimitry Andric #if !(defined(_AIX) || defined(__sun__))
10390b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY float       tan(float __lcpp_x) _NOEXCEPT       {return ::tanf(__lcpp_x);}
10400b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY long double tan(long double __lcpp_x) _NOEXCEPT {return ::tanl(__lcpp_x);}
10410b57cec5SDimitry Andric #endif
10420b57cec5SDimitry Andric 
10430b57cec5SDimitry Andric template <class _A1>
10440b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY
10450b57cec5SDimitry Andric typename std::enable_if<std::is_integral<_A1>::value, double>::type
10460b57cec5SDimitry Andric tan(_A1 __lcpp_x) _NOEXCEPT {return ::tan((double)__lcpp_x);}
10470b57cec5SDimitry Andric 
10480b57cec5SDimitry Andric // tanh
10490b57cec5SDimitry Andric 
10500b57cec5SDimitry Andric #if !(defined(_AIX) || defined(__sun__))
10510b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY float       tanh(float __lcpp_x) _NOEXCEPT       {return ::tanhf(__lcpp_x);}
10520b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY long double tanh(long double __lcpp_x) _NOEXCEPT {return ::tanhl(__lcpp_x);}
10530b57cec5SDimitry Andric #endif
10540b57cec5SDimitry Andric 
10550b57cec5SDimitry Andric template <class _A1>
10560b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY
10570b57cec5SDimitry Andric typename std::enable_if<std::is_integral<_A1>::value, double>::type
10580b57cec5SDimitry Andric tanh(_A1 __lcpp_x) _NOEXCEPT {return ::tanh((double)__lcpp_x);}
10590b57cec5SDimitry Andric 
10600b57cec5SDimitry Andric // acosh
10610b57cec5SDimitry Andric 
10620b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY float       acosh(float __lcpp_x) _NOEXCEPT       {return ::acoshf(__lcpp_x);}
10630b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY long double acosh(long double __lcpp_x) _NOEXCEPT {return ::acoshl(__lcpp_x);}
10640b57cec5SDimitry Andric 
10650b57cec5SDimitry Andric template <class _A1>
10660b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY
10670b57cec5SDimitry Andric typename std::enable_if<std::is_integral<_A1>::value, double>::type
10680b57cec5SDimitry Andric acosh(_A1 __lcpp_x) _NOEXCEPT {return ::acosh((double)__lcpp_x);}
10690b57cec5SDimitry Andric 
10700b57cec5SDimitry Andric // asinh
10710b57cec5SDimitry Andric 
10720b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY float       asinh(float __lcpp_x) _NOEXCEPT       {return ::asinhf(__lcpp_x);}
10730b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY long double asinh(long double __lcpp_x) _NOEXCEPT {return ::asinhl(__lcpp_x);}
10740b57cec5SDimitry Andric 
10750b57cec5SDimitry Andric template <class _A1>
10760b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY
10770b57cec5SDimitry Andric typename std::enable_if<std::is_integral<_A1>::value, double>::type
10780b57cec5SDimitry Andric asinh(_A1 __lcpp_x) _NOEXCEPT {return ::asinh((double)__lcpp_x);}
10790b57cec5SDimitry Andric 
10800b57cec5SDimitry Andric // atanh
10810b57cec5SDimitry Andric 
10820b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY float       atanh(float __lcpp_x) _NOEXCEPT       {return ::atanhf(__lcpp_x);}
10830b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY long double atanh(long double __lcpp_x) _NOEXCEPT {return ::atanhl(__lcpp_x);}
10840b57cec5SDimitry Andric 
10850b57cec5SDimitry Andric template <class _A1>
10860b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY
10870b57cec5SDimitry Andric typename std::enable_if<std::is_integral<_A1>::value, double>::type
10880b57cec5SDimitry Andric atanh(_A1 __lcpp_x) _NOEXCEPT {return ::atanh((double)__lcpp_x);}
10890b57cec5SDimitry Andric 
10900b57cec5SDimitry Andric // cbrt
10910b57cec5SDimitry Andric 
10920b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY float       cbrt(float __lcpp_x) _NOEXCEPT       {return ::cbrtf(__lcpp_x);}
10930b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY long double cbrt(long double __lcpp_x) _NOEXCEPT {return ::cbrtl(__lcpp_x);}
10940b57cec5SDimitry Andric 
10950b57cec5SDimitry Andric template <class _A1>
10960b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY
10970b57cec5SDimitry Andric typename std::enable_if<std::is_integral<_A1>::value, double>::type
10980b57cec5SDimitry Andric cbrt(_A1 __lcpp_x) _NOEXCEPT {return ::cbrt((double)__lcpp_x);}
10990b57cec5SDimitry Andric 
11000b57cec5SDimitry Andric // copysign
11010b57cec5SDimitry Andric 
11020b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY float copysign(float __lcpp_x,
11030b57cec5SDimitry Andric                                                 float __lcpp_y) _NOEXCEPT {
11040b57cec5SDimitry Andric   return ::copysignf(__lcpp_x, __lcpp_y);
11050b57cec5SDimitry Andric }
11060b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY long double
11070b57cec5SDimitry Andric copysign(long double __lcpp_x, long double __lcpp_y) _NOEXCEPT {
11080b57cec5SDimitry Andric   return ::copysignl(__lcpp_x, __lcpp_y);
11090b57cec5SDimitry Andric }
11100b57cec5SDimitry Andric 
11110b57cec5SDimitry Andric template <class _A1, class _A2>
11120b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY
11130b57cec5SDimitry Andric typename std::_EnableIf
11140b57cec5SDimitry Andric <
11150b57cec5SDimitry Andric     std::is_arithmetic<_A1>::value &&
11160b57cec5SDimitry Andric     std::is_arithmetic<_A2>::value,
11170b57cec5SDimitry Andric     std::__promote<_A1, _A2>
11180b57cec5SDimitry Andric >::type
11190b57cec5SDimitry Andric copysign(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
11200b57cec5SDimitry Andric {
11210b57cec5SDimitry Andric     typedef typename std::__promote<_A1, _A2>::type __result_type;
11220b57cec5SDimitry Andric     static_assert((!(std::_IsSame<_A1, __result_type>::value &&
11230b57cec5SDimitry Andric                      std::_IsSame<_A2, __result_type>::value)), "");
11240b57cec5SDimitry Andric     return ::copysign((__result_type)__lcpp_x, (__result_type)__lcpp_y);
11250b57cec5SDimitry Andric }
11260b57cec5SDimitry Andric 
11270b57cec5SDimitry Andric // erf
11280b57cec5SDimitry Andric 
11290b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY float       erf(float __lcpp_x) _NOEXCEPT       {return ::erff(__lcpp_x);}
11300b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY long double erf(long double __lcpp_x) _NOEXCEPT {return ::erfl(__lcpp_x);}
11310b57cec5SDimitry Andric 
11320b57cec5SDimitry Andric template <class _A1>
11330b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY
11340b57cec5SDimitry Andric typename std::enable_if<std::is_integral<_A1>::value, double>::type
11350b57cec5SDimitry Andric erf(_A1 __lcpp_x) _NOEXCEPT {return ::erf((double)__lcpp_x);}
11360b57cec5SDimitry Andric 
11370b57cec5SDimitry Andric // erfc
11380b57cec5SDimitry Andric 
11390b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY float       erfc(float __lcpp_x) _NOEXCEPT       {return ::erfcf(__lcpp_x);}
11400b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY long double erfc(long double __lcpp_x) _NOEXCEPT {return ::erfcl(__lcpp_x);}
11410b57cec5SDimitry Andric 
11420b57cec5SDimitry Andric template <class _A1>
11430b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY
11440b57cec5SDimitry Andric typename std::enable_if<std::is_integral<_A1>::value, double>::type
11450b57cec5SDimitry Andric erfc(_A1 __lcpp_x) _NOEXCEPT {return ::erfc((double)__lcpp_x);}
11460b57cec5SDimitry Andric 
11470b57cec5SDimitry Andric // exp2
11480b57cec5SDimitry Andric 
11490b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY float       exp2(float __lcpp_x) _NOEXCEPT       {return ::exp2f(__lcpp_x);}
11500b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY long double exp2(long double __lcpp_x) _NOEXCEPT {return ::exp2l(__lcpp_x);}
11510b57cec5SDimitry Andric 
11520b57cec5SDimitry Andric template <class _A1>
11530b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY
11540b57cec5SDimitry Andric typename std::enable_if<std::is_integral<_A1>::value, double>::type
11550b57cec5SDimitry Andric exp2(_A1 __lcpp_x) _NOEXCEPT {return ::exp2((double)__lcpp_x);}
11560b57cec5SDimitry Andric 
11570b57cec5SDimitry Andric // expm1
11580b57cec5SDimitry Andric 
11590b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY float       expm1(float __lcpp_x) _NOEXCEPT       {return ::expm1f(__lcpp_x);}
11600b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY long double expm1(long double __lcpp_x) _NOEXCEPT {return ::expm1l(__lcpp_x);}
11610b57cec5SDimitry Andric 
11620b57cec5SDimitry Andric template <class _A1>
11630b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY
11640b57cec5SDimitry Andric typename std::enable_if<std::is_integral<_A1>::value, double>::type
11650b57cec5SDimitry Andric expm1(_A1 __lcpp_x) _NOEXCEPT {return ::expm1((double)__lcpp_x);}
11660b57cec5SDimitry Andric 
11670b57cec5SDimitry Andric // fdim
11680b57cec5SDimitry Andric 
11690b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY float       fdim(float __lcpp_x, float __lcpp_y) _NOEXCEPT             {return ::fdimf(__lcpp_x, __lcpp_y);}
11700b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY long double fdim(long double __lcpp_x, long double __lcpp_y) _NOEXCEPT {return ::fdiml(__lcpp_x, __lcpp_y);}
11710b57cec5SDimitry Andric 
11720b57cec5SDimitry Andric template <class _A1, class _A2>
11730b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY
11740b57cec5SDimitry Andric typename std::_EnableIf
11750b57cec5SDimitry Andric <
11760b57cec5SDimitry Andric     std::is_arithmetic<_A1>::value &&
11770b57cec5SDimitry Andric     std::is_arithmetic<_A2>::value,
11780b57cec5SDimitry Andric     std::__promote<_A1, _A2>
11790b57cec5SDimitry Andric >::type
11800b57cec5SDimitry Andric fdim(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
11810b57cec5SDimitry Andric {
11820b57cec5SDimitry Andric     typedef typename std::__promote<_A1, _A2>::type __result_type;
11830b57cec5SDimitry Andric     static_assert((!(std::_IsSame<_A1, __result_type>::value &&
11840b57cec5SDimitry Andric                      std::_IsSame<_A2, __result_type>::value)), "");
11850b57cec5SDimitry Andric     return ::fdim((__result_type)__lcpp_x, (__result_type)__lcpp_y);
11860b57cec5SDimitry Andric }
11870b57cec5SDimitry Andric 
11880b57cec5SDimitry Andric // fma
11890b57cec5SDimitry Andric 
11900b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY float       fma(float __lcpp_x, float __lcpp_y, float __lcpp_z) _NOEXCEPT                   {return ::fmaf(__lcpp_x, __lcpp_y, __lcpp_z);}
11910b57cec5SDimitry Andric inline _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);}
11920b57cec5SDimitry Andric 
11930b57cec5SDimitry Andric template <class _A1, class _A2, class _A3>
11940b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY
11950b57cec5SDimitry Andric typename std::_EnableIf
11960b57cec5SDimitry Andric <
11970b57cec5SDimitry Andric     std::is_arithmetic<_A1>::value &&
11980b57cec5SDimitry Andric     std::is_arithmetic<_A2>::value &&
11990b57cec5SDimitry Andric     std::is_arithmetic<_A3>::value,
12000b57cec5SDimitry Andric     std::__promote<_A1, _A2, _A3>
12010b57cec5SDimitry Andric >::type
12020b57cec5SDimitry Andric fma(_A1 __lcpp_x, _A2 __lcpp_y, _A3 __lcpp_z) _NOEXCEPT
12030b57cec5SDimitry Andric {
12040b57cec5SDimitry Andric     typedef typename std::__promote<_A1, _A2, _A3>::type __result_type;
12050b57cec5SDimitry Andric     static_assert((!(std::_IsSame<_A1, __result_type>::value &&
12060b57cec5SDimitry Andric                      std::_IsSame<_A2, __result_type>::value &&
12070b57cec5SDimitry Andric                      std::_IsSame<_A3, __result_type>::value)), "");
12080b57cec5SDimitry Andric     return ::fma((__result_type)__lcpp_x, (__result_type)__lcpp_y, (__result_type)__lcpp_z);
12090b57cec5SDimitry Andric }
12100b57cec5SDimitry Andric 
12110b57cec5SDimitry Andric // fmax
12120b57cec5SDimitry Andric 
12130b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY float       fmax(float __lcpp_x, float __lcpp_y) _NOEXCEPT             {return ::fmaxf(__lcpp_x, __lcpp_y);}
12140b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY long double fmax(long double __lcpp_x, long double __lcpp_y) _NOEXCEPT {return ::fmaxl(__lcpp_x, __lcpp_y);}
12150b57cec5SDimitry Andric 
12160b57cec5SDimitry Andric template <class _A1, class _A2>
12170b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY
12180b57cec5SDimitry Andric typename std::_EnableIf
12190b57cec5SDimitry Andric <
12200b57cec5SDimitry Andric     std::is_arithmetic<_A1>::value &&
12210b57cec5SDimitry Andric     std::is_arithmetic<_A2>::value,
12220b57cec5SDimitry Andric     std::__promote<_A1, _A2>
12230b57cec5SDimitry Andric >::type
12240b57cec5SDimitry Andric fmax(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
12250b57cec5SDimitry Andric {
12260b57cec5SDimitry Andric     typedef typename std::__promote<_A1, _A2>::type __result_type;
12270b57cec5SDimitry Andric     static_assert((!(std::_IsSame<_A1, __result_type>::value &&
12280b57cec5SDimitry Andric                      std::_IsSame<_A2, __result_type>::value)), "");
12290b57cec5SDimitry Andric     return ::fmax((__result_type)__lcpp_x, (__result_type)__lcpp_y);
12300b57cec5SDimitry Andric }
12310b57cec5SDimitry Andric 
12320b57cec5SDimitry Andric // fmin
12330b57cec5SDimitry Andric 
12340b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY float       fmin(float __lcpp_x, float __lcpp_y) _NOEXCEPT             {return ::fminf(__lcpp_x, __lcpp_y);}
12350b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY long double fmin(long double __lcpp_x, long double __lcpp_y) _NOEXCEPT {return ::fminl(__lcpp_x, __lcpp_y);}
12360b57cec5SDimitry Andric 
12370b57cec5SDimitry Andric template <class _A1, class _A2>
12380b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY
12390b57cec5SDimitry Andric typename std::_EnableIf
12400b57cec5SDimitry Andric <
12410b57cec5SDimitry Andric     std::is_arithmetic<_A1>::value &&
12420b57cec5SDimitry Andric     std::is_arithmetic<_A2>::value,
12430b57cec5SDimitry Andric     std::__promote<_A1, _A2>
12440b57cec5SDimitry Andric >::type
12450b57cec5SDimitry Andric fmin(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
12460b57cec5SDimitry Andric {
12470b57cec5SDimitry Andric     typedef typename std::__promote<_A1, _A2>::type __result_type;
12480b57cec5SDimitry Andric     static_assert((!(std::_IsSame<_A1, __result_type>::value &&
12490b57cec5SDimitry Andric                      std::_IsSame<_A2, __result_type>::value)), "");
12500b57cec5SDimitry Andric     return ::fmin((__result_type)__lcpp_x, (__result_type)__lcpp_y);
12510b57cec5SDimitry Andric }
12520b57cec5SDimitry Andric 
12530b57cec5SDimitry Andric // hypot
12540b57cec5SDimitry Andric 
12550b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY float       hypot(float __lcpp_x, float __lcpp_y) _NOEXCEPT             {return ::hypotf(__lcpp_x, __lcpp_y);}
12560b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY long double hypot(long double __lcpp_x, long double __lcpp_y) _NOEXCEPT {return ::hypotl(__lcpp_x, __lcpp_y);}
12570b57cec5SDimitry Andric 
12580b57cec5SDimitry Andric template <class _A1, class _A2>
12590b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY
12600b57cec5SDimitry Andric typename std::_EnableIf
12610b57cec5SDimitry Andric <
12620b57cec5SDimitry Andric     std::is_arithmetic<_A1>::value &&
12630b57cec5SDimitry Andric     std::is_arithmetic<_A2>::value,
12640b57cec5SDimitry Andric     std::__promote<_A1, _A2>
12650b57cec5SDimitry Andric >::type
12660b57cec5SDimitry Andric hypot(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
12670b57cec5SDimitry Andric {
12680b57cec5SDimitry Andric     typedef typename std::__promote<_A1, _A2>::type __result_type;
12690b57cec5SDimitry Andric     static_assert((!(std::_IsSame<_A1, __result_type>::value &&
12700b57cec5SDimitry Andric                      std::_IsSame<_A2, __result_type>::value)), "");
12710b57cec5SDimitry Andric     return ::hypot((__result_type)__lcpp_x, (__result_type)__lcpp_y);
12720b57cec5SDimitry Andric }
12730b57cec5SDimitry Andric 
12740b57cec5SDimitry Andric // ilogb
12750b57cec5SDimitry Andric 
12760b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY int ilogb(float __lcpp_x) _NOEXCEPT       {return ::ilogbf(__lcpp_x);}
12770b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY int ilogb(long double __lcpp_x) _NOEXCEPT {return ::ilogbl(__lcpp_x);}
12780b57cec5SDimitry Andric 
12790b57cec5SDimitry Andric template <class _A1>
12800b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY
12810b57cec5SDimitry Andric typename std::enable_if<std::is_integral<_A1>::value, int>::type
12820b57cec5SDimitry Andric ilogb(_A1 __lcpp_x) _NOEXCEPT {return ::ilogb((double)__lcpp_x);}
12830b57cec5SDimitry Andric 
12840b57cec5SDimitry Andric // lgamma
12850b57cec5SDimitry Andric 
12860b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY float       lgamma(float __lcpp_x) _NOEXCEPT       {return ::lgammaf(__lcpp_x);}
12870b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY long double lgamma(long double __lcpp_x) _NOEXCEPT {return ::lgammal(__lcpp_x);}
12880b57cec5SDimitry Andric 
12890b57cec5SDimitry Andric template <class _A1>
12900b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY
12910b57cec5SDimitry Andric typename std::enable_if<std::is_integral<_A1>::value, double>::type
12920b57cec5SDimitry Andric lgamma(_A1 __lcpp_x) _NOEXCEPT {return ::lgamma((double)__lcpp_x);}
12930b57cec5SDimitry Andric 
12940b57cec5SDimitry Andric // llrint
12950b57cec5SDimitry Andric 
12960b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY long long llrint(float __lcpp_x) _NOEXCEPT       {return ::llrintf(__lcpp_x);}
12970b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY long long llrint(long double __lcpp_x) _NOEXCEPT {return ::llrintl(__lcpp_x);}
12980b57cec5SDimitry Andric 
12990b57cec5SDimitry Andric template <class _A1>
13000b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY
13010b57cec5SDimitry Andric typename std::enable_if<std::is_integral<_A1>::value, long long>::type
13020b57cec5SDimitry Andric llrint(_A1 __lcpp_x) _NOEXCEPT {return ::llrint((double)__lcpp_x);}
13030b57cec5SDimitry Andric 
13040b57cec5SDimitry Andric // llround
13050b57cec5SDimitry Andric 
13060b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY long long llround(float __lcpp_x) _NOEXCEPT       {return ::llroundf(__lcpp_x);}
13070b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY long long llround(long double __lcpp_x) _NOEXCEPT {return ::llroundl(__lcpp_x);}
13080b57cec5SDimitry Andric 
13090b57cec5SDimitry Andric template <class _A1>
13100b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY
13110b57cec5SDimitry Andric typename std::enable_if<std::is_integral<_A1>::value, long long>::type
13120b57cec5SDimitry Andric llround(_A1 __lcpp_x) _NOEXCEPT {return ::llround((double)__lcpp_x);}
13130b57cec5SDimitry Andric 
13140b57cec5SDimitry Andric // log1p
13150b57cec5SDimitry Andric 
13160b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY float       log1p(float __lcpp_x) _NOEXCEPT       {return ::log1pf(__lcpp_x);}
13170b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY long double log1p(long double __lcpp_x) _NOEXCEPT {return ::log1pl(__lcpp_x);}
13180b57cec5SDimitry Andric 
13190b57cec5SDimitry Andric template <class _A1>
13200b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY
13210b57cec5SDimitry Andric typename std::enable_if<std::is_integral<_A1>::value, double>::type
13220b57cec5SDimitry Andric log1p(_A1 __lcpp_x) _NOEXCEPT {return ::log1p((double)__lcpp_x);}
13230b57cec5SDimitry Andric 
13240b57cec5SDimitry Andric // log2
13250b57cec5SDimitry Andric 
13260b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY float       log2(float __lcpp_x) _NOEXCEPT       {return ::log2f(__lcpp_x);}
13270b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY long double log2(long double __lcpp_x) _NOEXCEPT {return ::log2l(__lcpp_x);}
13280b57cec5SDimitry Andric 
13290b57cec5SDimitry Andric template <class _A1>
13300b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY
13310b57cec5SDimitry Andric typename std::enable_if<std::is_integral<_A1>::value, double>::type
13320b57cec5SDimitry Andric log2(_A1 __lcpp_x) _NOEXCEPT {return ::log2((double)__lcpp_x);}
13330b57cec5SDimitry Andric 
13340b57cec5SDimitry Andric // logb
13350b57cec5SDimitry Andric 
13360b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY float       logb(float __lcpp_x) _NOEXCEPT       {return ::logbf(__lcpp_x);}
13370b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY long double logb(long double __lcpp_x) _NOEXCEPT {return ::logbl(__lcpp_x);}
13380b57cec5SDimitry Andric 
13390b57cec5SDimitry Andric template <class _A1>
13400b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY
13410b57cec5SDimitry Andric typename std::enable_if<std::is_integral<_A1>::value, double>::type
13420b57cec5SDimitry Andric logb(_A1 __lcpp_x) _NOEXCEPT {return ::logb((double)__lcpp_x);}
13430b57cec5SDimitry Andric 
13440b57cec5SDimitry Andric // lrint
13450b57cec5SDimitry Andric 
13460b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY long lrint(float __lcpp_x) _NOEXCEPT       {return ::lrintf(__lcpp_x);}
13470b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY long lrint(long double __lcpp_x) _NOEXCEPT {return ::lrintl(__lcpp_x);}
13480b57cec5SDimitry Andric 
13490b57cec5SDimitry Andric template <class _A1>
13500b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY
13510b57cec5SDimitry Andric typename std::enable_if<std::is_integral<_A1>::value, long>::type
13520b57cec5SDimitry Andric lrint(_A1 __lcpp_x) _NOEXCEPT {return ::lrint((double)__lcpp_x);}
13530b57cec5SDimitry Andric 
13540b57cec5SDimitry Andric // lround
13550b57cec5SDimitry Andric 
13560b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY long lround(float __lcpp_x) _NOEXCEPT       {return ::lroundf(__lcpp_x);}
13570b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY long lround(long double __lcpp_x) _NOEXCEPT {return ::lroundl(__lcpp_x);}
13580b57cec5SDimitry Andric 
13590b57cec5SDimitry Andric template <class _A1>
13600b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY
13610b57cec5SDimitry Andric typename std::enable_if<std::is_integral<_A1>::value, long>::type
13620b57cec5SDimitry Andric lround(_A1 __lcpp_x) _NOEXCEPT {return ::lround((double)__lcpp_x);}
13630b57cec5SDimitry Andric 
13640b57cec5SDimitry Andric // nan
13650b57cec5SDimitry Andric 
13660b57cec5SDimitry Andric // nearbyint
13670b57cec5SDimitry Andric 
13680b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY float       nearbyint(float __lcpp_x) _NOEXCEPT       {return ::nearbyintf(__lcpp_x);}
13690b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY long double nearbyint(long double __lcpp_x) _NOEXCEPT {return ::nearbyintl(__lcpp_x);}
13700b57cec5SDimitry Andric 
13710b57cec5SDimitry Andric template <class _A1>
13720b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY
13730b57cec5SDimitry Andric typename std::enable_if<std::is_integral<_A1>::value, double>::type
13740b57cec5SDimitry Andric nearbyint(_A1 __lcpp_x) _NOEXCEPT {return ::nearbyint((double)__lcpp_x);}
13750b57cec5SDimitry Andric 
13760b57cec5SDimitry Andric // nextafter
13770b57cec5SDimitry Andric 
13780b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY float       nextafter(float __lcpp_x, float __lcpp_y) _NOEXCEPT             {return ::nextafterf(__lcpp_x, __lcpp_y);}
13790b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY long double nextafter(long double __lcpp_x, long double __lcpp_y) _NOEXCEPT {return ::nextafterl(__lcpp_x, __lcpp_y);}
13800b57cec5SDimitry Andric 
13810b57cec5SDimitry Andric template <class _A1, class _A2>
13820b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY
13830b57cec5SDimitry Andric typename std::_EnableIf
13840b57cec5SDimitry Andric <
13850b57cec5SDimitry Andric     std::is_arithmetic<_A1>::value &&
13860b57cec5SDimitry Andric     std::is_arithmetic<_A2>::value,
13870b57cec5SDimitry Andric     std::__promote<_A1, _A2>
13880b57cec5SDimitry Andric >::type
13890b57cec5SDimitry Andric nextafter(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
13900b57cec5SDimitry Andric {
13910b57cec5SDimitry Andric     typedef typename std::__promote<_A1, _A2>::type __result_type;
13920b57cec5SDimitry Andric     static_assert((!(std::_IsSame<_A1, __result_type>::value &&
13930b57cec5SDimitry Andric                      std::_IsSame<_A2, __result_type>::value)), "");
13940b57cec5SDimitry Andric     return ::nextafter((__result_type)__lcpp_x, (__result_type)__lcpp_y);
13950b57cec5SDimitry Andric }
13960b57cec5SDimitry Andric 
13970b57cec5SDimitry Andric // nexttoward
13980b57cec5SDimitry Andric 
13990b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY float       nexttoward(float __lcpp_x, long double __lcpp_y) _NOEXCEPT       {return ::nexttowardf(__lcpp_x, __lcpp_y);}
14000b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY long double nexttoward(long double __lcpp_x, long double __lcpp_y) _NOEXCEPT {return ::nexttowardl(__lcpp_x, __lcpp_y);}
14010b57cec5SDimitry Andric 
14020b57cec5SDimitry Andric template <class _A1>
14030b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY
14040b57cec5SDimitry Andric typename std::enable_if<std::is_integral<_A1>::value, double>::type
14050b57cec5SDimitry Andric nexttoward(_A1 __lcpp_x, long double __lcpp_y) _NOEXCEPT {return ::nexttoward((double)__lcpp_x, __lcpp_y);}
14060b57cec5SDimitry Andric 
14070b57cec5SDimitry Andric // remainder
14080b57cec5SDimitry Andric 
14090b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY float       remainder(float __lcpp_x, float __lcpp_y) _NOEXCEPT             {return ::remainderf(__lcpp_x, __lcpp_y);}
14100b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY long double remainder(long double __lcpp_x, long double __lcpp_y) _NOEXCEPT {return ::remainderl(__lcpp_x, __lcpp_y);}
14110b57cec5SDimitry Andric 
14120b57cec5SDimitry Andric template <class _A1, class _A2>
14130b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY
14140b57cec5SDimitry Andric typename std::_EnableIf
14150b57cec5SDimitry Andric <
14160b57cec5SDimitry Andric     std::is_arithmetic<_A1>::value &&
14170b57cec5SDimitry Andric     std::is_arithmetic<_A2>::value,
14180b57cec5SDimitry Andric     std::__promote<_A1, _A2>
14190b57cec5SDimitry Andric >::type
14200b57cec5SDimitry Andric remainder(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
14210b57cec5SDimitry Andric {
14220b57cec5SDimitry Andric     typedef typename std::__promote<_A1, _A2>::type __result_type;
14230b57cec5SDimitry Andric     static_assert((!(std::_IsSame<_A1, __result_type>::value &&
14240b57cec5SDimitry Andric                      std::_IsSame<_A2, __result_type>::value)), "");
14250b57cec5SDimitry Andric     return ::remainder((__result_type)__lcpp_x, (__result_type)__lcpp_y);
14260b57cec5SDimitry Andric }
14270b57cec5SDimitry Andric 
14280b57cec5SDimitry Andric // remquo
14290b57cec5SDimitry Andric 
14300b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY float       remquo(float __lcpp_x, float __lcpp_y, int* __lcpp_z) _NOEXCEPT             {return ::remquof(__lcpp_x, __lcpp_y, __lcpp_z);}
14310b57cec5SDimitry Andric inline _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);}
14320b57cec5SDimitry Andric 
14330b57cec5SDimitry Andric template <class _A1, class _A2>
14340b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY
14350b57cec5SDimitry Andric typename std::_EnableIf
14360b57cec5SDimitry Andric <
14370b57cec5SDimitry Andric     std::is_arithmetic<_A1>::value &&
14380b57cec5SDimitry Andric     std::is_arithmetic<_A2>::value,
14390b57cec5SDimitry Andric     std::__promote<_A1, _A2>
14400b57cec5SDimitry Andric >::type
14410b57cec5SDimitry Andric remquo(_A1 __lcpp_x, _A2 __lcpp_y, int* __lcpp_z) _NOEXCEPT
14420b57cec5SDimitry Andric {
14430b57cec5SDimitry Andric     typedef typename std::__promote<_A1, _A2>::type __result_type;
14440b57cec5SDimitry Andric     static_assert((!(std::_IsSame<_A1, __result_type>::value &&
14450b57cec5SDimitry Andric                      std::_IsSame<_A2, __result_type>::value)), "");
14460b57cec5SDimitry Andric     return ::remquo((__result_type)__lcpp_x, (__result_type)__lcpp_y, __lcpp_z);
14470b57cec5SDimitry Andric }
14480b57cec5SDimitry Andric 
14490b57cec5SDimitry Andric // rint
14500b57cec5SDimitry Andric 
14510b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY float       rint(float __lcpp_x) _NOEXCEPT       {return ::rintf(__lcpp_x);}
14520b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY long double rint(long double __lcpp_x) _NOEXCEPT {return ::rintl(__lcpp_x);}
14530b57cec5SDimitry Andric 
14540b57cec5SDimitry Andric template <class _A1>
14550b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY
14560b57cec5SDimitry Andric typename std::enable_if<std::is_integral<_A1>::value, double>::type
14570b57cec5SDimitry Andric rint(_A1 __lcpp_x) _NOEXCEPT {return ::rint((double)__lcpp_x);}
14580b57cec5SDimitry Andric 
14590b57cec5SDimitry Andric // round
14600b57cec5SDimitry Andric 
14610b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY float       round(float __lcpp_x) _NOEXCEPT       {return ::roundf(__lcpp_x);}
14620b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY long double round(long double __lcpp_x) _NOEXCEPT {return ::roundl(__lcpp_x);}
14630b57cec5SDimitry Andric 
14640b57cec5SDimitry Andric template <class _A1>
14650b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY
14660b57cec5SDimitry Andric typename std::enable_if<std::is_integral<_A1>::value, double>::type
14670b57cec5SDimitry Andric round(_A1 __lcpp_x) _NOEXCEPT {return ::round((double)__lcpp_x);}
14680b57cec5SDimitry Andric 
14690b57cec5SDimitry Andric // scalbln
14700b57cec5SDimitry Andric 
14710b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY float       scalbln(float __lcpp_x, long __lcpp_y) _NOEXCEPT       {return ::scalblnf(__lcpp_x, __lcpp_y);}
14720b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY long double scalbln(long double __lcpp_x, long __lcpp_y) _NOEXCEPT {return ::scalblnl(__lcpp_x, __lcpp_y);}
14730b57cec5SDimitry Andric 
14740b57cec5SDimitry Andric template <class _A1>
14750b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY
14760b57cec5SDimitry Andric typename std::enable_if<std::is_integral<_A1>::value, double>::type
14770b57cec5SDimitry Andric scalbln(_A1 __lcpp_x, long __lcpp_y) _NOEXCEPT {return ::scalbln((double)__lcpp_x, __lcpp_y);}
14780b57cec5SDimitry Andric 
14790b57cec5SDimitry Andric // scalbn
14800b57cec5SDimitry Andric 
14810b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY float       scalbn(float __lcpp_x, int __lcpp_y) _NOEXCEPT       {return ::scalbnf(__lcpp_x, __lcpp_y);}
14820b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY long double scalbn(long double __lcpp_x, int __lcpp_y) _NOEXCEPT {return ::scalbnl(__lcpp_x, __lcpp_y);}
14830b57cec5SDimitry Andric 
14840b57cec5SDimitry Andric template <class _A1>
14850b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY
14860b57cec5SDimitry Andric typename std::enable_if<std::is_integral<_A1>::value, double>::type
14870b57cec5SDimitry Andric scalbn(_A1 __lcpp_x, int __lcpp_y) _NOEXCEPT {return ::scalbn((double)__lcpp_x, __lcpp_y);}
14880b57cec5SDimitry Andric 
14890b57cec5SDimitry Andric // tgamma
14900b57cec5SDimitry Andric 
14910b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY float       tgamma(float __lcpp_x) _NOEXCEPT       {return ::tgammaf(__lcpp_x);}
14920b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY long double tgamma(long double __lcpp_x) _NOEXCEPT {return ::tgammal(__lcpp_x);}
14930b57cec5SDimitry Andric 
14940b57cec5SDimitry Andric template <class _A1>
14950b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY
14960b57cec5SDimitry Andric typename std::enable_if<std::is_integral<_A1>::value, double>::type
14970b57cec5SDimitry Andric tgamma(_A1 __lcpp_x) _NOEXCEPT {return ::tgamma((double)__lcpp_x);}
14980b57cec5SDimitry Andric 
14990b57cec5SDimitry Andric // trunc
15000b57cec5SDimitry Andric 
15010b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY float       trunc(float __lcpp_x) _NOEXCEPT       {return ::truncf(__lcpp_x);}
15020b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY long double trunc(long double __lcpp_x) _NOEXCEPT {return ::truncl(__lcpp_x);}
15030b57cec5SDimitry Andric 
15040b57cec5SDimitry Andric template <class _A1>
15050b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY
15060b57cec5SDimitry Andric typename std::enable_if<std::is_integral<_A1>::value, double>::type
15070b57cec5SDimitry Andric trunc(_A1 __lcpp_x) _NOEXCEPT {return ::trunc((double)__lcpp_x);}
15080b57cec5SDimitry Andric 
15090b57cec5SDimitry Andric } // extern "C++"
15100b57cec5SDimitry Andric 
15110b57cec5SDimitry Andric #endif // __cplusplus
15120b57cec5SDimitry Andric 
15130b57cec5SDimitry Andric #else // _LIBCPP_MATH_H
15140b57cec5SDimitry Andric 
15150b57cec5SDimitry Andric // This include lives outside the header guard in order to support an MSVC
15160b57cec5SDimitry Andric // extension which allows users to do:
15170b57cec5SDimitry Andric //
15180b57cec5SDimitry Andric // #define _USE_MATH_DEFINES
15190b57cec5SDimitry Andric // #include <math.h>
15200b57cec5SDimitry Andric //
15210b57cec5SDimitry Andric // and receive the definitions of mathematical constants, even if <math.h>
15220b57cec5SDimitry Andric // has previously been included.
15230b57cec5SDimitry Andric #if defined(_LIBCPP_MSVCRT) && defined(_USE_MATH_DEFINES)
15240b57cec5SDimitry Andric #include_next <math.h>
15250b57cec5SDimitry Andric #endif
15260b57cec5SDimitry Andric 
15270b57cec5SDimitry Andric #endif  // _LIBCPP_MATH_H
1528