10b57cec5SDimitry Andric // -*- C++ -*- 2*349cc55cSDimitry Andric //===----------------------------------------------------------------------===// 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 3085ffd83dbSDimitry 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 { 321fe6060f1SDimitry Andric #if __has_builtin(__builtin_signbit) 322fe6060f1SDimitry Andric return __builtin_signbit(__lcpp_x); 323fe6060f1SDimitry Andric #else 3240b57cec5SDimitry Andric return signbit(__lcpp_x); 325fe6060f1SDimitry Andric #endif 3260b57cec5SDimitry Andric } 3270b57cec5SDimitry Andric 3280b57cec5SDimitry Andric #undef signbit 3290b57cec5SDimitry Andric 3300b57cec5SDimitry Andric template <class _A1> 3310b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY 3320b57cec5SDimitry Andric typename std::enable_if<std::is_floating_point<_A1>::value, bool>::type 3330b57cec5SDimitry Andric signbit(_A1 __lcpp_x) _NOEXCEPT 3340b57cec5SDimitry Andric { 3350b57cec5SDimitry Andric return __libcpp_signbit((typename std::__promote<_A1>::type)__lcpp_x); 3360b57cec5SDimitry Andric } 3370b57cec5SDimitry Andric 3380b57cec5SDimitry Andric template <class _A1> 3390b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY 3400b57cec5SDimitry Andric typename std::enable_if< 3410b57cec5SDimitry Andric std::is_integral<_A1>::value && std::is_signed<_A1>::value, bool>::type 3420b57cec5SDimitry Andric signbit(_A1 __lcpp_x) _NOEXCEPT 3430b57cec5SDimitry Andric { return __lcpp_x < 0; } 3440b57cec5SDimitry Andric 3450b57cec5SDimitry Andric template <class _A1> 3460b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY 3470b57cec5SDimitry Andric typename std::enable_if< 3480b57cec5SDimitry Andric std::is_integral<_A1>::value && !std::is_signed<_A1>::value, bool>::type 3490b57cec5SDimitry Andric signbit(_A1) _NOEXCEPT 3500b57cec5SDimitry Andric { return false; } 3510b57cec5SDimitry Andric 3520b57cec5SDimitry Andric #elif defined(_LIBCPP_MSVCRT) 3530b57cec5SDimitry Andric 3540b57cec5SDimitry Andric template <typename _A1> 3550b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY 3560b57cec5SDimitry Andric typename std::enable_if<std::is_floating_point<_A1>::value, bool>::type 3570b57cec5SDimitry Andric signbit(_A1 __lcpp_x) _NOEXCEPT 3580b57cec5SDimitry Andric { 3590b57cec5SDimitry Andric return ::signbit(static_cast<typename std::__promote<_A1>::type>(__lcpp_x)); 3600b57cec5SDimitry Andric } 3610b57cec5SDimitry Andric 3620b57cec5SDimitry Andric template <class _A1> 3630b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY 3640b57cec5SDimitry Andric typename std::enable_if< 3650b57cec5SDimitry Andric std::is_integral<_A1>::value && std::is_signed<_A1>::value, bool>::type 3660b57cec5SDimitry Andric signbit(_A1 __lcpp_x) _NOEXCEPT 3670b57cec5SDimitry Andric { return __lcpp_x < 0; } 3680b57cec5SDimitry Andric 3690b57cec5SDimitry Andric template <class _A1> 3700b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY 3710b57cec5SDimitry Andric typename std::enable_if< 3720b57cec5SDimitry Andric std::is_integral<_A1>::value && !std::is_signed<_A1>::value, bool>::type 3730b57cec5SDimitry Andric signbit(_A1) _NOEXCEPT 3740b57cec5SDimitry Andric { return false; } 3750b57cec5SDimitry Andric 3760b57cec5SDimitry Andric #endif // signbit 3770b57cec5SDimitry Andric 3780b57cec5SDimitry Andric // fpclassify 3790b57cec5SDimitry Andric 3800b57cec5SDimitry Andric #ifdef fpclassify 3810b57cec5SDimitry Andric 3820b57cec5SDimitry Andric template <class _A1> 3830b57cec5SDimitry Andric _LIBCPP_INLINE_VISIBILITY 3840b57cec5SDimitry Andric int 3850b57cec5SDimitry Andric __libcpp_fpclassify(_A1 __lcpp_x) _NOEXCEPT 3860b57cec5SDimitry Andric { 387fe6060f1SDimitry Andric #if __has_builtin(__builtin_fpclassify) 388fe6060f1SDimitry Andric return __builtin_fpclassify(FP_NAN, FP_INFINITE, FP_NORMAL, FP_SUBNORMAL, 389fe6060f1SDimitry Andric FP_ZERO, __lcpp_x); 390fe6060f1SDimitry Andric #else 3910b57cec5SDimitry Andric return fpclassify(__lcpp_x); 392fe6060f1SDimitry Andric #endif 3930b57cec5SDimitry Andric } 3940b57cec5SDimitry Andric 3950b57cec5SDimitry Andric #undef fpclassify 3960b57cec5SDimitry Andric 3970b57cec5SDimitry Andric template <class _A1> 3980b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY 3990b57cec5SDimitry Andric typename std::enable_if<std::is_floating_point<_A1>::value, int>::type 4000b57cec5SDimitry Andric fpclassify(_A1 __lcpp_x) _NOEXCEPT 4010b57cec5SDimitry Andric { 4020b57cec5SDimitry Andric return __libcpp_fpclassify((typename std::__promote<_A1>::type)__lcpp_x); 4030b57cec5SDimitry Andric } 4040b57cec5SDimitry Andric 4050b57cec5SDimitry Andric template <class _A1> 4060b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY 4070b57cec5SDimitry Andric typename std::enable_if<std::is_integral<_A1>::value, int>::type 4080b57cec5SDimitry Andric fpclassify(_A1 __lcpp_x) _NOEXCEPT 4090b57cec5SDimitry Andric { return __lcpp_x == 0 ? FP_ZERO : FP_NORMAL; } 4100b57cec5SDimitry Andric 4110b57cec5SDimitry Andric #elif defined(_LIBCPP_MSVCRT) 4120b57cec5SDimitry Andric 4130b57cec5SDimitry Andric template <typename _A1> 4140b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY 4150b57cec5SDimitry Andric typename std::enable_if<std::is_floating_point<_A1>::value, bool>::type 4160b57cec5SDimitry Andric fpclassify(_A1 __lcpp_x) _NOEXCEPT 4170b57cec5SDimitry Andric { 4180b57cec5SDimitry Andric return ::fpclassify(static_cast<typename std::__promote<_A1>::type>(__lcpp_x)); 4190b57cec5SDimitry Andric } 4200b57cec5SDimitry Andric 4210b57cec5SDimitry Andric template <class _A1> 4220b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY 4230b57cec5SDimitry Andric typename std::enable_if<std::is_integral<_A1>::value, int>::type 4240b57cec5SDimitry Andric fpclassify(_A1 __lcpp_x) _NOEXCEPT 4250b57cec5SDimitry Andric { return __lcpp_x == 0 ? FP_ZERO : FP_NORMAL; } 4260b57cec5SDimitry Andric 4270b57cec5SDimitry Andric #endif // fpclassify 4280b57cec5SDimitry Andric 4290b57cec5SDimitry Andric // isfinite 4300b57cec5SDimitry Andric 4310b57cec5SDimitry Andric #ifdef isfinite 4320b57cec5SDimitry Andric 4330b57cec5SDimitry Andric template <class _A1> 4340b57cec5SDimitry Andric _LIBCPP_INLINE_VISIBILITY 4350b57cec5SDimitry Andric bool 4360b57cec5SDimitry Andric __libcpp_isfinite(_A1 __lcpp_x) _NOEXCEPT 4370b57cec5SDimitry Andric { 438fe6060f1SDimitry Andric #if __has_builtin(__builtin_isfinite) 439fe6060f1SDimitry Andric return __builtin_isfinite(__lcpp_x); 440fe6060f1SDimitry Andric #else 4410b57cec5SDimitry Andric return isfinite(__lcpp_x); 442fe6060f1SDimitry Andric #endif 4430b57cec5SDimitry Andric } 4440b57cec5SDimitry Andric 4450b57cec5SDimitry Andric #undef isfinite 4460b57cec5SDimitry Andric 4470b57cec5SDimitry Andric template <class _A1> 4480b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY 4490b57cec5SDimitry Andric typename std::enable_if< 4500b57cec5SDimitry Andric std::is_arithmetic<_A1>::value && std::numeric_limits<_A1>::has_infinity, 4510b57cec5SDimitry Andric bool>::type 4520b57cec5SDimitry Andric isfinite(_A1 __lcpp_x) _NOEXCEPT 4530b57cec5SDimitry Andric { 4540b57cec5SDimitry Andric return __libcpp_isfinite((typename std::__promote<_A1>::type)__lcpp_x); 4550b57cec5SDimitry Andric } 4560b57cec5SDimitry Andric 4570b57cec5SDimitry Andric template <class _A1> 4580b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY 4590b57cec5SDimitry Andric typename std::enable_if< 4600b57cec5SDimitry Andric std::is_arithmetic<_A1>::value && !std::numeric_limits<_A1>::has_infinity, 4610b57cec5SDimitry Andric bool>::type 4620b57cec5SDimitry Andric isfinite(_A1) _NOEXCEPT 4630b57cec5SDimitry Andric { return true; } 4640b57cec5SDimitry Andric 4650b57cec5SDimitry Andric #endif // isfinite 4660b57cec5SDimitry Andric 4670b57cec5SDimitry Andric // isinf 4680b57cec5SDimitry Andric 4690b57cec5SDimitry Andric #ifdef isinf 4700b57cec5SDimitry Andric 4710b57cec5SDimitry Andric template <class _A1> 4720b57cec5SDimitry Andric _LIBCPP_INLINE_VISIBILITY 4730b57cec5SDimitry Andric bool 4740b57cec5SDimitry Andric __libcpp_isinf(_A1 __lcpp_x) _NOEXCEPT 4750b57cec5SDimitry Andric { 476fe6060f1SDimitry Andric #if __has_builtin(__builtin_isinf) 477fe6060f1SDimitry Andric return __builtin_isinf(__lcpp_x); 478fe6060f1SDimitry Andric #else 4790b57cec5SDimitry Andric return isinf(__lcpp_x); 480fe6060f1SDimitry Andric #endif 4810b57cec5SDimitry Andric } 4820b57cec5SDimitry Andric 4830b57cec5SDimitry Andric #undef isinf 4840b57cec5SDimitry Andric 4850b57cec5SDimitry Andric template <class _A1> 4860b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY 4870b57cec5SDimitry Andric typename std::enable_if< 4880b57cec5SDimitry Andric std::is_arithmetic<_A1>::value && std::numeric_limits<_A1>::has_infinity, 4890b57cec5SDimitry Andric bool>::type 4900b57cec5SDimitry Andric isinf(_A1 __lcpp_x) _NOEXCEPT 4910b57cec5SDimitry Andric { 4920b57cec5SDimitry Andric return __libcpp_isinf((typename std::__promote<_A1>::type)__lcpp_x); 4930b57cec5SDimitry Andric } 4940b57cec5SDimitry Andric 4950b57cec5SDimitry Andric template <class _A1> 4960b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY 4970b57cec5SDimitry Andric typename std::enable_if< 4980b57cec5SDimitry Andric std::is_arithmetic<_A1>::value && !std::numeric_limits<_A1>::has_infinity, 4990b57cec5SDimitry Andric bool>::type 5000b57cec5SDimitry Andric isinf(_A1) _NOEXCEPT 5010b57cec5SDimitry Andric { return false; } 5020b57cec5SDimitry Andric 5030b57cec5SDimitry Andric #ifdef _LIBCPP_PREFERRED_OVERLOAD 5040b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY 5050b57cec5SDimitry Andric bool 5060b57cec5SDimitry Andric isinf(float __lcpp_x) _NOEXCEPT { return __libcpp_isinf(__lcpp_x); } 5070b57cec5SDimitry Andric 5080b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_PREFERRED_OVERLOAD 5090b57cec5SDimitry Andric bool 5100b57cec5SDimitry Andric isinf(double __lcpp_x) _NOEXCEPT { return __libcpp_isinf(__lcpp_x); } 5110b57cec5SDimitry Andric 5120b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY 5130b57cec5SDimitry Andric bool 5140b57cec5SDimitry Andric isinf(long double __lcpp_x) _NOEXCEPT { return __libcpp_isinf(__lcpp_x); } 5150b57cec5SDimitry Andric #endif 5160b57cec5SDimitry Andric 5170b57cec5SDimitry Andric #endif // isinf 5180b57cec5SDimitry Andric 5190b57cec5SDimitry Andric // isnan 5200b57cec5SDimitry Andric 5210b57cec5SDimitry Andric #ifdef isnan 5220b57cec5SDimitry Andric 5230b57cec5SDimitry Andric template <class _A1> 5240b57cec5SDimitry Andric _LIBCPP_INLINE_VISIBILITY 5250b57cec5SDimitry Andric bool 5260b57cec5SDimitry Andric __libcpp_isnan(_A1 __lcpp_x) _NOEXCEPT 5270b57cec5SDimitry Andric { 528480093f4SDimitry Andric #if __has_builtin(__builtin_isnan) 529480093f4SDimitry Andric return __builtin_isnan(__lcpp_x); 530480093f4SDimitry Andric #else 5310b57cec5SDimitry Andric return isnan(__lcpp_x); 532480093f4SDimitry Andric #endif 5330b57cec5SDimitry Andric } 5340b57cec5SDimitry Andric 5350b57cec5SDimitry Andric #undef isnan 5360b57cec5SDimitry Andric 5370b57cec5SDimitry Andric template <class _A1> 5380b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY 5390b57cec5SDimitry Andric typename std::enable_if<std::is_floating_point<_A1>::value, bool>::type 5400b57cec5SDimitry Andric isnan(_A1 __lcpp_x) _NOEXCEPT 5410b57cec5SDimitry Andric { 5420b57cec5SDimitry Andric return __libcpp_isnan((typename std::__promote<_A1>::type)__lcpp_x); 5430b57cec5SDimitry Andric } 5440b57cec5SDimitry Andric 5450b57cec5SDimitry Andric template <class _A1> 5460b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY 5470b57cec5SDimitry Andric typename std::enable_if<std::is_integral<_A1>::value, bool>::type 5480b57cec5SDimitry Andric isnan(_A1) _NOEXCEPT 5490b57cec5SDimitry Andric { return false; } 5500b57cec5SDimitry Andric 5510b57cec5SDimitry Andric #ifdef _LIBCPP_PREFERRED_OVERLOAD 5520b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY 5530b57cec5SDimitry Andric bool 5540b57cec5SDimitry Andric isnan(float __lcpp_x) _NOEXCEPT { return __libcpp_isnan(__lcpp_x); } 5550b57cec5SDimitry Andric 5560b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_PREFERRED_OVERLOAD 5570b57cec5SDimitry Andric bool 5580b57cec5SDimitry Andric isnan(double __lcpp_x) _NOEXCEPT { return __libcpp_isnan(__lcpp_x); } 5590b57cec5SDimitry Andric 5600b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY 5610b57cec5SDimitry Andric bool 5620b57cec5SDimitry Andric isnan(long double __lcpp_x) _NOEXCEPT { return __libcpp_isnan(__lcpp_x); } 5630b57cec5SDimitry Andric #endif 5640b57cec5SDimitry Andric 5650b57cec5SDimitry Andric #endif // isnan 5660b57cec5SDimitry Andric 5670b57cec5SDimitry Andric // isnormal 5680b57cec5SDimitry Andric 5690b57cec5SDimitry Andric #ifdef isnormal 5700b57cec5SDimitry Andric 5710b57cec5SDimitry Andric template <class _A1> 5720b57cec5SDimitry Andric _LIBCPP_INLINE_VISIBILITY 5730b57cec5SDimitry Andric bool 5740b57cec5SDimitry Andric __libcpp_isnormal(_A1 __lcpp_x) _NOEXCEPT 5750b57cec5SDimitry Andric { 576fe6060f1SDimitry Andric #if __has_builtin(__builtin_isnormal) 577fe6060f1SDimitry Andric return __builtin_isnormal(__lcpp_x); 578fe6060f1SDimitry Andric #else 5790b57cec5SDimitry Andric return isnormal(__lcpp_x); 580fe6060f1SDimitry Andric #endif 5810b57cec5SDimitry Andric } 5820b57cec5SDimitry Andric 5830b57cec5SDimitry Andric #undef isnormal 5840b57cec5SDimitry Andric 5850b57cec5SDimitry Andric template <class _A1> 5860b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY 5870b57cec5SDimitry Andric typename std::enable_if<std::is_floating_point<_A1>::value, bool>::type 5880b57cec5SDimitry Andric isnormal(_A1 __lcpp_x) _NOEXCEPT 5890b57cec5SDimitry Andric { 5900b57cec5SDimitry Andric return __libcpp_isnormal((typename std::__promote<_A1>::type)__lcpp_x); 5910b57cec5SDimitry Andric } 5920b57cec5SDimitry Andric 5930b57cec5SDimitry Andric template <class _A1> 5940b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY 5950b57cec5SDimitry Andric typename std::enable_if<std::is_integral<_A1>::value, bool>::type 5960b57cec5SDimitry Andric isnormal(_A1 __lcpp_x) _NOEXCEPT 5970b57cec5SDimitry Andric { return __lcpp_x != 0; } 5980b57cec5SDimitry Andric 5990b57cec5SDimitry Andric #endif // isnormal 6000b57cec5SDimitry Andric 6010b57cec5SDimitry Andric // isgreater 6020b57cec5SDimitry Andric 6030b57cec5SDimitry Andric #ifdef isgreater 6040b57cec5SDimitry Andric 6050b57cec5SDimitry Andric template <class _A1, class _A2> 6060b57cec5SDimitry Andric _LIBCPP_INLINE_VISIBILITY 6070b57cec5SDimitry Andric bool 6080b57cec5SDimitry Andric __libcpp_isgreater(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT 6090b57cec5SDimitry Andric { 6100b57cec5SDimitry Andric return isgreater(__lcpp_x, __lcpp_y); 6110b57cec5SDimitry Andric } 6120b57cec5SDimitry Andric 6130b57cec5SDimitry Andric #undef isgreater 6140b57cec5SDimitry Andric 6150b57cec5SDimitry Andric template <class _A1, class _A2> 6160b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY 6170b57cec5SDimitry Andric typename std::enable_if 6180b57cec5SDimitry Andric < 6190b57cec5SDimitry Andric std::is_arithmetic<_A1>::value && 6200b57cec5SDimitry Andric std::is_arithmetic<_A2>::value, 6210b57cec5SDimitry Andric bool 6220b57cec5SDimitry Andric >::type 6230b57cec5SDimitry Andric isgreater(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT 6240b57cec5SDimitry Andric { 6250b57cec5SDimitry Andric typedef typename std::__promote<_A1, _A2>::type type; 6260b57cec5SDimitry Andric return __libcpp_isgreater((type)__lcpp_x, (type)__lcpp_y); 6270b57cec5SDimitry Andric } 6280b57cec5SDimitry Andric 6290b57cec5SDimitry Andric #endif // isgreater 6300b57cec5SDimitry Andric 6310b57cec5SDimitry Andric // isgreaterequal 6320b57cec5SDimitry Andric 6330b57cec5SDimitry Andric #ifdef isgreaterequal 6340b57cec5SDimitry Andric 6350b57cec5SDimitry Andric template <class _A1, class _A2> 6360b57cec5SDimitry Andric _LIBCPP_INLINE_VISIBILITY 6370b57cec5SDimitry Andric bool 6380b57cec5SDimitry Andric __libcpp_isgreaterequal(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT 6390b57cec5SDimitry Andric { 6400b57cec5SDimitry Andric return isgreaterequal(__lcpp_x, __lcpp_y); 6410b57cec5SDimitry Andric } 6420b57cec5SDimitry Andric 6430b57cec5SDimitry Andric #undef isgreaterequal 6440b57cec5SDimitry Andric 6450b57cec5SDimitry Andric template <class _A1, class _A2> 6460b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY 6470b57cec5SDimitry Andric typename std::enable_if 6480b57cec5SDimitry Andric < 6490b57cec5SDimitry Andric std::is_arithmetic<_A1>::value && 6500b57cec5SDimitry Andric std::is_arithmetic<_A2>::value, 6510b57cec5SDimitry Andric bool 6520b57cec5SDimitry Andric >::type 6530b57cec5SDimitry Andric isgreaterequal(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT 6540b57cec5SDimitry Andric { 6550b57cec5SDimitry Andric typedef typename std::__promote<_A1, _A2>::type type; 6560b57cec5SDimitry Andric return __libcpp_isgreaterequal((type)__lcpp_x, (type)__lcpp_y); 6570b57cec5SDimitry Andric } 6580b57cec5SDimitry Andric 6590b57cec5SDimitry Andric #endif // isgreaterequal 6600b57cec5SDimitry Andric 6610b57cec5SDimitry Andric // isless 6620b57cec5SDimitry Andric 6630b57cec5SDimitry Andric #ifdef isless 6640b57cec5SDimitry Andric 6650b57cec5SDimitry Andric template <class _A1, class _A2> 6660b57cec5SDimitry Andric _LIBCPP_INLINE_VISIBILITY 6670b57cec5SDimitry Andric bool 6680b57cec5SDimitry Andric __libcpp_isless(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT 6690b57cec5SDimitry Andric { 6700b57cec5SDimitry Andric return isless(__lcpp_x, __lcpp_y); 6710b57cec5SDimitry Andric } 6720b57cec5SDimitry Andric 6730b57cec5SDimitry Andric #undef isless 6740b57cec5SDimitry Andric 6750b57cec5SDimitry Andric template <class _A1, class _A2> 6760b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY 6770b57cec5SDimitry Andric typename std::enable_if 6780b57cec5SDimitry Andric < 6790b57cec5SDimitry Andric std::is_arithmetic<_A1>::value && 6800b57cec5SDimitry Andric std::is_arithmetic<_A2>::value, 6810b57cec5SDimitry Andric bool 6820b57cec5SDimitry Andric >::type 6830b57cec5SDimitry Andric isless(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT 6840b57cec5SDimitry Andric { 6850b57cec5SDimitry Andric typedef typename std::__promote<_A1, _A2>::type type; 6860b57cec5SDimitry Andric return __libcpp_isless((type)__lcpp_x, (type)__lcpp_y); 6870b57cec5SDimitry Andric } 6880b57cec5SDimitry Andric 6890b57cec5SDimitry Andric #endif // isless 6900b57cec5SDimitry Andric 6910b57cec5SDimitry Andric // islessequal 6920b57cec5SDimitry Andric 6930b57cec5SDimitry Andric #ifdef islessequal 6940b57cec5SDimitry Andric 6950b57cec5SDimitry Andric template <class _A1, class _A2> 6960b57cec5SDimitry Andric _LIBCPP_INLINE_VISIBILITY 6970b57cec5SDimitry Andric bool 6980b57cec5SDimitry Andric __libcpp_islessequal(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT 6990b57cec5SDimitry Andric { 7000b57cec5SDimitry Andric return islessequal(__lcpp_x, __lcpp_y); 7010b57cec5SDimitry Andric } 7020b57cec5SDimitry Andric 7030b57cec5SDimitry Andric #undef islessequal 7040b57cec5SDimitry Andric 7050b57cec5SDimitry Andric template <class _A1, class _A2> 7060b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY 7070b57cec5SDimitry Andric typename std::enable_if 7080b57cec5SDimitry Andric < 7090b57cec5SDimitry Andric std::is_arithmetic<_A1>::value && 7100b57cec5SDimitry Andric std::is_arithmetic<_A2>::value, 7110b57cec5SDimitry Andric bool 7120b57cec5SDimitry Andric >::type 7130b57cec5SDimitry Andric islessequal(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT 7140b57cec5SDimitry Andric { 7150b57cec5SDimitry Andric typedef typename std::__promote<_A1, _A2>::type type; 7160b57cec5SDimitry Andric return __libcpp_islessequal((type)__lcpp_x, (type)__lcpp_y); 7170b57cec5SDimitry Andric } 7180b57cec5SDimitry Andric 7190b57cec5SDimitry Andric #endif // islessequal 7200b57cec5SDimitry Andric 7210b57cec5SDimitry Andric // islessgreater 7220b57cec5SDimitry Andric 7230b57cec5SDimitry Andric #ifdef islessgreater 7240b57cec5SDimitry Andric 7250b57cec5SDimitry Andric template <class _A1, class _A2> 7260b57cec5SDimitry Andric _LIBCPP_INLINE_VISIBILITY 7270b57cec5SDimitry Andric bool 7280b57cec5SDimitry Andric __libcpp_islessgreater(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT 7290b57cec5SDimitry Andric { 7300b57cec5SDimitry Andric return islessgreater(__lcpp_x, __lcpp_y); 7310b57cec5SDimitry Andric } 7320b57cec5SDimitry Andric 7330b57cec5SDimitry Andric #undef islessgreater 7340b57cec5SDimitry Andric 7350b57cec5SDimitry Andric template <class _A1, class _A2> 7360b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY 7370b57cec5SDimitry Andric typename std::enable_if 7380b57cec5SDimitry Andric < 7390b57cec5SDimitry Andric std::is_arithmetic<_A1>::value && 7400b57cec5SDimitry Andric std::is_arithmetic<_A2>::value, 7410b57cec5SDimitry Andric bool 7420b57cec5SDimitry Andric >::type 7430b57cec5SDimitry Andric islessgreater(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT 7440b57cec5SDimitry Andric { 7450b57cec5SDimitry Andric typedef typename std::__promote<_A1, _A2>::type type; 7460b57cec5SDimitry Andric return __libcpp_islessgreater((type)__lcpp_x, (type)__lcpp_y); 7470b57cec5SDimitry Andric } 7480b57cec5SDimitry Andric 7490b57cec5SDimitry Andric #endif // islessgreater 7500b57cec5SDimitry Andric 7510b57cec5SDimitry Andric // isunordered 7520b57cec5SDimitry Andric 7530b57cec5SDimitry Andric #ifdef isunordered 7540b57cec5SDimitry Andric 7550b57cec5SDimitry Andric template <class _A1, class _A2> 7560b57cec5SDimitry Andric _LIBCPP_INLINE_VISIBILITY 7570b57cec5SDimitry Andric bool 7580b57cec5SDimitry Andric __libcpp_isunordered(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT 7590b57cec5SDimitry Andric { 7600b57cec5SDimitry Andric return isunordered(__lcpp_x, __lcpp_y); 7610b57cec5SDimitry Andric } 7620b57cec5SDimitry Andric 7630b57cec5SDimitry Andric #undef isunordered 7640b57cec5SDimitry Andric 7650b57cec5SDimitry Andric template <class _A1, class _A2> 7660b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY 7670b57cec5SDimitry Andric typename std::enable_if 7680b57cec5SDimitry Andric < 7690b57cec5SDimitry Andric std::is_arithmetic<_A1>::value && 7700b57cec5SDimitry Andric std::is_arithmetic<_A2>::value, 7710b57cec5SDimitry Andric bool 7720b57cec5SDimitry Andric >::type 7730b57cec5SDimitry Andric isunordered(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT 7740b57cec5SDimitry Andric { 7750b57cec5SDimitry Andric typedef typename std::__promote<_A1, _A2>::type type; 7760b57cec5SDimitry Andric return __libcpp_isunordered((type)__lcpp_x, (type)__lcpp_y); 7770b57cec5SDimitry Andric } 7780b57cec5SDimitry Andric 7790b57cec5SDimitry Andric #endif // isunordered 7800b57cec5SDimitry Andric 7810b57cec5SDimitry Andric // abs 7825ffd83dbSDimitry Andric // 7835ffd83dbSDimitry Andric // handled in stdlib.h 7840b57cec5SDimitry Andric 7850b57cec5SDimitry Andric // div 7865ffd83dbSDimitry Andric // 7875ffd83dbSDimitry Andric // handled in stdlib.h 7880b57cec5SDimitry Andric 7890b57cec5SDimitry Andric // acos 7900b57cec5SDimitry Andric 7910b57cec5SDimitry Andric #if !(defined(_AIX) || defined(__sun__)) 7920b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY float acos(float __lcpp_x) _NOEXCEPT {return ::acosf(__lcpp_x);} 7930b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY long double acos(long double __lcpp_x) _NOEXCEPT {return ::acosl(__lcpp_x);} 7940b57cec5SDimitry Andric #endif 7950b57cec5SDimitry Andric 7960b57cec5SDimitry Andric template <class _A1> 7970b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY 7980b57cec5SDimitry Andric typename std::enable_if<std::is_integral<_A1>::value, double>::type 7990b57cec5SDimitry Andric acos(_A1 __lcpp_x) _NOEXCEPT {return ::acos((double)__lcpp_x);} 8000b57cec5SDimitry Andric 8010b57cec5SDimitry Andric // asin 8020b57cec5SDimitry Andric 8030b57cec5SDimitry Andric #if !(defined(_AIX) || defined(__sun__)) 8040b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY float asin(float __lcpp_x) _NOEXCEPT {return ::asinf(__lcpp_x);} 8050b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY long double asin(long double __lcpp_x) _NOEXCEPT {return ::asinl(__lcpp_x);} 8060b57cec5SDimitry Andric #endif 8070b57cec5SDimitry Andric 8080b57cec5SDimitry Andric template <class _A1> 8090b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY 8100b57cec5SDimitry Andric typename std::enable_if<std::is_integral<_A1>::value, double>::type 8110b57cec5SDimitry Andric asin(_A1 __lcpp_x) _NOEXCEPT {return ::asin((double)__lcpp_x);} 8120b57cec5SDimitry Andric 8130b57cec5SDimitry Andric // atan 8140b57cec5SDimitry Andric 8150b57cec5SDimitry Andric #if !(defined(_AIX) || defined(__sun__)) 8160b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY float atan(float __lcpp_x) _NOEXCEPT {return ::atanf(__lcpp_x);} 8170b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY long double atan(long double __lcpp_x) _NOEXCEPT {return ::atanl(__lcpp_x);} 8180b57cec5SDimitry Andric #endif 8190b57cec5SDimitry Andric 8200b57cec5SDimitry Andric template <class _A1> 8210b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY 8220b57cec5SDimitry Andric typename std::enable_if<std::is_integral<_A1>::value, double>::type 8230b57cec5SDimitry Andric atan(_A1 __lcpp_x) _NOEXCEPT {return ::atan((double)__lcpp_x);} 8240b57cec5SDimitry Andric 8250b57cec5SDimitry Andric // atan2 8260b57cec5SDimitry Andric 8270b57cec5SDimitry Andric #if !(defined(_AIX) || defined(__sun__)) 8280b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY float atan2(float __lcpp_y, float __lcpp_x) _NOEXCEPT {return ::atan2f(__lcpp_y, __lcpp_x);} 8290b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY long double atan2(long double __lcpp_y, long double __lcpp_x) _NOEXCEPT {return ::atan2l(__lcpp_y, __lcpp_x);} 8300b57cec5SDimitry Andric #endif 8310b57cec5SDimitry Andric 8320b57cec5SDimitry Andric template <class _A1, class _A2> 8330b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY 834*349cc55cSDimitry Andric typename std::__enable_if_t 8350b57cec5SDimitry Andric < 8360b57cec5SDimitry Andric std::is_arithmetic<_A1>::value && 8370b57cec5SDimitry Andric std::is_arithmetic<_A2>::value, 8380b57cec5SDimitry Andric std::__promote<_A1, _A2> 8390b57cec5SDimitry Andric >::type 8400b57cec5SDimitry Andric atan2(_A1 __lcpp_y, _A2 __lcpp_x) _NOEXCEPT 8410b57cec5SDimitry Andric { 8420b57cec5SDimitry Andric typedef typename std::__promote<_A1, _A2>::type __result_type; 8430b57cec5SDimitry Andric static_assert((!(std::_IsSame<_A1, __result_type>::value && 8440b57cec5SDimitry Andric std::_IsSame<_A2, __result_type>::value)), ""); 8450b57cec5SDimitry Andric return ::atan2((__result_type)__lcpp_y, (__result_type)__lcpp_x); 8460b57cec5SDimitry Andric } 8470b57cec5SDimitry Andric 8480b57cec5SDimitry Andric // ceil 8490b57cec5SDimitry Andric 8500b57cec5SDimitry Andric #if !(defined(_AIX) || defined(__sun__)) 8510b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY float ceil(float __lcpp_x) _NOEXCEPT {return ::ceilf(__lcpp_x);} 8520b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY long double ceil(long double __lcpp_x) _NOEXCEPT {return ::ceill(__lcpp_x);} 8530b57cec5SDimitry Andric #endif 8540b57cec5SDimitry Andric 8550b57cec5SDimitry Andric template <class _A1> 8560b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY 8570b57cec5SDimitry Andric typename std::enable_if<std::is_integral<_A1>::value, double>::type 8580b57cec5SDimitry Andric ceil(_A1 __lcpp_x) _NOEXCEPT {return ::ceil((double)__lcpp_x);} 8590b57cec5SDimitry Andric 8600b57cec5SDimitry Andric // cos 8610b57cec5SDimitry Andric 8620b57cec5SDimitry Andric #if !(defined(_AIX) || defined(__sun__)) 8630b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY float cos(float __lcpp_x) _NOEXCEPT {return ::cosf(__lcpp_x);} 8640b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY long double cos(long double __lcpp_x) _NOEXCEPT {return ::cosl(__lcpp_x);} 8650b57cec5SDimitry Andric #endif 8660b57cec5SDimitry Andric 8670b57cec5SDimitry Andric template <class _A1> 8680b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY 8690b57cec5SDimitry Andric typename std::enable_if<std::is_integral<_A1>::value, double>::type 8700b57cec5SDimitry Andric cos(_A1 __lcpp_x) _NOEXCEPT {return ::cos((double)__lcpp_x);} 8710b57cec5SDimitry Andric 8720b57cec5SDimitry Andric // cosh 8730b57cec5SDimitry Andric 8740b57cec5SDimitry Andric #if !(defined(_AIX) || defined(__sun__)) 8750b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY float cosh(float __lcpp_x) _NOEXCEPT {return ::coshf(__lcpp_x);} 8760b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY long double cosh(long double __lcpp_x) _NOEXCEPT {return ::coshl(__lcpp_x);} 8770b57cec5SDimitry Andric #endif 8780b57cec5SDimitry Andric 8790b57cec5SDimitry Andric template <class _A1> 8800b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY 8810b57cec5SDimitry Andric typename std::enable_if<std::is_integral<_A1>::value, double>::type 8820b57cec5SDimitry Andric cosh(_A1 __lcpp_x) _NOEXCEPT {return ::cosh((double)__lcpp_x);} 8830b57cec5SDimitry Andric 8840b57cec5SDimitry Andric // exp 8850b57cec5SDimitry Andric 8860b57cec5SDimitry Andric #if !(defined(_AIX) || defined(__sun__)) 8870b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY float exp(float __lcpp_x) _NOEXCEPT {return ::expf(__lcpp_x);} 8880b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY long double exp(long double __lcpp_x) _NOEXCEPT {return ::expl(__lcpp_x);} 8890b57cec5SDimitry Andric #endif 8900b57cec5SDimitry Andric 8910b57cec5SDimitry Andric template <class _A1> 8920b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY 8930b57cec5SDimitry Andric typename std::enable_if<std::is_integral<_A1>::value, double>::type 8940b57cec5SDimitry Andric exp(_A1 __lcpp_x) _NOEXCEPT {return ::exp((double)__lcpp_x);} 8950b57cec5SDimitry Andric 8960b57cec5SDimitry Andric // fabs 8970b57cec5SDimitry Andric 8980b57cec5SDimitry Andric #if !(defined(_AIX) || defined(__sun__)) 8990b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY float fabs(float __lcpp_x) _NOEXCEPT {return ::fabsf(__lcpp_x);} 9000b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY long double fabs(long double __lcpp_x) _NOEXCEPT {return ::fabsl(__lcpp_x);} 9010b57cec5SDimitry Andric #endif 9020b57cec5SDimitry Andric 9030b57cec5SDimitry Andric template <class _A1> 9040b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY 9050b57cec5SDimitry Andric typename std::enable_if<std::is_integral<_A1>::value, double>::type 9060b57cec5SDimitry Andric fabs(_A1 __lcpp_x) _NOEXCEPT {return ::fabs((double)__lcpp_x);} 9070b57cec5SDimitry Andric 9080b57cec5SDimitry Andric // floor 9090b57cec5SDimitry Andric 9100b57cec5SDimitry Andric #if !(defined(_AIX) || defined(__sun__)) 9110b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY float floor(float __lcpp_x) _NOEXCEPT {return ::floorf(__lcpp_x);} 9120b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY long double floor(long double __lcpp_x) _NOEXCEPT {return ::floorl(__lcpp_x);} 9130b57cec5SDimitry Andric #endif 9140b57cec5SDimitry Andric 9150b57cec5SDimitry Andric template <class _A1> 9160b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY 9170b57cec5SDimitry Andric typename std::enable_if<std::is_integral<_A1>::value, double>::type 9180b57cec5SDimitry Andric floor(_A1 __lcpp_x) _NOEXCEPT {return ::floor((double)__lcpp_x);} 9190b57cec5SDimitry Andric 9200b57cec5SDimitry Andric // fmod 9210b57cec5SDimitry Andric 9220b57cec5SDimitry Andric #if !(defined(_AIX) || defined(__sun__)) 9230b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY float fmod(float __lcpp_x, float __lcpp_y) _NOEXCEPT {return ::fmodf(__lcpp_x, __lcpp_y);} 9240b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY long double fmod(long double __lcpp_x, long double __lcpp_y) _NOEXCEPT {return ::fmodl(__lcpp_x, __lcpp_y);} 9250b57cec5SDimitry Andric #endif 9260b57cec5SDimitry Andric 9270b57cec5SDimitry Andric template <class _A1, class _A2> 9280b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY 929*349cc55cSDimitry Andric typename std::__enable_if_t 9300b57cec5SDimitry Andric < 9310b57cec5SDimitry Andric std::is_arithmetic<_A1>::value && 9320b57cec5SDimitry Andric std::is_arithmetic<_A2>::value, 9330b57cec5SDimitry Andric std::__promote<_A1, _A2> 9340b57cec5SDimitry Andric >::type 9350b57cec5SDimitry Andric fmod(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT 9360b57cec5SDimitry Andric { 9370b57cec5SDimitry Andric typedef typename std::__promote<_A1, _A2>::type __result_type; 9380b57cec5SDimitry Andric static_assert((!(std::_IsSame<_A1, __result_type>::value && 9390b57cec5SDimitry Andric std::_IsSame<_A2, __result_type>::value)), ""); 9400b57cec5SDimitry Andric return ::fmod((__result_type)__lcpp_x, (__result_type)__lcpp_y); 9410b57cec5SDimitry Andric } 9420b57cec5SDimitry Andric 9430b57cec5SDimitry Andric // frexp 9440b57cec5SDimitry Andric 9450b57cec5SDimitry Andric #if !(defined(_AIX) || defined(__sun__)) 9460b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY float frexp(float __lcpp_x, int* __lcpp_e) _NOEXCEPT {return ::frexpf(__lcpp_x, __lcpp_e);} 9470b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY long double frexp(long double __lcpp_x, int* __lcpp_e) _NOEXCEPT {return ::frexpl(__lcpp_x, __lcpp_e);} 9480b57cec5SDimitry Andric #endif 9490b57cec5SDimitry Andric 9500b57cec5SDimitry Andric template <class _A1> 9510b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY 9520b57cec5SDimitry Andric typename std::enable_if<std::is_integral<_A1>::value, double>::type 9530b57cec5SDimitry Andric frexp(_A1 __lcpp_x, int* __lcpp_e) _NOEXCEPT {return ::frexp((double)__lcpp_x, __lcpp_e);} 9540b57cec5SDimitry Andric 9550b57cec5SDimitry Andric // ldexp 9560b57cec5SDimitry Andric 9570b57cec5SDimitry Andric #if !(defined(_AIX) || defined(__sun__)) 9580b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY float ldexp(float __lcpp_x, int __lcpp_e) _NOEXCEPT {return ::ldexpf(__lcpp_x, __lcpp_e);} 9590b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY long double ldexp(long double __lcpp_x, int __lcpp_e) _NOEXCEPT {return ::ldexpl(__lcpp_x, __lcpp_e);} 9600b57cec5SDimitry Andric #endif 9610b57cec5SDimitry Andric 9620b57cec5SDimitry Andric template <class _A1> 9630b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY 9640b57cec5SDimitry Andric typename std::enable_if<std::is_integral<_A1>::value, double>::type 9650b57cec5SDimitry Andric ldexp(_A1 __lcpp_x, int __lcpp_e) _NOEXCEPT {return ::ldexp((double)__lcpp_x, __lcpp_e);} 9660b57cec5SDimitry Andric 9670b57cec5SDimitry Andric // log 9680b57cec5SDimitry Andric 9690b57cec5SDimitry Andric #if !(defined(_AIX) || defined(__sun__)) 9700b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY float log(float __lcpp_x) _NOEXCEPT {return ::logf(__lcpp_x);} 9710b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY long double log(long double __lcpp_x) _NOEXCEPT {return ::logl(__lcpp_x);} 9720b57cec5SDimitry Andric #endif 9730b57cec5SDimitry Andric 9740b57cec5SDimitry Andric template <class _A1> 9750b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY 9760b57cec5SDimitry Andric typename std::enable_if<std::is_integral<_A1>::value, double>::type 9770b57cec5SDimitry Andric log(_A1 __lcpp_x) _NOEXCEPT {return ::log((double)__lcpp_x);} 9780b57cec5SDimitry Andric 9790b57cec5SDimitry Andric // log10 9800b57cec5SDimitry Andric 9810b57cec5SDimitry Andric #if !(defined(_AIX) || defined(__sun__)) 9820b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY float log10(float __lcpp_x) _NOEXCEPT {return ::log10f(__lcpp_x);} 9830b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY long double log10(long double __lcpp_x) _NOEXCEPT {return ::log10l(__lcpp_x);} 9840b57cec5SDimitry Andric #endif 9850b57cec5SDimitry Andric 9860b57cec5SDimitry Andric template <class _A1> 9870b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY 9880b57cec5SDimitry Andric typename std::enable_if<std::is_integral<_A1>::value, double>::type 9890b57cec5SDimitry Andric log10(_A1 __lcpp_x) _NOEXCEPT {return ::log10((double)__lcpp_x);} 9900b57cec5SDimitry Andric 9910b57cec5SDimitry Andric // modf 9920b57cec5SDimitry Andric 9930b57cec5SDimitry Andric #if !(defined(_AIX) || defined(__sun__)) 9940b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY float modf(float __lcpp_x, float* __lcpp_y) _NOEXCEPT {return ::modff(__lcpp_x, __lcpp_y);} 9950b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY long double modf(long double __lcpp_x, long double* __lcpp_y) _NOEXCEPT {return ::modfl(__lcpp_x, __lcpp_y);} 9960b57cec5SDimitry Andric #endif 9970b57cec5SDimitry Andric 9980b57cec5SDimitry Andric // pow 9990b57cec5SDimitry Andric 10000b57cec5SDimitry Andric #if !(defined(_AIX) || defined(__sun__)) 10010b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY float pow(float __lcpp_x, float __lcpp_y) _NOEXCEPT {return ::powf(__lcpp_x, __lcpp_y);} 10020b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY long double pow(long double __lcpp_x, long double __lcpp_y) _NOEXCEPT {return ::powl(__lcpp_x, __lcpp_y);} 10030b57cec5SDimitry Andric #endif 10040b57cec5SDimitry Andric 10050b57cec5SDimitry Andric template <class _A1, class _A2> 10060b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY 1007*349cc55cSDimitry Andric typename std::__enable_if_t 10080b57cec5SDimitry Andric < 10090b57cec5SDimitry Andric std::is_arithmetic<_A1>::value && 10100b57cec5SDimitry Andric std::is_arithmetic<_A2>::value, 10110b57cec5SDimitry Andric std::__promote<_A1, _A2> 10120b57cec5SDimitry Andric >::type 10130b57cec5SDimitry Andric pow(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT 10140b57cec5SDimitry Andric { 10150b57cec5SDimitry Andric typedef typename std::__promote<_A1, _A2>::type __result_type; 10160b57cec5SDimitry Andric static_assert((!(std::_IsSame<_A1, __result_type>::value && 10170b57cec5SDimitry Andric std::_IsSame<_A2, __result_type>::value)), ""); 10180b57cec5SDimitry Andric return ::pow((__result_type)__lcpp_x, (__result_type)__lcpp_y); 10190b57cec5SDimitry Andric } 10200b57cec5SDimitry Andric 10210b57cec5SDimitry Andric // sin 10220b57cec5SDimitry Andric 10230b57cec5SDimitry Andric #if !(defined(_AIX) || defined(__sun__)) 10240b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY float sin(float __lcpp_x) _NOEXCEPT {return ::sinf(__lcpp_x);} 10250b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY long double sin(long double __lcpp_x) _NOEXCEPT {return ::sinl(__lcpp_x);} 10260b57cec5SDimitry Andric #endif 10270b57cec5SDimitry Andric 10280b57cec5SDimitry Andric template <class _A1> 10290b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY 10300b57cec5SDimitry Andric typename std::enable_if<std::is_integral<_A1>::value, double>::type 10310b57cec5SDimitry Andric sin(_A1 __lcpp_x) _NOEXCEPT {return ::sin((double)__lcpp_x);} 10320b57cec5SDimitry Andric 10330b57cec5SDimitry Andric // sinh 10340b57cec5SDimitry Andric 10350b57cec5SDimitry Andric #if !(defined(_AIX) || defined(__sun__)) 10360b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY float sinh(float __lcpp_x) _NOEXCEPT {return ::sinhf(__lcpp_x);} 10370b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY long double sinh(long double __lcpp_x) _NOEXCEPT {return ::sinhl(__lcpp_x);} 10380b57cec5SDimitry Andric #endif 10390b57cec5SDimitry Andric 10400b57cec5SDimitry Andric template <class _A1> 10410b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY 10420b57cec5SDimitry Andric typename std::enable_if<std::is_integral<_A1>::value, double>::type 10430b57cec5SDimitry Andric sinh(_A1 __lcpp_x) _NOEXCEPT {return ::sinh((double)__lcpp_x);} 10440b57cec5SDimitry Andric 10450b57cec5SDimitry Andric // sqrt 10460b57cec5SDimitry Andric 10470b57cec5SDimitry Andric #if !(defined(_AIX) || defined(__sun__)) 10480b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY float sqrt(float __lcpp_x) _NOEXCEPT {return ::sqrtf(__lcpp_x);} 10490b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY long double sqrt(long double __lcpp_x) _NOEXCEPT {return ::sqrtl(__lcpp_x);} 10500b57cec5SDimitry Andric #endif 10510b57cec5SDimitry Andric 10520b57cec5SDimitry Andric template <class _A1> 10530b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY 10540b57cec5SDimitry Andric typename std::enable_if<std::is_integral<_A1>::value, double>::type 10550b57cec5SDimitry Andric sqrt(_A1 __lcpp_x) _NOEXCEPT {return ::sqrt((double)__lcpp_x);} 10560b57cec5SDimitry Andric 10570b57cec5SDimitry Andric // tan 10580b57cec5SDimitry Andric 10590b57cec5SDimitry Andric #if !(defined(_AIX) || defined(__sun__)) 10600b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY float tan(float __lcpp_x) _NOEXCEPT {return ::tanf(__lcpp_x);} 10610b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY long double tan(long double __lcpp_x) _NOEXCEPT {return ::tanl(__lcpp_x);} 10620b57cec5SDimitry Andric #endif 10630b57cec5SDimitry Andric 10640b57cec5SDimitry Andric template <class _A1> 10650b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY 10660b57cec5SDimitry Andric typename std::enable_if<std::is_integral<_A1>::value, double>::type 10670b57cec5SDimitry Andric tan(_A1 __lcpp_x) _NOEXCEPT {return ::tan((double)__lcpp_x);} 10680b57cec5SDimitry Andric 10690b57cec5SDimitry Andric // tanh 10700b57cec5SDimitry Andric 10710b57cec5SDimitry Andric #if !(defined(_AIX) || defined(__sun__)) 10720b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY float tanh(float __lcpp_x) _NOEXCEPT {return ::tanhf(__lcpp_x);} 10730b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY long double tanh(long double __lcpp_x) _NOEXCEPT {return ::tanhl(__lcpp_x);} 10740b57cec5SDimitry Andric #endif 10750b57cec5SDimitry Andric 10760b57cec5SDimitry Andric template <class _A1> 10770b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY 10780b57cec5SDimitry Andric typename std::enable_if<std::is_integral<_A1>::value, double>::type 10790b57cec5SDimitry Andric tanh(_A1 __lcpp_x) _NOEXCEPT {return ::tanh((double)__lcpp_x);} 10800b57cec5SDimitry Andric 10810b57cec5SDimitry Andric // acosh 10820b57cec5SDimitry Andric 10830b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY float acosh(float __lcpp_x) _NOEXCEPT {return ::acoshf(__lcpp_x);} 10840b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY long double acosh(long double __lcpp_x) _NOEXCEPT {return ::acoshl(__lcpp_x);} 10850b57cec5SDimitry Andric 10860b57cec5SDimitry Andric template <class _A1> 10870b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY 10880b57cec5SDimitry Andric typename std::enable_if<std::is_integral<_A1>::value, double>::type 10890b57cec5SDimitry Andric acosh(_A1 __lcpp_x) _NOEXCEPT {return ::acosh((double)__lcpp_x);} 10900b57cec5SDimitry Andric 10910b57cec5SDimitry Andric // asinh 10920b57cec5SDimitry Andric 10930b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY float asinh(float __lcpp_x) _NOEXCEPT {return ::asinhf(__lcpp_x);} 10940b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY long double asinh(long double __lcpp_x) _NOEXCEPT {return ::asinhl(__lcpp_x);} 10950b57cec5SDimitry Andric 10960b57cec5SDimitry Andric template <class _A1> 10970b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY 10980b57cec5SDimitry Andric typename std::enable_if<std::is_integral<_A1>::value, double>::type 10990b57cec5SDimitry Andric asinh(_A1 __lcpp_x) _NOEXCEPT {return ::asinh((double)__lcpp_x);} 11000b57cec5SDimitry Andric 11010b57cec5SDimitry Andric // atanh 11020b57cec5SDimitry Andric 11030b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY float atanh(float __lcpp_x) _NOEXCEPT {return ::atanhf(__lcpp_x);} 11040b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY long double atanh(long double __lcpp_x) _NOEXCEPT {return ::atanhl(__lcpp_x);} 11050b57cec5SDimitry Andric 11060b57cec5SDimitry Andric template <class _A1> 11070b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY 11080b57cec5SDimitry Andric typename std::enable_if<std::is_integral<_A1>::value, double>::type 11090b57cec5SDimitry Andric atanh(_A1 __lcpp_x) _NOEXCEPT {return ::atanh((double)__lcpp_x);} 11100b57cec5SDimitry Andric 11110b57cec5SDimitry Andric // cbrt 11120b57cec5SDimitry Andric 11130b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY float cbrt(float __lcpp_x) _NOEXCEPT {return ::cbrtf(__lcpp_x);} 11140b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY long double cbrt(long double __lcpp_x) _NOEXCEPT {return ::cbrtl(__lcpp_x);} 11150b57cec5SDimitry Andric 11160b57cec5SDimitry Andric template <class _A1> 11170b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY 11180b57cec5SDimitry Andric typename std::enable_if<std::is_integral<_A1>::value, double>::type 11190b57cec5SDimitry Andric cbrt(_A1 __lcpp_x) _NOEXCEPT {return ::cbrt((double)__lcpp_x);} 11200b57cec5SDimitry Andric 11210b57cec5SDimitry Andric // copysign 11220b57cec5SDimitry Andric 1123fe6060f1SDimitry Andric #if __has_builtin(__builtin_copysignf) 1124fe6060f1SDimitry Andric _LIBCPP_CONSTEXPR 1125fe6060f1SDimitry Andric #endif 1126fe6060f1SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY float __libcpp_copysign(float __lcpp_x, float __lcpp_y) _NOEXCEPT { 1127fe6060f1SDimitry Andric #if __has_builtin(__builtin_copysignf) 1128fe6060f1SDimitry Andric return __builtin_copysignf(__lcpp_x, __lcpp_y); 1129fe6060f1SDimitry Andric #else 11300b57cec5SDimitry Andric return ::copysignf(__lcpp_x, __lcpp_y); 1131fe6060f1SDimitry Andric #endif 11320b57cec5SDimitry Andric } 1133fe6060f1SDimitry Andric 1134fe6060f1SDimitry Andric #if __has_builtin(__builtin_copysign) 1135fe6060f1SDimitry Andric _LIBCPP_CONSTEXPR 1136fe6060f1SDimitry Andric #endif 1137fe6060f1SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY double __libcpp_copysign(double __lcpp_x, double __lcpp_y) _NOEXCEPT { 1138fe6060f1SDimitry Andric #if __has_builtin(__builtin_copysign) 1139fe6060f1SDimitry Andric return __builtin_copysign(__lcpp_x, __lcpp_y); 1140fe6060f1SDimitry Andric #else 1141fe6060f1SDimitry Andric return ::copysign(__lcpp_x, __lcpp_y); 1142fe6060f1SDimitry Andric #endif 1143fe6060f1SDimitry Andric } 1144fe6060f1SDimitry Andric 1145fe6060f1SDimitry Andric #if __has_builtin(__builtin_copysignl) 1146fe6060f1SDimitry Andric _LIBCPP_CONSTEXPR 1147fe6060f1SDimitry Andric #endif 1148fe6060f1SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY long double __libcpp_copysign(long double __lcpp_x, long double __lcpp_y) _NOEXCEPT { 1149fe6060f1SDimitry Andric #if __has_builtin(__builtin_copysignl) 1150fe6060f1SDimitry Andric return __builtin_copysignl(__lcpp_x, __lcpp_y); 1151fe6060f1SDimitry Andric #else 11520b57cec5SDimitry Andric return ::copysignl(__lcpp_x, __lcpp_y); 1153fe6060f1SDimitry Andric #endif 1154fe6060f1SDimitry Andric } 1155fe6060f1SDimitry Andric 1156fe6060f1SDimitry Andric template <class _A1, class _A2> 1157fe6060f1SDimitry Andric #if __has_builtin(__builtin_copysign) 1158fe6060f1SDimitry Andric _LIBCPP_CONSTEXPR 1159fe6060f1SDimitry Andric #endif 1160fe6060f1SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY 1161*349cc55cSDimitry Andric typename std::__enable_if_t 1162fe6060f1SDimitry Andric < 1163fe6060f1SDimitry Andric std::is_arithmetic<_A1>::value && 1164fe6060f1SDimitry Andric std::is_arithmetic<_A2>::value, 1165fe6060f1SDimitry Andric std::__promote<_A1, _A2> 1166fe6060f1SDimitry Andric >::type 1167fe6060f1SDimitry Andric __libcpp_copysign(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT { 1168fe6060f1SDimitry Andric typedef typename std::__promote<_A1, _A2>::type __result_type; 1169fe6060f1SDimitry Andric static_assert((!(std::_IsSame<_A1, __result_type>::value && 1170fe6060f1SDimitry Andric std::_IsSame<_A2, __result_type>::value)), ""); 1171fe6060f1SDimitry Andric #if __has_builtin(__builtin_copysign) 1172fe6060f1SDimitry Andric return __builtin_copysign((__result_type)__lcpp_x, (__result_type)__lcpp_y); 1173fe6060f1SDimitry Andric #else 1174fe6060f1SDimitry Andric return ::copysign((__result_type)__lcpp_x, (__result_type)__lcpp_y); 1175fe6060f1SDimitry Andric #endif 1176fe6060f1SDimitry Andric } 1177fe6060f1SDimitry Andric 1178fe6060f1SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY float copysign(float __lcpp_x, float __lcpp_y) _NOEXCEPT { 1179fe6060f1SDimitry Andric return ::__libcpp_copysign(__lcpp_x, __lcpp_y); 1180fe6060f1SDimitry Andric } 1181fe6060f1SDimitry Andric 1182fe6060f1SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY long double copysign(long double __lcpp_x, long double __lcpp_y) _NOEXCEPT { 1183fe6060f1SDimitry Andric return ::__libcpp_copysign(__lcpp_x, __lcpp_y); 11840b57cec5SDimitry Andric } 11850b57cec5SDimitry Andric 11860b57cec5SDimitry Andric template <class _A1, class _A2> 11870b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY 1188*349cc55cSDimitry Andric typename std::__enable_if_t 11890b57cec5SDimitry Andric < 11900b57cec5SDimitry Andric std::is_arithmetic<_A1>::value && 11910b57cec5SDimitry Andric std::is_arithmetic<_A2>::value, 11920b57cec5SDimitry Andric std::__promote<_A1, _A2> 11930b57cec5SDimitry Andric >::type 1194fe6060f1SDimitry Andric copysign(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT { 1195fe6060f1SDimitry Andric return ::__libcpp_copysign(__lcpp_x, __lcpp_y); 11960b57cec5SDimitry Andric } 11970b57cec5SDimitry Andric 11980b57cec5SDimitry Andric // erf 11990b57cec5SDimitry Andric 12000b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY float erf(float __lcpp_x) _NOEXCEPT {return ::erff(__lcpp_x);} 12010b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY long double erf(long double __lcpp_x) _NOEXCEPT {return ::erfl(__lcpp_x);} 12020b57cec5SDimitry Andric 12030b57cec5SDimitry Andric template <class _A1> 12040b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY 12050b57cec5SDimitry Andric typename std::enable_if<std::is_integral<_A1>::value, double>::type 12060b57cec5SDimitry Andric erf(_A1 __lcpp_x) _NOEXCEPT {return ::erf((double)__lcpp_x);} 12070b57cec5SDimitry Andric 12080b57cec5SDimitry Andric // erfc 12090b57cec5SDimitry Andric 12100b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY float erfc(float __lcpp_x) _NOEXCEPT {return ::erfcf(__lcpp_x);} 12110b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY long double erfc(long double __lcpp_x) _NOEXCEPT {return ::erfcl(__lcpp_x);} 12120b57cec5SDimitry Andric 12130b57cec5SDimitry Andric template <class _A1> 12140b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY 12150b57cec5SDimitry Andric typename std::enable_if<std::is_integral<_A1>::value, double>::type 12160b57cec5SDimitry Andric erfc(_A1 __lcpp_x) _NOEXCEPT {return ::erfc((double)__lcpp_x);} 12170b57cec5SDimitry Andric 12180b57cec5SDimitry Andric // exp2 12190b57cec5SDimitry Andric 12200b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY float exp2(float __lcpp_x) _NOEXCEPT {return ::exp2f(__lcpp_x);} 12210b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY long double exp2(long double __lcpp_x) _NOEXCEPT {return ::exp2l(__lcpp_x);} 12220b57cec5SDimitry Andric 12230b57cec5SDimitry Andric template <class _A1> 12240b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY 12250b57cec5SDimitry Andric typename std::enable_if<std::is_integral<_A1>::value, double>::type 12260b57cec5SDimitry Andric exp2(_A1 __lcpp_x) _NOEXCEPT {return ::exp2((double)__lcpp_x);} 12270b57cec5SDimitry Andric 12280b57cec5SDimitry Andric // expm1 12290b57cec5SDimitry Andric 12300b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY float expm1(float __lcpp_x) _NOEXCEPT {return ::expm1f(__lcpp_x);} 12310b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY long double expm1(long double __lcpp_x) _NOEXCEPT {return ::expm1l(__lcpp_x);} 12320b57cec5SDimitry Andric 12330b57cec5SDimitry Andric template <class _A1> 12340b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY 12350b57cec5SDimitry Andric typename std::enable_if<std::is_integral<_A1>::value, double>::type 12360b57cec5SDimitry Andric expm1(_A1 __lcpp_x) _NOEXCEPT {return ::expm1((double)__lcpp_x);} 12370b57cec5SDimitry Andric 12380b57cec5SDimitry Andric // fdim 12390b57cec5SDimitry Andric 12400b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY float fdim(float __lcpp_x, float __lcpp_y) _NOEXCEPT {return ::fdimf(__lcpp_x, __lcpp_y);} 12410b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY long double fdim(long double __lcpp_x, long double __lcpp_y) _NOEXCEPT {return ::fdiml(__lcpp_x, __lcpp_y);} 12420b57cec5SDimitry Andric 12430b57cec5SDimitry Andric template <class _A1, class _A2> 12440b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY 1245*349cc55cSDimitry Andric typename std::__enable_if_t 12460b57cec5SDimitry Andric < 12470b57cec5SDimitry Andric std::is_arithmetic<_A1>::value && 12480b57cec5SDimitry Andric std::is_arithmetic<_A2>::value, 12490b57cec5SDimitry Andric std::__promote<_A1, _A2> 12500b57cec5SDimitry Andric >::type 12510b57cec5SDimitry Andric fdim(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT 12520b57cec5SDimitry Andric { 12530b57cec5SDimitry Andric typedef typename std::__promote<_A1, _A2>::type __result_type; 12540b57cec5SDimitry Andric static_assert((!(std::_IsSame<_A1, __result_type>::value && 12550b57cec5SDimitry Andric std::_IsSame<_A2, __result_type>::value)), ""); 12560b57cec5SDimitry Andric return ::fdim((__result_type)__lcpp_x, (__result_type)__lcpp_y); 12570b57cec5SDimitry Andric } 12580b57cec5SDimitry Andric 12590b57cec5SDimitry Andric // fma 12600b57cec5SDimitry Andric 1261fe6060f1SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY float fma(float __lcpp_x, float __lcpp_y, float __lcpp_z) _NOEXCEPT 1262fe6060f1SDimitry Andric { 1263fe6060f1SDimitry Andric #if __has_builtin(__builtin_fmaf) 1264fe6060f1SDimitry Andric return __builtin_fmaf(__lcpp_x, __lcpp_y, __lcpp_z); 1265fe6060f1SDimitry Andric #else 1266fe6060f1SDimitry Andric return ::fmaf(__lcpp_x, __lcpp_y, __lcpp_z); 1267fe6060f1SDimitry Andric #endif 1268fe6060f1SDimitry Andric } 1269fe6060f1SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY long double fma(long double __lcpp_x, long double __lcpp_y, long double __lcpp_z) _NOEXCEPT 1270fe6060f1SDimitry Andric { 1271fe6060f1SDimitry Andric #if __has_builtin(__builtin_fmal) 1272fe6060f1SDimitry Andric return __builtin_fmal(__lcpp_x, __lcpp_y, __lcpp_z); 1273fe6060f1SDimitry Andric #else 1274fe6060f1SDimitry Andric return ::fmal(__lcpp_x, __lcpp_y, __lcpp_z); 1275fe6060f1SDimitry Andric #endif 1276fe6060f1SDimitry Andric } 12770b57cec5SDimitry Andric 12780b57cec5SDimitry Andric template <class _A1, class _A2, class _A3> 12790b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY 1280*349cc55cSDimitry Andric typename std::__enable_if_t 12810b57cec5SDimitry Andric < 12820b57cec5SDimitry Andric std::is_arithmetic<_A1>::value && 12830b57cec5SDimitry Andric std::is_arithmetic<_A2>::value && 12840b57cec5SDimitry Andric std::is_arithmetic<_A3>::value, 12850b57cec5SDimitry Andric std::__promote<_A1, _A2, _A3> 12860b57cec5SDimitry Andric >::type 12870b57cec5SDimitry Andric fma(_A1 __lcpp_x, _A2 __lcpp_y, _A3 __lcpp_z) _NOEXCEPT 12880b57cec5SDimitry Andric { 12890b57cec5SDimitry Andric typedef typename std::__promote<_A1, _A2, _A3>::type __result_type; 12900b57cec5SDimitry Andric static_assert((!(std::_IsSame<_A1, __result_type>::value && 12910b57cec5SDimitry Andric std::_IsSame<_A2, __result_type>::value && 12920b57cec5SDimitry Andric std::_IsSame<_A3, __result_type>::value)), ""); 1293fe6060f1SDimitry Andric #if __has_builtin(__builtin_fma) 1294fe6060f1SDimitry Andric return __builtin_fma((__result_type)__lcpp_x, (__result_type)__lcpp_y, (__result_type)__lcpp_z); 1295fe6060f1SDimitry Andric #else 12960b57cec5SDimitry Andric return ::fma((__result_type)__lcpp_x, (__result_type)__lcpp_y, (__result_type)__lcpp_z); 1297fe6060f1SDimitry Andric #endif 12980b57cec5SDimitry Andric } 12990b57cec5SDimitry Andric 13000b57cec5SDimitry Andric // fmax 13010b57cec5SDimitry Andric 13020b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY float fmax(float __lcpp_x, float __lcpp_y) _NOEXCEPT {return ::fmaxf(__lcpp_x, __lcpp_y);} 13030b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY long double fmax(long double __lcpp_x, long double __lcpp_y) _NOEXCEPT {return ::fmaxl(__lcpp_x, __lcpp_y);} 13040b57cec5SDimitry Andric 13050b57cec5SDimitry Andric template <class _A1, class _A2> 13060b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY 1307*349cc55cSDimitry Andric typename std::__enable_if_t 13080b57cec5SDimitry Andric < 13090b57cec5SDimitry Andric std::is_arithmetic<_A1>::value && 13100b57cec5SDimitry Andric std::is_arithmetic<_A2>::value, 13110b57cec5SDimitry Andric std::__promote<_A1, _A2> 13120b57cec5SDimitry Andric >::type 13130b57cec5SDimitry Andric fmax(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT 13140b57cec5SDimitry Andric { 13150b57cec5SDimitry Andric typedef typename std::__promote<_A1, _A2>::type __result_type; 13160b57cec5SDimitry Andric static_assert((!(std::_IsSame<_A1, __result_type>::value && 13170b57cec5SDimitry Andric std::_IsSame<_A2, __result_type>::value)), ""); 13180b57cec5SDimitry Andric return ::fmax((__result_type)__lcpp_x, (__result_type)__lcpp_y); 13190b57cec5SDimitry Andric } 13200b57cec5SDimitry Andric 13210b57cec5SDimitry Andric // fmin 13220b57cec5SDimitry Andric 13230b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY float fmin(float __lcpp_x, float __lcpp_y) _NOEXCEPT {return ::fminf(__lcpp_x, __lcpp_y);} 13240b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY long double fmin(long double __lcpp_x, long double __lcpp_y) _NOEXCEPT {return ::fminl(__lcpp_x, __lcpp_y);} 13250b57cec5SDimitry Andric 13260b57cec5SDimitry Andric template <class _A1, class _A2> 13270b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY 1328*349cc55cSDimitry Andric typename std::__enable_if_t 13290b57cec5SDimitry Andric < 13300b57cec5SDimitry Andric std::is_arithmetic<_A1>::value && 13310b57cec5SDimitry Andric std::is_arithmetic<_A2>::value, 13320b57cec5SDimitry Andric std::__promote<_A1, _A2> 13330b57cec5SDimitry Andric >::type 13340b57cec5SDimitry Andric fmin(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT 13350b57cec5SDimitry Andric { 13360b57cec5SDimitry Andric typedef typename std::__promote<_A1, _A2>::type __result_type; 13370b57cec5SDimitry Andric static_assert((!(std::_IsSame<_A1, __result_type>::value && 13380b57cec5SDimitry Andric std::_IsSame<_A2, __result_type>::value)), ""); 13390b57cec5SDimitry Andric return ::fmin((__result_type)__lcpp_x, (__result_type)__lcpp_y); 13400b57cec5SDimitry Andric } 13410b57cec5SDimitry Andric 13420b57cec5SDimitry Andric // hypot 13430b57cec5SDimitry Andric 13440b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY float hypot(float __lcpp_x, float __lcpp_y) _NOEXCEPT {return ::hypotf(__lcpp_x, __lcpp_y);} 13450b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY long double hypot(long double __lcpp_x, long double __lcpp_y) _NOEXCEPT {return ::hypotl(__lcpp_x, __lcpp_y);} 13460b57cec5SDimitry Andric 13470b57cec5SDimitry Andric template <class _A1, class _A2> 13480b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY 1349*349cc55cSDimitry Andric typename std::__enable_if_t 13500b57cec5SDimitry Andric < 13510b57cec5SDimitry Andric std::is_arithmetic<_A1>::value && 13520b57cec5SDimitry Andric std::is_arithmetic<_A2>::value, 13530b57cec5SDimitry Andric std::__promote<_A1, _A2> 13540b57cec5SDimitry Andric >::type 13550b57cec5SDimitry Andric hypot(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT 13560b57cec5SDimitry Andric { 13570b57cec5SDimitry Andric typedef typename std::__promote<_A1, _A2>::type __result_type; 13580b57cec5SDimitry Andric static_assert((!(std::_IsSame<_A1, __result_type>::value && 13590b57cec5SDimitry Andric std::_IsSame<_A2, __result_type>::value)), ""); 13600b57cec5SDimitry Andric return ::hypot((__result_type)__lcpp_x, (__result_type)__lcpp_y); 13610b57cec5SDimitry Andric } 13620b57cec5SDimitry Andric 13630b57cec5SDimitry Andric // ilogb 13640b57cec5SDimitry Andric 13650b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY int ilogb(float __lcpp_x) _NOEXCEPT {return ::ilogbf(__lcpp_x);} 13660b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY int ilogb(long double __lcpp_x) _NOEXCEPT {return ::ilogbl(__lcpp_x);} 13670b57cec5SDimitry Andric 13680b57cec5SDimitry Andric template <class _A1> 13690b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY 13700b57cec5SDimitry Andric typename std::enable_if<std::is_integral<_A1>::value, int>::type 13710b57cec5SDimitry Andric ilogb(_A1 __lcpp_x) _NOEXCEPT {return ::ilogb((double)__lcpp_x);} 13720b57cec5SDimitry Andric 13730b57cec5SDimitry Andric // lgamma 13740b57cec5SDimitry Andric 13750b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY float lgamma(float __lcpp_x) _NOEXCEPT {return ::lgammaf(__lcpp_x);} 13760b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY long double lgamma(long double __lcpp_x) _NOEXCEPT {return ::lgammal(__lcpp_x);} 13770b57cec5SDimitry Andric 13780b57cec5SDimitry Andric template <class _A1> 13790b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY 13800b57cec5SDimitry Andric typename std::enable_if<std::is_integral<_A1>::value, double>::type 13810b57cec5SDimitry Andric lgamma(_A1 __lcpp_x) _NOEXCEPT {return ::lgamma((double)__lcpp_x);} 13820b57cec5SDimitry Andric 13830b57cec5SDimitry Andric // llrint 13840b57cec5SDimitry Andric 1385fe6060f1SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY long long llrint(float __lcpp_x) _NOEXCEPT 1386fe6060f1SDimitry Andric { 1387fe6060f1SDimitry Andric #if __has_builtin(__builtin_llrintf) 1388fe6060f1SDimitry Andric return __builtin_llrintf(__lcpp_x); 1389fe6060f1SDimitry Andric #else 1390fe6060f1SDimitry Andric return ::llrintf(__lcpp_x); 1391fe6060f1SDimitry Andric #endif 1392fe6060f1SDimitry Andric } 1393fe6060f1SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY long long llrint(long double __lcpp_x) _NOEXCEPT 1394fe6060f1SDimitry Andric { 1395fe6060f1SDimitry Andric #if __has_builtin(__builtin_llrintl) 1396fe6060f1SDimitry Andric return __builtin_llrintl(__lcpp_x); 1397fe6060f1SDimitry Andric #else 1398fe6060f1SDimitry Andric return ::llrintl(__lcpp_x); 1399fe6060f1SDimitry Andric #endif 1400fe6060f1SDimitry Andric } 14010b57cec5SDimitry Andric 14020b57cec5SDimitry Andric template <class _A1> 14030b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY 14040b57cec5SDimitry Andric typename std::enable_if<std::is_integral<_A1>::value, long long>::type 1405fe6060f1SDimitry Andric llrint(_A1 __lcpp_x) _NOEXCEPT 1406fe6060f1SDimitry Andric { 1407fe6060f1SDimitry Andric #if __has_builtin(__builtin_llrint) 1408fe6060f1SDimitry Andric return __builtin_llrint((double)__lcpp_x); 1409fe6060f1SDimitry Andric #else 1410fe6060f1SDimitry Andric return ::llrint((double)__lcpp_x); 1411fe6060f1SDimitry Andric #endif 1412fe6060f1SDimitry Andric } 14130b57cec5SDimitry Andric 14140b57cec5SDimitry Andric // llround 14150b57cec5SDimitry Andric 1416fe6060f1SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY long long llround(float __lcpp_x) _NOEXCEPT 1417fe6060f1SDimitry Andric { 1418fe6060f1SDimitry Andric #if __has_builtin(__builtin_llroundf) 1419fe6060f1SDimitry Andric return __builtin_llroundf(__lcpp_x); 1420fe6060f1SDimitry Andric #else 1421fe6060f1SDimitry Andric return ::llroundf(__lcpp_x); 1422fe6060f1SDimitry Andric #endif 1423fe6060f1SDimitry Andric } 1424fe6060f1SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY long long llround(long double __lcpp_x) _NOEXCEPT 1425fe6060f1SDimitry Andric { 1426fe6060f1SDimitry Andric #if __has_builtin(__builtin_llroundl) 1427fe6060f1SDimitry Andric return __builtin_llroundl(__lcpp_x); 1428fe6060f1SDimitry Andric #else 1429fe6060f1SDimitry Andric return ::llroundl(__lcpp_x); 1430fe6060f1SDimitry Andric #endif 1431fe6060f1SDimitry Andric } 14320b57cec5SDimitry Andric 14330b57cec5SDimitry Andric template <class _A1> 14340b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY 14350b57cec5SDimitry Andric typename std::enable_if<std::is_integral<_A1>::value, long long>::type 1436fe6060f1SDimitry Andric llround(_A1 __lcpp_x) _NOEXCEPT 1437fe6060f1SDimitry Andric { 1438fe6060f1SDimitry Andric #if __has_builtin(__builtin_llround) 1439fe6060f1SDimitry Andric return __builtin_llround((double)__lcpp_x); 1440fe6060f1SDimitry Andric #else 1441fe6060f1SDimitry Andric return ::llround((double)__lcpp_x); 1442fe6060f1SDimitry Andric #endif 1443fe6060f1SDimitry Andric } 14440b57cec5SDimitry Andric 14450b57cec5SDimitry Andric // log1p 14460b57cec5SDimitry Andric 14470b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY float log1p(float __lcpp_x) _NOEXCEPT {return ::log1pf(__lcpp_x);} 14480b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY long double log1p(long double __lcpp_x) _NOEXCEPT {return ::log1pl(__lcpp_x);} 14490b57cec5SDimitry Andric 14500b57cec5SDimitry Andric template <class _A1> 14510b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY 14520b57cec5SDimitry Andric typename std::enable_if<std::is_integral<_A1>::value, double>::type 14530b57cec5SDimitry Andric log1p(_A1 __lcpp_x) _NOEXCEPT {return ::log1p((double)__lcpp_x);} 14540b57cec5SDimitry Andric 14550b57cec5SDimitry Andric // log2 14560b57cec5SDimitry Andric 14570b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY float log2(float __lcpp_x) _NOEXCEPT {return ::log2f(__lcpp_x);} 14580b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY long double log2(long double __lcpp_x) _NOEXCEPT {return ::log2l(__lcpp_x);} 14590b57cec5SDimitry Andric 14600b57cec5SDimitry Andric template <class _A1> 14610b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY 14620b57cec5SDimitry Andric typename std::enable_if<std::is_integral<_A1>::value, double>::type 14630b57cec5SDimitry Andric log2(_A1 __lcpp_x) _NOEXCEPT {return ::log2((double)__lcpp_x);} 14640b57cec5SDimitry Andric 14650b57cec5SDimitry Andric // logb 14660b57cec5SDimitry Andric 14670b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY float logb(float __lcpp_x) _NOEXCEPT {return ::logbf(__lcpp_x);} 14680b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY long double logb(long double __lcpp_x) _NOEXCEPT {return ::logbl(__lcpp_x);} 14690b57cec5SDimitry Andric 14700b57cec5SDimitry Andric template <class _A1> 14710b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY 14720b57cec5SDimitry Andric typename std::enable_if<std::is_integral<_A1>::value, double>::type 14730b57cec5SDimitry Andric logb(_A1 __lcpp_x) _NOEXCEPT {return ::logb((double)__lcpp_x);} 14740b57cec5SDimitry Andric 14750b57cec5SDimitry Andric // lrint 14760b57cec5SDimitry Andric 1477fe6060f1SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY long lrint(float __lcpp_x) _NOEXCEPT 1478fe6060f1SDimitry Andric { 1479fe6060f1SDimitry Andric #if __has_builtin(__builtin_lrintf) 1480fe6060f1SDimitry Andric return __builtin_lrintf(__lcpp_x); 1481fe6060f1SDimitry Andric #else 1482fe6060f1SDimitry Andric return ::lrintf(__lcpp_x); 1483fe6060f1SDimitry Andric #endif 1484fe6060f1SDimitry Andric } 1485fe6060f1SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY long lrint(long double __lcpp_x) _NOEXCEPT 1486fe6060f1SDimitry Andric { 1487fe6060f1SDimitry Andric #if __has_builtin(__builtin_lrintl) 1488fe6060f1SDimitry Andric return __builtin_lrintl(__lcpp_x); 1489fe6060f1SDimitry Andric #else 1490fe6060f1SDimitry Andric return ::lrintl(__lcpp_x); 1491fe6060f1SDimitry Andric #endif 1492fe6060f1SDimitry Andric } 14930b57cec5SDimitry Andric 14940b57cec5SDimitry Andric template <class _A1> 14950b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY 14960b57cec5SDimitry Andric typename std::enable_if<std::is_integral<_A1>::value, long>::type 1497fe6060f1SDimitry Andric lrint(_A1 __lcpp_x) _NOEXCEPT 1498fe6060f1SDimitry Andric { 1499fe6060f1SDimitry Andric #if __has_builtin(__builtin_lrint) 1500fe6060f1SDimitry Andric return __builtin_lrint((double)__lcpp_x); 1501fe6060f1SDimitry Andric #else 1502fe6060f1SDimitry Andric return ::lrint((double)__lcpp_x); 1503fe6060f1SDimitry Andric #endif 1504fe6060f1SDimitry Andric } 15050b57cec5SDimitry Andric 15060b57cec5SDimitry Andric // lround 15070b57cec5SDimitry Andric 1508fe6060f1SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY long lround(float __lcpp_x) _NOEXCEPT 1509fe6060f1SDimitry Andric { 1510fe6060f1SDimitry Andric #if __has_builtin(__builtin_lroundf) 1511fe6060f1SDimitry Andric return __builtin_lroundf(__lcpp_x); 1512fe6060f1SDimitry Andric #else 1513fe6060f1SDimitry Andric return ::lroundf(__lcpp_x); 1514fe6060f1SDimitry Andric #endif 1515fe6060f1SDimitry Andric } 1516fe6060f1SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY long lround(long double __lcpp_x) _NOEXCEPT 1517fe6060f1SDimitry Andric { 1518fe6060f1SDimitry Andric #if __has_builtin(__builtin_lroundl) 1519fe6060f1SDimitry Andric return __builtin_lroundl(__lcpp_x); 1520fe6060f1SDimitry Andric #else 1521fe6060f1SDimitry Andric return ::lroundl(__lcpp_x); 1522fe6060f1SDimitry Andric #endif 1523fe6060f1SDimitry Andric } 15240b57cec5SDimitry Andric 15250b57cec5SDimitry Andric template <class _A1> 15260b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY 15270b57cec5SDimitry Andric typename std::enable_if<std::is_integral<_A1>::value, long>::type 1528fe6060f1SDimitry Andric lround(_A1 __lcpp_x) _NOEXCEPT 1529fe6060f1SDimitry Andric { 1530fe6060f1SDimitry Andric #if __has_builtin(__builtin_lround) 1531fe6060f1SDimitry Andric return __builtin_lround((double)__lcpp_x); 1532fe6060f1SDimitry Andric #else 1533fe6060f1SDimitry Andric return ::lround((double)__lcpp_x); 1534fe6060f1SDimitry Andric #endif 1535fe6060f1SDimitry Andric } 15360b57cec5SDimitry Andric 15370b57cec5SDimitry Andric // nan 15380b57cec5SDimitry Andric 15390b57cec5SDimitry Andric // nearbyint 15400b57cec5SDimitry Andric 15410b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY float nearbyint(float __lcpp_x) _NOEXCEPT {return ::nearbyintf(__lcpp_x);} 15420b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY long double nearbyint(long double __lcpp_x) _NOEXCEPT {return ::nearbyintl(__lcpp_x);} 15430b57cec5SDimitry Andric 15440b57cec5SDimitry Andric template <class _A1> 15450b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY 15460b57cec5SDimitry Andric typename std::enable_if<std::is_integral<_A1>::value, double>::type 15470b57cec5SDimitry Andric nearbyint(_A1 __lcpp_x) _NOEXCEPT {return ::nearbyint((double)__lcpp_x);} 15480b57cec5SDimitry Andric 15490b57cec5SDimitry Andric // nextafter 15500b57cec5SDimitry Andric 15510b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY float nextafter(float __lcpp_x, float __lcpp_y) _NOEXCEPT {return ::nextafterf(__lcpp_x, __lcpp_y);} 15520b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY long double nextafter(long double __lcpp_x, long double __lcpp_y) _NOEXCEPT {return ::nextafterl(__lcpp_x, __lcpp_y);} 15530b57cec5SDimitry Andric 15540b57cec5SDimitry Andric template <class _A1, class _A2> 15550b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY 1556*349cc55cSDimitry Andric typename std::__enable_if_t 15570b57cec5SDimitry Andric < 15580b57cec5SDimitry Andric std::is_arithmetic<_A1>::value && 15590b57cec5SDimitry Andric std::is_arithmetic<_A2>::value, 15600b57cec5SDimitry Andric std::__promote<_A1, _A2> 15610b57cec5SDimitry Andric >::type 15620b57cec5SDimitry Andric nextafter(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT 15630b57cec5SDimitry Andric { 15640b57cec5SDimitry Andric typedef typename std::__promote<_A1, _A2>::type __result_type; 15650b57cec5SDimitry Andric static_assert((!(std::_IsSame<_A1, __result_type>::value && 15660b57cec5SDimitry Andric std::_IsSame<_A2, __result_type>::value)), ""); 15670b57cec5SDimitry Andric return ::nextafter((__result_type)__lcpp_x, (__result_type)__lcpp_y); 15680b57cec5SDimitry Andric } 15690b57cec5SDimitry Andric 15700b57cec5SDimitry Andric // nexttoward 15710b57cec5SDimitry Andric 15720b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY float nexttoward(float __lcpp_x, long double __lcpp_y) _NOEXCEPT {return ::nexttowardf(__lcpp_x, __lcpp_y);} 15730b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY long double nexttoward(long double __lcpp_x, long double __lcpp_y) _NOEXCEPT {return ::nexttowardl(__lcpp_x, __lcpp_y);} 15740b57cec5SDimitry Andric 15750b57cec5SDimitry Andric template <class _A1> 15760b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY 15770b57cec5SDimitry Andric typename std::enable_if<std::is_integral<_A1>::value, double>::type 15780b57cec5SDimitry Andric nexttoward(_A1 __lcpp_x, long double __lcpp_y) _NOEXCEPT {return ::nexttoward((double)__lcpp_x, __lcpp_y);} 15790b57cec5SDimitry Andric 15800b57cec5SDimitry Andric // remainder 15810b57cec5SDimitry Andric 15820b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY float remainder(float __lcpp_x, float __lcpp_y) _NOEXCEPT {return ::remainderf(__lcpp_x, __lcpp_y);} 15830b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY long double remainder(long double __lcpp_x, long double __lcpp_y) _NOEXCEPT {return ::remainderl(__lcpp_x, __lcpp_y);} 15840b57cec5SDimitry Andric 15850b57cec5SDimitry Andric template <class _A1, class _A2> 15860b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY 1587*349cc55cSDimitry Andric typename std::__enable_if_t 15880b57cec5SDimitry Andric < 15890b57cec5SDimitry Andric std::is_arithmetic<_A1>::value && 15900b57cec5SDimitry Andric std::is_arithmetic<_A2>::value, 15910b57cec5SDimitry Andric std::__promote<_A1, _A2> 15920b57cec5SDimitry Andric >::type 15930b57cec5SDimitry Andric remainder(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT 15940b57cec5SDimitry Andric { 15950b57cec5SDimitry Andric typedef typename std::__promote<_A1, _A2>::type __result_type; 15960b57cec5SDimitry Andric static_assert((!(std::_IsSame<_A1, __result_type>::value && 15970b57cec5SDimitry Andric std::_IsSame<_A2, __result_type>::value)), ""); 15980b57cec5SDimitry Andric return ::remainder((__result_type)__lcpp_x, (__result_type)__lcpp_y); 15990b57cec5SDimitry Andric } 16000b57cec5SDimitry Andric 16010b57cec5SDimitry Andric // remquo 16020b57cec5SDimitry Andric 16030b57cec5SDimitry 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);} 16040b57cec5SDimitry 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);} 16050b57cec5SDimitry Andric 16060b57cec5SDimitry Andric template <class _A1, class _A2> 16070b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY 1608*349cc55cSDimitry Andric typename std::__enable_if_t 16090b57cec5SDimitry Andric < 16100b57cec5SDimitry Andric std::is_arithmetic<_A1>::value && 16110b57cec5SDimitry Andric std::is_arithmetic<_A2>::value, 16120b57cec5SDimitry Andric std::__promote<_A1, _A2> 16130b57cec5SDimitry Andric >::type 16140b57cec5SDimitry Andric remquo(_A1 __lcpp_x, _A2 __lcpp_y, int* __lcpp_z) _NOEXCEPT 16150b57cec5SDimitry Andric { 16160b57cec5SDimitry Andric typedef typename std::__promote<_A1, _A2>::type __result_type; 16170b57cec5SDimitry Andric static_assert((!(std::_IsSame<_A1, __result_type>::value && 16180b57cec5SDimitry Andric std::_IsSame<_A2, __result_type>::value)), ""); 16190b57cec5SDimitry Andric return ::remquo((__result_type)__lcpp_x, (__result_type)__lcpp_y, __lcpp_z); 16200b57cec5SDimitry Andric } 16210b57cec5SDimitry Andric 16220b57cec5SDimitry Andric // rint 16230b57cec5SDimitry Andric 1624fe6060f1SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY float rint(float __lcpp_x) _NOEXCEPT 1625fe6060f1SDimitry Andric { 1626fe6060f1SDimitry Andric #if __has_builtin(__builtin_rintf) 1627fe6060f1SDimitry Andric return __builtin_rintf(__lcpp_x); 1628fe6060f1SDimitry Andric #else 1629fe6060f1SDimitry Andric return ::rintf(__lcpp_x); 1630fe6060f1SDimitry Andric #endif 1631fe6060f1SDimitry Andric } 1632fe6060f1SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY long double rint(long double __lcpp_x) _NOEXCEPT 1633fe6060f1SDimitry Andric { 1634fe6060f1SDimitry Andric #if __has_builtin(__builtin_rintl) 1635fe6060f1SDimitry Andric return __builtin_rintl(__lcpp_x); 1636fe6060f1SDimitry Andric #else 1637fe6060f1SDimitry Andric return ::rintl(__lcpp_x); 1638fe6060f1SDimitry Andric #endif 1639fe6060f1SDimitry Andric } 16400b57cec5SDimitry Andric 16410b57cec5SDimitry Andric template <class _A1> 16420b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY 16430b57cec5SDimitry Andric typename std::enable_if<std::is_integral<_A1>::value, double>::type 1644fe6060f1SDimitry Andric rint(_A1 __lcpp_x) _NOEXCEPT 1645fe6060f1SDimitry Andric { 1646fe6060f1SDimitry Andric #if __has_builtin(__builtin_rint) 1647fe6060f1SDimitry Andric return __builtin_rint((double)__lcpp_x); 1648fe6060f1SDimitry Andric #else 1649fe6060f1SDimitry Andric return ::rint((double)__lcpp_x); 1650fe6060f1SDimitry Andric #endif 1651fe6060f1SDimitry Andric } 16520b57cec5SDimitry Andric 16530b57cec5SDimitry Andric // round 16540b57cec5SDimitry Andric 1655fe6060f1SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY float round(float __lcpp_x) _NOEXCEPT 1656fe6060f1SDimitry Andric { 1657fe6060f1SDimitry Andric #if __has_builtin(__builtin_round) 1658fe6060f1SDimitry Andric return __builtin_round(__lcpp_x); 1659fe6060f1SDimitry Andric #else 1660fe6060f1SDimitry Andric return ::round(__lcpp_x); 1661fe6060f1SDimitry Andric #endif 1662fe6060f1SDimitry Andric } 1663fe6060f1SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY long double round(long double __lcpp_x) _NOEXCEPT 1664fe6060f1SDimitry Andric { 1665fe6060f1SDimitry Andric #if __has_builtin(__builtin_roundl) 1666fe6060f1SDimitry Andric return __builtin_roundl(__lcpp_x); 1667fe6060f1SDimitry Andric #else 1668fe6060f1SDimitry Andric return ::roundl(__lcpp_x); 1669fe6060f1SDimitry Andric #endif 1670fe6060f1SDimitry Andric } 16710b57cec5SDimitry Andric 16720b57cec5SDimitry Andric template <class _A1> 16730b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY 16740b57cec5SDimitry Andric typename std::enable_if<std::is_integral<_A1>::value, double>::type 1675fe6060f1SDimitry Andric round(_A1 __lcpp_x) _NOEXCEPT 1676fe6060f1SDimitry Andric { 1677fe6060f1SDimitry Andric #if __has_builtin(__builtin_round) 1678fe6060f1SDimitry Andric return __builtin_round((double)__lcpp_x); 1679fe6060f1SDimitry Andric #else 1680fe6060f1SDimitry Andric return ::round((double)__lcpp_x); 1681fe6060f1SDimitry Andric #endif 1682fe6060f1SDimitry Andric } 16830b57cec5SDimitry Andric 16840b57cec5SDimitry Andric // scalbln 16850b57cec5SDimitry Andric 16860b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY float scalbln(float __lcpp_x, long __lcpp_y) _NOEXCEPT {return ::scalblnf(__lcpp_x, __lcpp_y);} 16870b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY long double scalbln(long double __lcpp_x, long __lcpp_y) _NOEXCEPT {return ::scalblnl(__lcpp_x, __lcpp_y);} 16880b57cec5SDimitry Andric 16890b57cec5SDimitry Andric template <class _A1> 16900b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY 16910b57cec5SDimitry Andric typename std::enable_if<std::is_integral<_A1>::value, double>::type 16920b57cec5SDimitry Andric scalbln(_A1 __lcpp_x, long __lcpp_y) _NOEXCEPT {return ::scalbln((double)__lcpp_x, __lcpp_y);} 16930b57cec5SDimitry Andric 16940b57cec5SDimitry Andric // scalbn 16950b57cec5SDimitry Andric 16960b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY float scalbn(float __lcpp_x, int __lcpp_y) _NOEXCEPT {return ::scalbnf(__lcpp_x, __lcpp_y);} 16970b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY long double scalbn(long double __lcpp_x, int __lcpp_y) _NOEXCEPT {return ::scalbnl(__lcpp_x, __lcpp_y);} 16980b57cec5SDimitry Andric 16990b57cec5SDimitry Andric template <class _A1> 17000b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY 17010b57cec5SDimitry Andric typename std::enable_if<std::is_integral<_A1>::value, double>::type 17020b57cec5SDimitry Andric scalbn(_A1 __lcpp_x, int __lcpp_y) _NOEXCEPT {return ::scalbn((double)__lcpp_x, __lcpp_y);} 17030b57cec5SDimitry Andric 17040b57cec5SDimitry Andric // tgamma 17050b57cec5SDimitry Andric 17060b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY float tgamma(float __lcpp_x) _NOEXCEPT {return ::tgammaf(__lcpp_x);} 17070b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY long double tgamma(long double __lcpp_x) _NOEXCEPT {return ::tgammal(__lcpp_x);} 17080b57cec5SDimitry Andric 17090b57cec5SDimitry Andric template <class _A1> 17100b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY 17110b57cec5SDimitry Andric typename std::enable_if<std::is_integral<_A1>::value, double>::type 17120b57cec5SDimitry Andric tgamma(_A1 __lcpp_x) _NOEXCEPT {return ::tgamma((double)__lcpp_x);} 17130b57cec5SDimitry Andric 17140b57cec5SDimitry Andric // trunc 17150b57cec5SDimitry Andric 1716fe6060f1SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY float trunc(float __lcpp_x) _NOEXCEPT 1717fe6060f1SDimitry Andric { 1718fe6060f1SDimitry Andric #if __has_builtin(__builtin_trunc) 1719fe6060f1SDimitry Andric return __builtin_trunc(__lcpp_x); 1720fe6060f1SDimitry Andric #else 1721fe6060f1SDimitry Andric return ::trunc(__lcpp_x); 1722fe6060f1SDimitry Andric #endif 1723fe6060f1SDimitry Andric } 1724fe6060f1SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY long double trunc(long double __lcpp_x) _NOEXCEPT 1725fe6060f1SDimitry Andric { 1726fe6060f1SDimitry Andric #if __has_builtin(__builtin_truncl) 1727fe6060f1SDimitry Andric return __builtin_truncl(__lcpp_x); 1728fe6060f1SDimitry Andric #else 1729fe6060f1SDimitry Andric return ::truncl(__lcpp_x); 1730fe6060f1SDimitry Andric #endif 1731fe6060f1SDimitry Andric } 17320b57cec5SDimitry Andric 17330b57cec5SDimitry Andric template <class _A1> 17340b57cec5SDimitry Andric inline _LIBCPP_INLINE_VISIBILITY 17350b57cec5SDimitry Andric typename std::enable_if<std::is_integral<_A1>::value, double>::type 1736fe6060f1SDimitry Andric trunc(_A1 __lcpp_x) _NOEXCEPT 1737fe6060f1SDimitry Andric { 1738fe6060f1SDimitry Andric #if __has_builtin(__builtin_trunc) 1739fe6060f1SDimitry Andric return __builtin_trunc((double)__lcpp_x); 1740fe6060f1SDimitry Andric #else 1741fe6060f1SDimitry Andric return ::trunc((double)__lcpp_x); 1742fe6060f1SDimitry Andric #endif 1743fe6060f1SDimitry Andric } 17440b57cec5SDimitry Andric 17450b57cec5SDimitry Andric } // extern "C++" 17460b57cec5SDimitry Andric 17470b57cec5SDimitry Andric #endif // __cplusplus 17480b57cec5SDimitry Andric 17490b57cec5SDimitry Andric #else // _LIBCPP_MATH_H 17500b57cec5SDimitry Andric 17510b57cec5SDimitry Andric // This include lives outside the header guard in order to support an MSVC 17520b57cec5SDimitry Andric // extension which allows users to do: 17530b57cec5SDimitry Andric // 17540b57cec5SDimitry Andric // #define _USE_MATH_DEFINES 17550b57cec5SDimitry Andric // #include <math.h> 17560b57cec5SDimitry Andric // 17570b57cec5SDimitry Andric // and receive the definitions of mathematical constants, even if <math.h> 17580b57cec5SDimitry Andric // has previously been included. 17590b57cec5SDimitry Andric #if defined(_LIBCPP_MSVCRT) && defined(_USE_MATH_DEFINES) 17600b57cec5SDimitry Andric #include_next <math.h> 17610b57cec5SDimitry Andric #endif 17620b57cec5SDimitry Andric 17630b57cec5SDimitry Andric #endif // _LIBCPP_MATH_H 1764