Index: libcxx/include/complex =================================================================== --- libcxx/include/complex +++ libcxx/include/complex @@ -874,7 +874,7 @@ >::type arg(_Tp __re) { - return atan2l(0.L, __re); + return atan2(0.L, __re); } template Index: libcxx/include/math.h =================================================================== --- libcxx/include/math.h +++ libcxx/include/math.h @@ -790,44 +790,110 @@ // acos # if !defined(__sun__) -inline _LIBCPP_INLINE_VISIBILITY float acos(float __lcpp_x) _NOEXCEPT {return ::acosf(__lcpp_x);} -inline _LIBCPP_INLINE_VISIBILITY long double acos(long double __lcpp_x) _NOEXCEPT {return ::acosl(__lcpp_x);} +inline _LIBCPP_INLINE_VISIBILITY float acos(float __lcpp_x) _NOEXCEPT { +#if __has_builtin(__builtin_acosf) + return __builtin_acosf(__lcpp_x); +#else + return ::acosf(__lcpp_x); +#endif +} +inline _LIBCPP_INLINE_VISIBILITY long double acos(long double __lcpp_x) _NOEXCEPT { +#if __has_builtin(__builtin_acosl) + return __builtin_acosl(__lcpp_x); +#else + return ::acosl(__lcpp_x); +#endif +} # endif template inline _LIBCPP_INLINE_VISIBILITY typename std::enable_if::value, double>::type -acos(_A1 __lcpp_x) _NOEXCEPT {return ::acos((double)__lcpp_x);} +acos(_A1 __lcpp_x) _NOEXCEPT { +#if __has_builtin(__builtin_acos) + return __builtin_acos((double)__lcpp_x); +#else + return ::acos((double)__lcpp_x); +#endif +} // asin # if !defined(__sun__) -inline _LIBCPP_INLINE_VISIBILITY float asin(float __lcpp_x) _NOEXCEPT {return ::asinf(__lcpp_x);} -inline _LIBCPP_INLINE_VISIBILITY long double asin(long double __lcpp_x) _NOEXCEPT {return ::asinl(__lcpp_x);} +inline _LIBCPP_INLINE_VISIBILITY float asin(float __lcpp_x) _NOEXCEPT { +#if __has_builtin(__builtin_asinf) + return __builtin_asinf(__lcpp_x); +#else + return ::asinf(__lcpp_x); +#endif +} +inline _LIBCPP_INLINE_VISIBILITY long double asin(long double __lcpp_x) _NOEXCEPT { +#if __has_builtin(__builtin_asinl) + return __builtin_asinl(__lcpp_x); +#else + return ::asinl(__lcpp_x); +#endif +} # endif template inline _LIBCPP_INLINE_VISIBILITY typename std::enable_if::value, double>::type -asin(_A1 __lcpp_x) _NOEXCEPT {return ::asin((double)__lcpp_x);} +asin(_A1 __lcpp_x) _NOEXCEPT { +#if __has_builtin(__builtin_asin) + return __builtin_asin((double)__lcpp_x); +#else + return ::asin((double)__lcpp_x); +#endif +} // atan # if !defined(__sun__) -inline _LIBCPP_INLINE_VISIBILITY float atan(float __lcpp_x) _NOEXCEPT {return ::atanf(__lcpp_x);} -inline _LIBCPP_INLINE_VISIBILITY long double atan(long double __lcpp_x) _NOEXCEPT {return ::atanl(__lcpp_x);} +inline _LIBCPP_INLINE_VISIBILITY float atan(float __lcpp_x) _NOEXCEPT { +#if __has_builtin(__builtin_atanf) + return __builtin_atanf(__lcpp_x); +#else + return ::atanf(__lcpp_x); +#endif +} +inline _LIBCPP_INLINE_VISIBILITY long double atan(long double __lcpp_x) _NOEXCEPT { +#if __has_builtin(__builtin_atanl) + return __builtin_atanl(__lcpp_x); +#else + return ::atanl(__lcpp_x); +#endif +} # endif template inline _LIBCPP_INLINE_VISIBILITY typename std::enable_if::value, double>::type -atan(_A1 __lcpp_x) _NOEXCEPT {return ::atan((double)__lcpp_x);} +atan(_A1 __lcpp_x) _NOEXCEPT { +#if __has_builtin(__builtin_atan) + return __builtin_atan((double)__lcpp_x); +#else + return ::atan((double)__lcpp_x); +#endif +} // atan2 # if !defined(__sun__) -inline _LIBCPP_INLINE_VISIBILITY float atan2(float __lcpp_y, float __lcpp_x) _NOEXCEPT {return ::atan2f(__lcpp_y, __lcpp_x);} -inline _LIBCPP_INLINE_VISIBILITY long double atan2(long double __lcpp_y, long double __lcpp_x) _NOEXCEPT {return ::atan2l(__lcpp_y, __lcpp_x);} +inline _LIBCPP_INLINE_VISIBILITY float atan2(float __lcpp_y, float __lcpp_x) _NOEXCEPT { +#if __has_builtin(__builtin_atan2f) + return __builtin_atan2f(__lcpp_y, __lcpp_x); +#else + return ::atan2f(__lcpp_y, __lcpp_x); +#endif +} +inline _LIBCPP_INLINE_VISIBILITY long double atan2(long double __lcpp_y, long double __lcpp_x) _NOEXCEPT { +#if __has_builtin(__builtin_atan2l) + return __builtin_atan2l(__lcpp_y, __lcpp_x); +#else + return ::atan2l(__lcpp_y, __lcpp_x); +#endif +} # endif template @@ -849,80 +915,200 @@ // ceil # if !defined(__sun__) -inline _LIBCPP_INLINE_VISIBILITY float ceil(float __lcpp_x) _NOEXCEPT {return ::ceilf(__lcpp_x);} -inline _LIBCPP_INLINE_VISIBILITY long double ceil(long double __lcpp_x) _NOEXCEPT {return ::ceill(__lcpp_x);} +inline _LIBCPP_INLINE_VISIBILITY float ceil(float __lcpp_x) _NOEXCEPT { +#if __has_builtin(__builtin_ceilf) + return __builtin_ceilf(__lcpp_x); +#else + return ::ceilf(__lcpp_x); +#endif +} +inline _LIBCPP_INLINE_VISIBILITY long double ceil(long double __lcpp_x) _NOEXCEPT { +#if __has_builtin(__builtin_ceill) + return __builtin_ceill(__lcpp_x); +#else + return ::ceill(__lcpp_x); +#endif +} # endif template inline _LIBCPP_INLINE_VISIBILITY typename std::enable_if::value, double>::type -ceil(_A1 __lcpp_x) _NOEXCEPT {return ::ceil((double)__lcpp_x);} +ceil(_A1 __lcpp_x) _NOEXCEPT { +#if __has_builtin(__builtin_ceil) + return __builtin_ceil((double)__lcpp_x); +#else + return ::ceil((double)__lcpp_x); +#endif +} // cos # if !defined(__sun__) -inline _LIBCPP_INLINE_VISIBILITY float cos(float __lcpp_x) _NOEXCEPT {return ::cosf(__lcpp_x);} -inline _LIBCPP_INLINE_VISIBILITY long double cos(long double __lcpp_x) _NOEXCEPT {return ::cosl(__lcpp_x);} +inline _LIBCPP_INLINE_VISIBILITY float cos(float __lcpp_x) _NOEXCEPT { +#if __has_builtin(__builtin_cosf) + return __builtin_cosf(__lcpp_x); +#else + return ::cosf(__lcpp_x); +#endif +} +inline _LIBCPP_INLINE_VISIBILITY long double cos(long double __lcpp_x) _NOEXCEPT { +#if __has_builtin(__builtin_cosl) + return __builtin_cosl(__lcpp_x); +#else + return ::cosl(__lcpp_x); +#endif +} # endif template inline _LIBCPP_INLINE_VISIBILITY typename std::enable_if::value, double>::type -cos(_A1 __lcpp_x) _NOEXCEPT {return ::cos((double)__lcpp_x);} +cos(_A1 __lcpp_x) _NOEXCEPT { +#if __has_builtin(__builtin_cos) + return __builtin_cos((double)__lcpp_x); +#else + return ::cos((double)__lcpp_x); +#endif +} // cosh # if !defined(__sun__) -inline _LIBCPP_INLINE_VISIBILITY float cosh(float __lcpp_x) _NOEXCEPT {return ::coshf(__lcpp_x);} -inline _LIBCPP_INLINE_VISIBILITY long double cosh(long double __lcpp_x) _NOEXCEPT {return ::coshl(__lcpp_x);} +inline _LIBCPP_INLINE_VISIBILITY float cosh(float __lcpp_x) _NOEXCEPT { +#if __has_builtin(__builtin_coshf) + return __builtin_coshf(__lcpp_x); +#else + return ::coshf(__lcpp_x); +#endif +} +inline _LIBCPP_INLINE_VISIBILITY long double cosh(long double __lcpp_x) _NOEXCEPT { +#if __has_builtin(__builtin_coshl) + return __builtin_coshl(__lcpp_x); +#else + return ::coshl(__lcpp_x); +#endif +} # endif template inline _LIBCPP_INLINE_VISIBILITY typename std::enable_if::value, double>::type -cosh(_A1 __lcpp_x) _NOEXCEPT {return ::cosh((double)__lcpp_x);} +cosh(_A1 __lcpp_x) _NOEXCEPT { +#if __has_builtin(__builtin_cosh) + return __builtin_cosh((double)__lcpp_x); +#else + return ::cosh((double)__lcpp_x); +#endif +} // exp # if !defined(__sun__) -inline _LIBCPP_INLINE_VISIBILITY float exp(float __lcpp_x) _NOEXCEPT {return ::expf(__lcpp_x);} -inline _LIBCPP_INLINE_VISIBILITY long double exp(long double __lcpp_x) _NOEXCEPT {return ::expl(__lcpp_x);} +inline _LIBCPP_INLINE_VISIBILITY float exp(float __lcpp_x) _NOEXCEPT { +#if __has_builtin(__builtin_expf) + return __builtin_expf(__lcpp_x); +#else + return ::expf(__lcpp_x); +#endif +} +inline _LIBCPP_INLINE_VISIBILITY long double exp(long double __lcpp_x) _NOEXCEPT { +#if __has_builtin(__builtin_expl) + return __builtin_expl(__lcpp_x); +#else + return ::expl(__lcpp_x); +#endif +} # endif template inline _LIBCPP_INLINE_VISIBILITY typename std::enable_if::value, double>::type -exp(_A1 __lcpp_x) _NOEXCEPT {return ::exp((double)__lcpp_x);} +exp(_A1 __lcpp_x) _NOEXCEPT { +#if __has_builtin(__builtin_exp) + return __builtin_exp((double)__lcpp_x); +#else + return ::exp((double)__lcpp_x); +#endif +} // fabs # if !defined(__sun__) -inline _LIBCPP_INLINE_VISIBILITY float fabs(float __lcpp_x) _NOEXCEPT {return ::fabsf(__lcpp_x);} -inline _LIBCPP_INLINE_VISIBILITY long double fabs(long double __lcpp_x) _NOEXCEPT {return ::fabsl(__lcpp_x);} +inline _LIBCPP_INLINE_VISIBILITY float fabs(float __lcpp_x) _NOEXCEPT { +#if __has_builtin(__builtin_fabsf) + return __builtin_fabsf(__lcpp_x); +#else + return ::fabsf(__lcpp_x); +#endif +} +inline _LIBCPP_INLINE_VISIBILITY long double fabs(long double __lcpp_x) _NOEXCEPT { +#if __has_builtin(__builtin_fabsl) + return __builtin_fabsl(__lcpp_x); +#else + return ::fabsl(__lcpp_x); +#endif +} # endif template inline _LIBCPP_INLINE_VISIBILITY typename std::enable_if::value, double>::type -fabs(_A1 __lcpp_x) _NOEXCEPT {return ::fabs((double)__lcpp_x);} +fabs(_A1 __lcpp_x) _NOEXCEPT { +#if __has_builtin(__builtin_fabs) + return __builtin_fabs((double)__lcpp_x); +#else + return ::fabs((double)__lcpp_x); +#endif +} // floor # if !defined(__sun__) -inline _LIBCPP_INLINE_VISIBILITY float floor(float __lcpp_x) _NOEXCEPT {return ::floorf(__lcpp_x);} -inline _LIBCPP_INLINE_VISIBILITY long double floor(long double __lcpp_x) _NOEXCEPT {return ::floorl(__lcpp_x);} +inline _LIBCPP_INLINE_VISIBILITY float floor(float __lcpp_x) _NOEXCEPT { +#if __has_builtin(__builtin_floorf) + return __builtin_floorf(__lcpp_x); +#else + return ::floorf(__lcpp_x); +#endif +} +inline _LIBCPP_INLINE_VISIBILITY long double floor(long double __lcpp_x) _NOEXCEPT { +#if __has_builtin(__builtin_floorl) + return __builtin_floorl(__lcpp_x); +#else + return ::floorl(__lcpp_x); +#endif +} # endif template inline _LIBCPP_INLINE_VISIBILITY typename std::enable_if::value, double>::type -floor(_A1 __lcpp_x) _NOEXCEPT {return ::floor((double)__lcpp_x);} +floor(_A1 __lcpp_x) _NOEXCEPT { +#if __has_builtin(__builtin_floor) + return __builtin_floor((double)__lcpp_x); +#else + return ::floor((double)__lcpp_x); +#endif +} // fmod # if !defined(__sun__) -inline _LIBCPP_INLINE_VISIBILITY float fmod(float __lcpp_x, float __lcpp_y) _NOEXCEPT {return ::fmodf(__lcpp_x, __lcpp_y);} -inline _LIBCPP_INLINE_VISIBILITY long double fmod(long double __lcpp_x, long double __lcpp_y) _NOEXCEPT {return ::fmodl(__lcpp_x, __lcpp_y);} +inline _LIBCPP_INLINE_VISIBILITY float fmod(float __lcpp_x, float __lcpp_y) _NOEXCEPT { +#if __has_builtin(__builtin_fmodf) + return __builtin_fmodf(__lcpp_x, __lcpp_y); +#else + return ::fmodf(__lcpp_x, __lcpp_y); +#endif +} +inline _LIBCPP_INLINE_VISIBILITY long double fmod(long double __lcpp_x, long double __lcpp_y) _NOEXCEPT { +#if __has_builtin(__builtin_fmodl) + return __builtin_fmodl(__lcpp_x, __lcpp_y); +#else + return ::fmodl(__lcpp_x, __lcpp_y); +#endif +} # endif template @@ -944,63 +1130,159 @@ // frexp # if !defined(__sun__) -inline _LIBCPP_INLINE_VISIBILITY float frexp(float __lcpp_x, int* __lcpp_e) _NOEXCEPT {return ::frexpf(__lcpp_x, __lcpp_e);} -inline _LIBCPP_INLINE_VISIBILITY long double frexp(long double __lcpp_x, int* __lcpp_e) _NOEXCEPT {return ::frexpl(__lcpp_x, __lcpp_e);} +inline _LIBCPP_INLINE_VISIBILITY float frexp(float __lcpp_x, int* __lcpp_e) _NOEXCEPT { +#if __has_builtin(__builtin_frexpf) + return __builtin_frexpf(__lcpp_x, __lcpp_e); +#else + return ::frexpf(__lcpp_x, __lcpp_e); +#endif +} +inline _LIBCPP_INLINE_VISIBILITY long double frexp(long double __lcpp_x, int* __lcpp_e) _NOEXCEPT { +#if __has_builtin(__builtin_frexpl) + return __builtin_frexpl(__lcpp_x, __lcpp_e); +#else + return ::frexpl(__lcpp_x, __lcpp_e); +#endif +} # endif template inline _LIBCPP_INLINE_VISIBILITY typename std::enable_if::value, double>::type -frexp(_A1 __lcpp_x, int* __lcpp_e) _NOEXCEPT {return ::frexp((double)__lcpp_x, __lcpp_e);} +frexp(_A1 __lcpp_x, int* __lcpp_e) _NOEXCEPT { +#if __has_builtin(__builtin_frexp) + return __builtin_frexp((double)__lcpp_x, __lcpp_e); +#else + return ::frexp((double)__lcpp_x, __lcpp_e); +#endif +} // ldexp # if !defined(__sun__) -inline _LIBCPP_INLINE_VISIBILITY float ldexp(float __lcpp_x, int __lcpp_e) _NOEXCEPT {return ::ldexpf(__lcpp_x, __lcpp_e);} -inline _LIBCPP_INLINE_VISIBILITY long double ldexp(long double __lcpp_x, int __lcpp_e) _NOEXCEPT {return ::ldexpl(__lcpp_x, __lcpp_e);} +inline _LIBCPP_INLINE_VISIBILITY float ldexp(float __lcpp_x, int __lcpp_e) _NOEXCEPT { +#if __has_builtin(__builtin_ldexpf) + return __builtin_ldexpf(__lcpp_x, __lcpp_e); +#else + return ::ldexpf(__lcpp_x, __lcpp_e); +#endif +} +inline _LIBCPP_INLINE_VISIBILITY long double ldexp(long double __lcpp_x, int __lcpp_e) _NOEXCEPT { +#if __has_builtin(__builtin_ldexpl) + return __builtin_ldexpl(__lcpp_x, __lcpp_e); +#else + return ::ldexpl(__lcpp_x, __lcpp_e); +#endif +} # endif template inline _LIBCPP_INLINE_VISIBILITY typename std::enable_if::value, double>::type -ldexp(_A1 __lcpp_x, int __lcpp_e) _NOEXCEPT {return ::ldexp((double)__lcpp_x, __lcpp_e);} +ldexp(_A1 __lcpp_x, int __lcpp_e) _NOEXCEPT { +#if __has_builtin(__builtin_ldexp) + return __builtin_ldexp((double)__lcpp_x, __lcpp_e); +#else + return ::ldexp((double)__lcpp_x, __lcpp_e); +#endif +} // log # if !defined(__sun__) -inline _LIBCPP_INLINE_VISIBILITY float log(float __lcpp_x) _NOEXCEPT {return ::logf(__lcpp_x);} -inline _LIBCPP_INLINE_VISIBILITY long double log(long double __lcpp_x) _NOEXCEPT {return ::logl(__lcpp_x);} +inline _LIBCPP_INLINE_VISIBILITY float log(float __lcpp_x) _NOEXCEPT { +#if __has_builtin(__builtin_logf) + return __builtin_logf(__lcpp_x); +#else + return ::logf(__lcpp_x); +#endif +} +inline _LIBCPP_INLINE_VISIBILITY long double log(long double __lcpp_x) _NOEXCEPT { +#if __has_builtin(__builtin_logl) + return __builtin_logl(__lcpp_x); +#else + return ::logl(__lcpp_x); +#endif +} # endif template inline _LIBCPP_INLINE_VISIBILITY typename std::enable_if::value, double>::type -log(_A1 __lcpp_x) _NOEXCEPT {return ::log((double)__lcpp_x);} +log(_A1 __lcpp_x) _NOEXCEPT { +#if __has_builtin(__builtin_log) + return __builtin_log((double)__lcpp_x); +#else + return ::log((double)__lcpp_x); +#endif +} // log10 # if !defined(__sun__) -inline _LIBCPP_INLINE_VISIBILITY float log10(float __lcpp_x) _NOEXCEPT {return ::log10f(__lcpp_x);} -inline _LIBCPP_INLINE_VISIBILITY long double log10(long double __lcpp_x) _NOEXCEPT {return ::log10l(__lcpp_x);} +inline _LIBCPP_INLINE_VISIBILITY float log10(float __lcpp_x) _NOEXCEPT { +#if __has_builtin(__builtin_log10f) + return __builtin_log10f(__lcpp_x); +#else + return ::log10f(__lcpp_x); +#endif +} +inline _LIBCPP_INLINE_VISIBILITY long double log10(long double __lcpp_x) _NOEXCEPT { +#if __has_builtin(__builtin_log10l) + return __builtin_log10l(__lcpp_x); +#else + return ::log10l(__lcpp_x); +#endif +} # endif template inline _LIBCPP_INLINE_VISIBILITY typename std::enable_if::value, double>::type -log10(_A1 __lcpp_x) _NOEXCEPT {return ::log10((double)__lcpp_x);} +log10(_A1 __lcpp_x) _NOEXCEPT { +#if __has_builtin(__builtin_log10) + return __builtin_log10((double)__lcpp_x); +#else + return ::log10((double)__lcpp_x); +#endif +} // modf # if !defined(__sun__) -inline _LIBCPP_INLINE_VISIBILITY float modf(float __lcpp_x, float* __lcpp_y) _NOEXCEPT {return ::modff(__lcpp_x, __lcpp_y);} -inline _LIBCPP_INLINE_VISIBILITY long double modf(long double __lcpp_x, long double* __lcpp_y) _NOEXCEPT {return ::modfl(__lcpp_x, __lcpp_y);} +inline _LIBCPP_INLINE_VISIBILITY float modf(float __lcpp_x, float* __lcpp_y) _NOEXCEPT { +#if __has_builtin(__builtin_modff) + return __builtin_modff(__lcpp_x, __lcpp_y); +#else + return ::modff(__lcpp_x, __lcpp_y); +#endif +} +inline _LIBCPP_INLINE_VISIBILITY long double modf(long double __lcpp_x, long double* __lcpp_y) _NOEXCEPT { +#if __has_builtin(__builtin_modfl) + return __builtin_modfl(__lcpp_x, __lcpp_y); +#else + return ::modfl(__lcpp_x, __lcpp_y); +#endif +} # endif // pow # if !defined(__sun__) -inline _LIBCPP_INLINE_VISIBILITY float pow(float __lcpp_x, float __lcpp_y) _NOEXCEPT {return ::powf(__lcpp_x, __lcpp_y);} -inline _LIBCPP_INLINE_VISIBILITY long double pow(long double __lcpp_x, long double __lcpp_y) _NOEXCEPT {return ::powl(__lcpp_x, __lcpp_y);} +inline _LIBCPP_INLINE_VISIBILITY float pow(float __lcpp_x, float __lcpp_y) _NOEXCEPT { +#if __has_builtin(__builtin_powf) + return __builtin_powf(__lcpp_x, __lcpp_y); +#else + return ::powf(__lcpp_x, __lcpp_y); +#endif +} +inline _LIBCPP_INLINE_VISIBILITY long double pow(long double __lcpp_x, long double __lcpp_y) _NOEXCEPT { +#if __has_builtin(__builtin_powl) + return __builtin_powl(__lcpp_x, __lcpp_y); +#else + return ::powl(__lcpp_x, __lcpp_y); +#endif +} # endif template @@ -1022,102 +1304,264 @@ // sin # if !defined(__sun__) -inline _LIBCPP_INLINE_VISIBILITY float sin(float __lcpp_x) _NOEXCEPT {return ::sinf(__lcpp_x);} -inline _LIBCPP_INLINE_VISIBILITY long double sin(long double __lcpp_x) _NOEXCEPT {return ::sinl(__lcpp_x);} +inline _LIBCPP_INLINE_VISIBILITY float sin(float __lcpp_x) _NOEXCEPT { +#if __has_builtin(__builtin_sinf) + return __builtin_sinf(__lcpp_x); +#else + return ::sinf(__lcpp_x); +#endif +} +inline _LIBCPP_INLINE_VISIBILITY long double sin(long double __lcpp_x) _NOEXCEPT { +#if __has_builtin(__builtin_sinl) + return __builtin_sinl(__lcpp_x); +#else + return ::sinl(__lcpp_x); +#endif +} #endif template inline _LIBCPP_INLINE_VISIBILITY typename std::enable_if::value, double>::type -sin(_A1 __lcpp_x) _NOEXCEPT {return ::sin((double)__lcpp_x);} +sin(_A1 __lcpp_x) _NOEXCEPT { +#if __has_builtin(__builtin_sin) + return __builtin_sin((double)__lcpp_x); +#else + return ::sin((double)__lcpp_x); +#endif +} // sinh # if !defined(__sun__) -inline _LIBCPP_INLINE_VISIBILITY float sinh(float __lcpp_x) _NOEXCEPT {return ::sinhf(__lcpp_x);} -inline _LIBCPP_INLINE_VISIBILITY long double sinh(long double __lcpp_x) _NOEXCEPT {return ::sinhl(__lcpp_x);} +inline _LIBCPP_INLINE_VISIBILITY float sinh(float __lcpp_x) _NOEXCEPT { +#if __has_builtin(__builtin_sinhf) + return __builtin_sinhf(__lcpp_x); +#else + return ::sinhf(__lcpp_x); +#endif +} +inline _LIBCPP_INLINE_VISIBILITY long double sinh(long double __lcpp_x) _NOEXCEPT { +#if __has_builtin(__builtin_sinhl) + return __builtin_sinhl(__lcpp_x); +#else + return ::sinhl(__lcpp_x); +#endif +} # endif template inline _LIBCPP_INLINE_VISIBILITY typename std::enable_if::value, double>::type -sinh(_A1 __lcpp_x) _NOEXCEPT {return ::sinh((double)__lcpp_x);} +sinh(_A1 __lcpp_x) _NOEXCEPT { +#if __has_builtin(__builtin_sinh) + return __builtin_sinh((double)__lcpp_x); +#else + return ::sinh((double)__lcpp_x); +#endif +} // sqrt # if !defined(__sun__) -inline _LIBCPP_INLINE_VISIBILITY float sqrt(float __lcpp_x) _NOEXCEPT {return ::sqrtf(__lcpp_x);} -inline _LIBCPP_INLINE_VISIBILITY long double sqrt(long double __lcpp_x) _NOEXCEPT {return ::sqrtl(__lcpp_x);} +inline _LIBCPP_INLINE_VISIBILITY float sqrt(float __lcpp_x) _NOEXCEPT { +#if __has_builtin(__builtin_sqrtf) + return __builtin_sqrtf(__lcpp_x); +#else + return ::sqrtf(__lcpp_x); +#endif +} +inline _LIBCPP_INLINE_VISIBILITY long double sqrt(long double __lcpp_x) _NOEXCEPT { +#if __has_builtin(__builtin_sqrtl) + return __builtin_sqrtl(__lcpp_x); +#else + return ::sqrtl(__lcpp_x); +#endif +} # endif template inline _LIBCPP_INLINE_VISIBILITY typename std::enable_if::value, double>::type -sqrt(_A1 __lcpp_x) _NOEXCEPT {return ::sqrt((double)__lcpp_x);} +sqrt(_A1 __lcpp_x) _NOEXCEPT { +#if __has_builtin(__builtin_sqrt) + return __builtin_sqrt((double)__lcpp_x); +#else + return ::sqrt((double)__lcpp_x); +#endif +} // tan # if !defined(__sun__) -inline _LIBCPP_INLINE_VISIBILITY float tan(float __lcpp_x) _NOEXCEPT {return ::tanf(__lcpp_x);} -inline _LIBCPP_INLINE_VISIBILITY long double tan(long double __lcpp_x) _NOEXCEPT {return ::tanl(__lcpp_x);} +inline _LIBCPP_INLINE_VISIBILITY float tan(float __lcpp_x) _NOEXCEPT { +#if __has_builtin(__builtin_tanf) + return __builtin_tanf(__lcpp_x); +#else + return ::tanf(__lcpp_x); +#endif +} +inline _LIBCPP_INLINE_VISIBILITY long double tan(long double __lcpp_x) _NOEXCEPT { +#if __has_builtin(__builtin_tanl) + return __builtin_tanl(__lcpp_x); +#else + return ::tanl(__lcpp_x); +#endif +} # endif template inline _LIBCPP_INLINE_VISIBILITY typename std::enable_if::value, double>::type -tan(_A1 __lcpp_x) _NOEXCEPT {return ::tan((double)__lcpp_x);} +tan(_A1 __lcpp_x) _NOEXCEPT { +#if __has_builtin(__builtin_tan) + return __builtin_tan((double)__lcpp_x); +#else + return ::tan((double)__lcpp_x); +#endif +} // tanh # if !defined(__sun__) -inline _LIBCPP_INLINE_VISIBILITY float tanh(float __lcpp_x) _NOEXCEPT {return ::tanhf(__lcpp_x);} -inline _LIBCPP_INLINE_VISIBILITY long double tanh(long double __lcpp_x) _NOEXCEPT {return ::tanhl(__lcpp_x);} +inline _LIBCPP_INLINE_VISIBILITY float tanh(float __lcpp_x) _NOEXCEPT { +#if __has_builtin(__builtin_tanhf) + return __builtin_tanhf(__lcpp_x); +#else + return ::tanhf(__lcpp_x); +#endif +} +inline _LIBCPP_INLINE_VISIBILITY long double tanh(long double __lcpp_x) _NOEXCEPT { +#if __has_builtin(__builtin_tanhl) + return __builtin_tanhl(__lcpp_x); +#else + return ::tanhl(__lcpp_x); +#endif +} # endif template inline _LIBCPP_INLINE_VISIBILITY typename std::enable_if::value, double>::type -tanh(_A1 __lcpp_x) _NOEXCEPT {return ::tanh((double)__lcpp_x);} +tanh(_A1 __lcpp_x) _NOEXCEPT { +#if __has_builtin(__builtin_tanh) + return __builtin_tanh((double)__lcpp_x); +#else + return ::tanh((double)__lcpp_x); +#endif +} // acosh -inline _LIBCPP_INLINE_VISIBILITY float acosh(float __lcpp_x) _NOEXCEPT {return ::acoshf(__lcpp_x);} -inline _LIBCPP_INLINE_VISIBILITY long double acosh(long double __lcpp_x) _NOEXCEPT {return ::acoshl(__lcpp_x);} +inline _LIBCPP_INLINE_VISIBILITY float acosh(float __lcpp_x) _NOEXCEPT { +#if __has_builtin(__builtin_acoshf) + return __builtin_acoshf(__lcpp_x); +#else + return ::acoshf(__lcpp_x); +#endif +} +inline _LIBCPP_INLINE_VISIBILITY long double acosh(long double __lcpp_x) _NOEXCEPT { +#if __has_builtin(__builtin_acoshl) + return __builtin_acoshl(__lcpp_x); +#else + return ::acoshl(__lcpp_x); +#endif +} template inline _LIBCPP_INLINE_VISIBILITY typename std::enable_if::value, double>::type -acosh(_A1 __lcpp_x) _NOEXCEPT {return ::acosh((double)__lcpp_x);} +acosh(_A1 __lcpp_x) _NOEXCEPT { +#if __has_builtin(__builtin_acosh) + return __builtin_acosh((double)__lcpp_x); +#else + return ::acosh((double)__lcpp_x); +#endif +} // asinh -inline _LIBCPP_INLINE_VISIBILITY float asinh(float __lcpp_x) _NOEXCEPT {return ::asinhf(__lcpp_x);} -inline _LIBCPP_INLINE_VISIBILITY long double asinh(long double __lcpp_x) _NOEXCEPT {return ::asinhl(__lcpp_x);} +inline _LIBCPP_INLINE_VISIBILITY float asinh(float __lcpp_x) _NOEXCEPT { +#if __has_builtin(__builtin_asinhf) + return __builtin_asinhf(__lcpp_x); +#else + return ::asinhf(__lcpp_x); +#endif +} +inline _LIBCPP_INLINE_VISIBILITY long double asinh(long double __lcpp_x) _NOEXCEPT { +#if __has_builtin(__builtin_asinhl) + return __builtin_asinhl(__lcpp_x); +#else + return ::asinhl(__lcpp_x); +#endif +} template inline _LIBCPP_INLINE_VISIBILITY typename std::enable_if::value, double>::type -asinh(_A1 __lcpp_x) _NOEXCEPT {return ::asinh((double)__lcpp_x);} +asinh(_A1 __lcpp_x) _NOEXCEPT { +#if __has_builtin(__builtin_asinh) + return __builtin_asinh((double)__lcpp_x); +#else + return ::asinh((double)__lcpp_x); +#endif +} // atanh -inline _LIBCPP_INLINE_VISIBILITY float atanh(float __lcpp_x) _NOEXCEPT {return ::atanhf(__lcpp_x);} -inline _LIBCPP_INLINE_VISIBILITY long double atanh(long double __lcpp_x) _NOEXCEPT {return ::atanhl(__lcpp_x);} +inline _LIBCPP_INLINE_VISIBILITY float atanh(float __lcpp_x) _NOEXCEPT { +#if __has_builtin(__builtin_atanhf) + return __builtin_atanhf(__lcpp_x); +#else + return ::atanhf(__lcpp_x); +#endif +} +inline _LIBCPP_INLINE_VISIBILITY long double atanh(long double __lcpp_x) _NOEXCEPT { +#if __has_builtin(__builtin_atanhl) + return __builtin_atanhl(__lcpp_x); +#else + return ::atanhl(__lcpp_x); +#endif +} template inline _LIBCPP_INLINE_VISIBILITY typename std::enable_if::value, double>::type -atanh(_A1 __lcpp_x) _NOEXCEPT {return ::atanh((double)__lcpp_x);} +atanh(_A1 __lcpp_x) _NOEXCEPT { +#if __has_builtin(__builtin_atanh) + return __builtin_atanh((double)__lcpp_x); +#else + return ::atanh((double)__lcpp_x); +#endif +} // cbrt -inline _LIBCPP_INLINE_VISIBILITY float cbrt(float __lcpp_x) _NOEXCEPT {return ::cbrtf(__lcpp_x);} -inline _LIBCPP_INLINE_VISIBILITY long double cbrt(long double __lcpp_x) _NOEXCEPT {return ::cbrtl(__lcpp_x);} +inline _LIBCPP_INLINE_VISIBILITY float cbrt(float __lcpp_x) _NOEXCEPT { +#if __has_builtin(__builtin_cbrtf) + return __builtin_cbrtf(__lcpp_x); +#else + return ::cbrtf(__lcpp_x); +#endif +} +inline _LIBCPP_INLINE_VISIBILITY long double cbrt(long double __lcpp_x) _NOEXCEPT { +#if __has_builtin(__builtin_cbrtl) + return __builtin_cbrtl(__lcpp_x); +#else + return ::cbrtl(__lcpp_x); +#endif +} template inline _LIBCPP_INLINE_VISIBILITY typename std::enable_if::value, double>::type -cbrt(_A1 __lcpp_x) _NOEXCEPT {return ::cbrt((double)__lcpp_x);} +cbrt(_A1 __lcpp_x) _NOEXCEPT { +#if __has_builtin(__builtin_cbrt) + return __builtin_cbrt((double)__lcpp_x); +#else + return ::cbrt((double)__lcpp_x); +#endif +} // copysign @@ -1198,48 +1642,132 @@ // erf -inline _LIBCPP_INLINE_VISIBILITY float erf(float __lcpp_x) _NOEXCEPT {return ::erff(__lcpp_x);} -inline _LIBCPP_INLINE_VISIBILITY long double erf(long double __lcpp_x) _NOEXCEPT {return ::erfl(__lcpp_x);} +inline _LIBCPP_INLINE_VISIBILITY float erf(float __lcpp_x) _NOEXCEPT { +#if __has_builtin(__builtin_erff) + return __builtin_erff(__lcpp_x); +#else + return ::erff(__lcpp_x); +#endif +} +inline _LIBCPP_INLINE_VISIBILITY long double erf(long double __lcpp_x) _NOEXCEPT { +#if __has_builtin(__builtin_erfl) + return __builtin_erfl(__lcpp_x); +#else + return ::erfl(__lcpp_x); +#endif +} template inline _LIBCPP_INLINE_VISIBILITY typename std::enable_if::value, double>::type -erf(_A1 __lcpp_x) _NOEXCEPT {return ::erf((double)__lcpp_x);} +erf(_A1 __lcpp_x) _NOEXCEPT { +#if __has_builtin(__builtin_erf) + return __builtin_erf((double)__lcpp_x); +#else + return ::erf((double)__lcpp_x); +#endif +} // erfc -inline _LIBCPP_INLINE_VISIBILITY float erfc(float __lcpp_x) _NOEXCEPT {return ::erfcf(__lcpp_x);} -inline _LIBCPP_INLINE_VISIBILITY long double erfc(long double __lcpp_x) _NOEXCEPT {return ::erfcl(__lcpp_x);} +inline _LIBCPP_INLINE_VISIBILITY float erfc(float __lcpp_x) _NOEXCEPT { +#if __has_builtin(__builtin_erfcf) + return __builtin_erfcf(__lcpp_x); +#else + return ::erfcf(__lcpp_x); +#endif +} +inline _LIBCPP_INLINE_VISIBILITY long double erfc(long double __lcpp_x) _NOEXCEPT { +#if __has_builtin(__builtin_erfcl) + return __builtin_erfcl(__lcpp_x); +#else + return ::erfcl(__lcpp_x); +#endif +} template inline _LIBCPP_INLINE_VISIBILITY typename std::enable_if::value, double>::type -erfc(_A1 __lcpp_x) _NOEXCEPT {return ::erfc((double)__lcpp_x);} +erfc(_A1 __lcpp_x) _NOEXCEPT { +#if __has_builtin(__builtin_erfc) + return __builtin_erfc((double)__lcpp_x); +#else + return ::erfc((double)__lcpp_x); +#endif +} // exp2 -inline _LIBCPP_INLINE_VISIBILITY float exp2(float __lcpp_x) _NOEXCEPT {return ::exp2f(__lcpp_x);} -inline _LIBCPP_INLINE_VISIBILITY long double exp2(long double __lcpp_x) _NOEXCEPT {return ::exp2l(__lcpp_x);} +inline _LIBCPP_INLINE_VISIBILITY float exp2(float __lcpp_x) _NOEXCEPT { +#if __has_builtin(__builtin_exp2f) + return __builtin_exp2f(__lcpp_x); +#else + return ::exp2f(__lcpp_x); +#endif +} +inline _LIBCPP_INLINE_VISIBILITY long double exp2(long double __lcpp_x) _NOEXCEPT { +#if __has_builtin(__builtin_exp2l) + return __builtin_exp2l(__lcpp_x); +#else + return ::exp2l(__lcpp_x); +#endif +} template inline _LIBCPP_INLINE_VISIBILITY typename std::enable_if::value, double>::type -exp2(_A1 __lcpp_x) _NOEXCEPT {return ::exp2((double)__lcpp_x);} +exp2(_A1 __lcpp_x) _NOEXCEPT { +#if __has_builtin(__builtin_exp2) + return __builtin_exp2((double)__lcpp_x); +#else + return ::exp2((double)__lcpp_x); +#endif +} // expm1 -inline _LIBCPP_INLINE_VISIBILITY float expm1(float __lcpp_x) _NOEXCEPT {return ::expm1f(__lcpp_x);} -inline _LIBCPP_INLINE_VISIBILITY long double expm1(long double __lcpp_x) _NOEXCEPT {return ::expm1l(__lcpp_x);} +inline _LIBCPP_INLINE_VISIBILITY float expm1(float __lcpp_x) _NOEXCEPT { +#if __has_builtin(__builtin_expm1f) + return __builtin_expm1f(__lcpp_x); +#else + return ::expm1f(__lcpp_x); +#endif +} +inline _LIBCPP_INLINE_VISIBILITY long double expm1(long double __lcpp_x) _NOEXCEPT { +#if __has_builtin(__builtin_expm1l) + return __builtin_expm1l(__lcpp_x); +#else + return ::expm1l(__lcpp_x); +#endif +} template inline _LIBCPP_INLINE_VISIBILITY typename std::enable_if::value, double>::type -expm1(_A1 __lcpp_x) _NOEXCEPT {return ::expm1((double)__lcpp_x);} +expm1(_A1 __lcpp_x) _NOEXCEPT { +#if __has_builtin(__builtin_expm1) + return __builtin_expm1((double)__lcpp_x); +#else + return ::expm1((double)__lcpp_x); +#endif +} // fdim -inline _LIBCPP_INLINE_VISIBILITY float fdim(float __lcpp_x, float __lcpp_y) _NOEXCEPT {return ::fdimf(__lcpp_x, __lcpp_y);} -inline _LIBCPP_INLINE_VISIBILITY long double fdim(long double __lcpp_x, long double __lcpp_y) _NOEXCEPT {return ::fdiml(__lcpp_x, __lcpp_y);} +inline _LIBCPP_INLINE_VISIBILITY float fdim(float __lcpp_x, float __lcpp_y) _NOEXCEPT { +#if __has_builtin(__builtin_fdimf) + return __builtin_fdimf(__lcpp_x, __lcpp_y); +#else + return ::fdimf(__lcpp_x, __lcpp_y); +#endif +} +inline _LIBCPP_INLINE_VISIBILITY long double fdim(long double __lcpp_x, long double __lcpp_y) _NOEXCEPT { +#if __has_builtin(__builtin_fdiml) + return __builtin_fdiml(__lcpp_x, __lcpp_y); +#else + return ::fdiml(__lcpp_x, __lcpp_y); +#endif +} template inline _LIBCPP_INLINE_VISIBILITY @@ -1259,7 +1787,7 @@ // fma -inline _LIBCPP_INLINE_VISIBILITY float fma(float __lcpp_x, float __lcpp_y, float __lcpp_z) _NOEXCEPT +inline _LIBCPP_INLINE_VISIBILITY float fma(float __lcpp_x, float __lcpp_y, float __lcpp_z) _NOEXCEPT { #if __has_builtin(__builtin_fmaf) return __builtin_fmaf(__lcpp_x, __lcpp_y, __lcpp_z); @@ -1300,8 +1828,20 @@ // fmax -inline _LIBCPP_INLINE_VISIBILITY float fmax(float __lcpp_x, float __lcpp_y) _NOEXCEPT {return ::fmaxf(__lcpp_x, __lcpp_y);} -inline _LIBCPP_INLINE_VISIBILITY long double fmax(long double __lcpp_x, long double __lcpp_y) _NOEXCEPT {return ::fmaxl(__lcpp_x, __lcpp_y);} +inline _LIBCPP_INLINE_VISIBILITY float fmax(float __lcpp_x, float __lcpp_y) _NOEXCEPT { +#if __has_builtin(__builtin_fmaxf) + return __builtin_fmaxf(__lcpp_x, __lcpp_y); +#else + return ::fmaxf(__lcpp_x, __lcpp_y); +#endif +} +inline _LIBCPP_INLINE_VISIBILITY long double fmax(long double __lcpp_x, long double __lcpp_y) _NOEXCEPT { +#if __has_builtin(__builtin_fmaxl) + return __builtin_fmaxl(__lcpp_x, __lcpp_y); +#else + return ::fmaxl(__lcpp_x, __lcpp_y); +#endif +} template inline _LIBCPP_INLINE_VISIBILITY @@ -1321,8 +1861,20 @@ // fmin -inline _LIBCPP_INLINE_VISIBILITY float fmin(float __lcpp_x, float __lcpp_y) _NOEXCEPT {return ::fminf(__lcpp_x, __lcpp_y);} -inline _LIBCPP_INLINE_VISIBILITY long double fmin(long double __lcpp_x, long double __lcpp_y) _NOEXCEPT {return ::fminl(__lcpp_x, __lcpp_y);} +inline _LIBCPP_INLINE_VISIBILITY float fmin(float __lcpp_x, float __lcpp_y) _NOEXCEPT { +#if __has_builtin(__builtin_fminf) + return __builtin_fminf(__lcpp_x, __lcpp_y); +#else + return ::fminf(__lcpp_x, __lcpp_y); +#endif +} +inline _LIBCPP_INLINE_VISIBILITY long double fmin(long double __lcpp_x, long double __lcpp_y) _NOEXCEPT { +#if __has_builtin(__builtin_fminl) + return __builtin_fminl(__lcpp_x, __lcpp_y); +#else + return ::fminl(__lcpp_x, __lcpp_y); +#endif +} template inline _LIBCPP_INLINE_VISIBILITY @@ -1342,8 +1894,20 @@ // hypot -inline _LIBCPP_INLINE_VISIBILITY float hypot(float __lcpp_x, float __lcpp_y) _NOEXCEPT {return ::hypotf(__lcpp_x, __lcpp_y);} -inline _LIBCPP_INLINE_VISIBILITY long double hypot(long double __lcpp_x, long double __lcpp_y) _NOEXCEPT {return ::hypotl(__lcpp_x, __lcpp_y);} +inline _LIBCPP_INLINE_VISIBILITY float hypot(float __lcpp_x, float __lcpp_y) _NOEXCEPT { +#if __has_builtin(__builtin_hypotf) + return __builtin_hypotf(__lcpp_x, __lcpp_y); +#else + return ::hypotf(__lcpp_x, __lcpp_y); +#endif +} +inline _LIBCPP_INLINE_VISIBILITY long double hypot(long double __lcpp_x, long double __lcpp_y) _NOEXCEPT { +#if __has_builtin(__builtin_hypotl) + return __builtin_hypotl(__lcpp_x, __lcpp_y); +#else + return ::hypotl(__lcpp_x, __lcpp_y); +#endif +} template inline _LIBCPP_INLINE_VISIBILITY @@ -1363,23 +1927,59 @@ // ilogb -inline _LIBCPP_INLINE_VISIBILITY int ilogb(float __lcpp_x) _NOEXCEPT {return ::ilogbf(__lcpp_x);} -inline _LIBCPP_INLINE_VISIBILITY int ilogb(long double __lcpp_x) _NOEXCEPT {return ::ilogbl(__lcpp_x);} +inline _LIBCPP_INLINE_VISIBILITY int ilogb(float __lcpp_x) _NOEXCEPT { +#if __has_builtin(__builtin_ilogbf) + return __builtin_ilogbf(__lcpp_x); +#else + return ::ilogbf(__lcpp_x); +#endif +} +inline _LIBCPP_INLINE_VISIBILITY int ilogb(long double __lcpp_x) _NOEXCEPT { +#if __has_builtin(__builtin_ilogbl) + return __builtin_ilogbl(__lcpp_x); +#else + return ::ilogbl(__lcpp_x); +#endif +} template inline _LIBCPP_INLINE_VISIBILITY typename std::enable_if::value, int>::type -ilogb(_A1 __lcpp_x) _NOEXCEPT {return ::ilogb((double)__lcpp_x);} +ilogb(_A1 __lcpp_x) _NOEXCEPT { +#if __has_builtin(__builtin_ilogb) + return __builtin_ilogb((double)__lcpp_x); +#else + return ::ilogb((double)__lcpp_x); +#endif +} // lgamma -inline _LIBCPP_INLINE_VISIBILITY float lgamma(float __lcpp_x) _NOEXCEPT {return ::lgammaf(__lcpp_x);} -inline _LIBCPP_INLINE_VISIBILITY long double lgamma(long double __lcpp_x) _NOEXCEPT {return ::lgammal(__lcpp_x);} +inline _LIBCPP_INLINE_VISIBILITY float lgamma(float __lcpp_x) _NOEXCEPT { +#if __has_builtin(__builtin_lgammaf) + return __builtin_lgammaf(__lcpp_x); +#else + return ::lgammaf(__lcpp_x); +#endif +} +inline _LIBCPP_INLINE_VISIBILITY long double lgamma(long double __lcpp_x) _NOEXCEPT { +#if __has_builtin(__builtin_lgammal) + return __builtin_lgammal(__lcpp_x); +#else + return ::lgammal(__lcpp_x); +#endif +} template inline _LIBCPP_INLINE_VISIBILITY typename std::enable_if::value, double>::type -lgamma(_A1 __lcpp_x) _NOEXCEPT {return ::lgamma((double)__lcpp_x);} +lgamma(_A1 __lcpp_x) _NOEXCEPT { +#if __has_builtin(__builtin_lgamma) + return __builtin_lgamma((double)__lcpp_x); +#else + return ::lgamma((double)__lcpp_x); +#endif +} // llrint @@ -1445,33 +2045,87 @@ // log1p -inline _LIBCPP_INLINE_VISIBILITY float log1p(float __lcpp_x) _NOEXCEPT {return ::log1pf(__lcpp_x);} -inline _LIBCPP_INLINE_VISIBILITY long double log1p(long double __lcpp_x) _NOEXCEPT {return ::log1pl(__lcpp_x);} +inline _LIBCPP_INLINE_VISIBILITY float log1p(float __lcpp_x) _NOEXCEPT { +#if __has_builtin(__builtin_log1pf) + return __builtin_log1pf(__lcpp_x); +#else + return ::log1pf(__lcpp_x); +#endif +} +inline _LIBCPP_INLINE_VISIBILITY long double log1p(long double __lcpp_x) _NOEXCEPT { +#if __has_builtin(__builtin_log1pl) + return __builtin_log1pl(__lcpp_x); +#else + return ::log1pl(__lcpp_x); +#endif +} template inline _LIBCPP_INLINE_VISIBILITY typename std::enable_if::value, double>::type -log1p(_A1 __lcpp_x) _NOEXCEPT {return ::log1p((double)__lcpp_x);} +log1p(_A1 __lcpp_x) _NOEXCEPT { +#if __has_builtin(__builtin_log1p) + return __builtin_log1p((double)__lcpp_x); +#else + return ::log1p((double)__lcpp_x); +#endif +} // log2 -inline _LIBCPP_INLINE_VISIBILITY float log2(float __lcpp_x) _NOEXCEPT {return ::log2f(__lcpp_x);} -inline _LIBCPP_INLINE_VISIBILITY long double log2(long double __lcpp_x) _NOEXCEPT {return ::log2l(__lcpp_x);} +inline _LIBCPP_INLINE_VISIBILITY float log2(float __lcpp_x) _NOEXCEPT { +#if __has_builtin(__builtin_log2f) + return __builtin_log2f(__lcpp_x); +#else + return ::log2f(__lcpp_x); +#endif +} +inline _LIBCPP_INLINE_VISIBILITY long double log2(long double __lcpp_x) _NOEXCEPT { +#if __has_builtin(__builtin_log2l) + return __builtin_log2l(__lcpp_x); +#else + return ::log2l(__lcpp_x); +#endif +} template inline _LIBCPP_INLINE_VISIBILITY typename std::enable_if::value, double>::type -log2(_A1 __lcpp_x) _NOEXCEPT {return ::log2((double)__lcpp_x);} +log2(_A1 __lcpp_x) _NOEXCEPT { +#if __has_builtin(__builtin_log2) + return __builtin_log2((double)__lcpp_x); +#else + return ::log2((double)__lcpp_x); +#endif +} // logb -inline _LIBCPP_INLINE_VISIBILITY float logb(float __lcpp_x) _NOEXCEPT {return ::logbf(__lcpp_x);} -inline _LIBCPP_INLINE_VISIBILITY long double logb(long double __lcpp_x) _NOEXCEPT {return ::logbl(__lcpp_x);} +inline _LIBCPP_INLINE_VISIBILITY float logb(float __lcpp_x) _NOEXCEPT { +#if __has_builtin(__builtin_logbf) + return __builtin_logbf(__lcpp_x); +#else + return ::logbf(__lcpp_x); +#endif +} +inline _LIBCPP_INLINE_VISIBILITY long double logb(long double __lcpp_x) _NOEXCEPT { +#if __has_builtin(__builtin_logbl) + return __builtin_logbl(__lcpp_x); +#else + return ::logbl(__lcpp_x); +#endif +} template inline _LIBCPP_INLINE_VISIBILITY typename std::enable_if::value, double>::type -logb(_A1 __lcpp_x) _NOEXCEPT {return ::logb((double)__lcpp_x);} +logb(_A1 __lcpp_x) _NOEXCEPT { +#if __has_builtin(__builtin_logb) + return __builtin_logb((double)__lcpp_x); +#else + return ::logb((double)__lcpp_x); +#endif +} // lrint @@ -1539,18 +2193,48 @@ // nearbyint -inline _LIBCPP_INLINE_VISIBILITY float nearbyint(float __lcpp_x) _NOEXCEPT {return ::nearbyintf(__lcpp_x);} -inline _LIBCPP_INLINE_VISIBILITY long double nearbyint(long double __lcpp_x) _NOEXCEPT {return ::nearbyintl(__lcpp_x);} +inline _LIBCPP_INLINE_VISIBILITY float nearbyint(float __lcpp_x) _NOEXCEPT { +#if __has_builtin(__builtin_nearbyintf) + return __builtin_nearbyintf(__lcpp_x); +#else + return ::nearbyintf(__lcpp_x); +#endif +} +inline _LIBCPP_INLINE_VISIBILITY long double nearbyint(long double __lcpp_x) _NOEXCEPT { +#if __has_builtin(__builtin_nearbyintl) + return __builtin_nearbyintl(__lcpp_x); +#else + return ::nearbyintl(__lcpp_x); +#endif +} template inline _LIBCPP_INLINE_VISIBILITY typename std::enable_if::value, double>::type -nearbyint(_A1 __lcpp_x) _NOEXCEPT {return ::nearbyint((double)__lcpp_x);} +nearbyint(_A1 __lcpp_x) _NOEXCEPT { +#if __has_builtin(__builtin_nearbyint) + return __builtin_nearbyint((double)__lcpp_x); +#else + return ::nearbyint((double)__lcpp_x); +#endif +} // nextafter -inline _LIBCPP_INLINE_VISIBILITY float nextafter(float __lcpp_x, float __lcpp_y) _NOEXCEPT {return ::nextafterf(__lcpp_x, __lcpp_y);} -inline _LIBCPP_INLINE_VISIBILITY long double nextafter(long double __lcpp_x, long double __lcpp_y) _NOEXCEPT {return ::nextafterl(__lcpp_x, __lcpp_y);} +inline _LIBCPP_INLINE_VISIBILITY float nextafter(float __lcpp_x, float __lcpp_y) _NOEXCEPT { +#if __has_builtin(__builtin_nextafterf) + return __builtin_nextafterf(__lcpp_x, __lcpp_y); +#else + return ::nextafterf(__lcpp_x, __lcpp_y); +#endif +} +inline _LIBCPP_INLINE_VISIBILITY long double nextafter(long double __lcpp_x, long double __lcpp_y) _NOEXCEPT { +#if __has_builtin(__builtin_nextafterl) + return __builtin_nextafterl(__lcpp_x, __lcpp_y); +#else + return ::nextafterl(__lcpp_x, __lcpp_y); +#endif +} template inline _LIBCPP_INLINE_VISIBILITY @@ -1570,18 +2254,48 @@ // nexttoward -inline _LIBCPP_INLINE_VISIBILITY float nexttoward(float __lcpp_x, long double __lcpp_y) _NOEXCEPT {return ::nexttowardf(__lcpp_x, __lcpp_y);} -inline _LIBCPP_INLINE_VISIBILITY long double nexttoward(long double __lcpp_x, long double __lcpp_y) _NOEXCEPT {return ::nexttowardl(__lcpp_x, __lcpp_y);} +inline _LIBCPP_INLINE_VISIBILITY float nexttoward(float __lcpp_x, long double __lcpp_y) _NOEXCEPT { +#if __has_builtin(__builtin_nexttowardf) + return __builtin_nexttowardf(__lcpp_x, __lcpp_y); +#else + return ::nexttowardf(__lcpp_x, __lcpp_y); +#endif +} +inline _LIBCPP_INLINE_VISIBILITY long double nexttoward(long double __lcpp_x, long double __lcpp_y) _NOEXCEPT { +#if __has_builtin(__builtin_nexttowardl) + return __builtin_nexttowardl(__lcpp_x, __lcpp_y); +#else + return ::nexttowardl(__lcpp_x, __lcpp_y); +#endif +} template inline _LIBCPP_INLINE_VISIBILITY typename std::enable_if::value, double>::type -nexttoward(_A1 __lcpp_x, long double __lcpp_y) _NOEXCEPT {return ::nexttoward((double)__lcpp_x, __lcpp_y);} +nexttoward(_A1 __lcpp_x, long double __lcpp_y) _NOEXCEPT { +#if __has_builtin(__builtin_nexttoward) + return __builtin_nexttoward((double)__lcpp_x, __lcpp_y); +#else + return ::nexttoward((double)__lcpp_x, __lcpp_y); +#endif +} // remainder -inline _LIBCPP_INLINE_VISIBILITY float remainder(float __lcpp_x, float __lcpp_y) _NOEXCEPT {return ::remainderf(__lcpp_x, __lcpp_y);} -inline _LIBCPP_INLINE_VISIBILITY long double remainder(long double __lcpp_x, long double __lcpp_y) _NOEXCEPT {return ::remainderl(__lcpp_x, __lcpp_y);} +inline _LIBCPP_INLINE_VISIBILITY float remainder(float __lcpp_x, float __lcpp_y) _NOEXCEPT { +#if __has_builtin(__builtin_remainderf) + return __builtin_remainderf(__lcpp_x, __lcpp_y); +#else + return ::remainderf(__lcpp_x, __lcpp_y); +#endif +} +inline _LIBCPP_INLINE_VISIBILITY long double remainder(long double __lcpp_x, long double __lcpp_y) _NOEXCEPT { +#if __has_builtin(__builtin_remainderl) + return __builtin_remainderl(__lcpp_x, __lcpp_y); +#else + return ::remainderl(__lcpp_x, __lcpp_y); +#endif +} template inline _LIBCPP_INLINE_VISIBILITY @@ -1601,8 +2315,20 @@ // remquo -inline _LIBCPP_INLINE_VISIBILITY float remquo(float __lcpp_x, float __lcpp_y, int* __lcpp_z) _NOEXCEPT {return ::remquof(__lcpp_x, __lcpp_y, __lcpp_z);} -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);} +inline _LIBCPP_INLINE_VISIBILITY float remquo(float __lcpp_x, float __lcpp_y, int* __lcpp_z) _NOEXCEPT { +#if __has_builtin(__builtin_remquof) + return __builtin_remquof(__lcpp_x, __lcpp_y, __lcpp_z); +#else + return ::remquof(__lcpp_x, __lcpp_y, __lcpp_z); +#endif +} +inline _LIBCPP_INLINE_VISIBILITY long double remquo(long double __lcpp_x, long double __lcpp_y, int* __lcpp_z) _NOEXCEPT { +#if __has_builtin(__builtin_remquol) + return __builtin_remquol(__lcpp_x, __lcpp_y, __lcpp_z); +#else + return ::remquol(__lcpp_x, __lcpp_y, __lcpp_z); +#endif +} template inline _LIBCPP_INLINE_VISIBILITY @@ -1622,7 +2348,7 @@ // rint -inline _LIBCPP_INLINE_VISIBILITY float rint(float __lcpp_x) _NOEXCEPT +inline _LIBCPP_INLINE_VISIBILITY float rint(float __lcpp_x) _NOEXCEPT { #if __has_builtin(__builtin_rintf) return __builtin_rintf(__lcpp_x); @@ -1653,7 +2379,7 @@ // round -inline _LIBCPP_INLINE_VISIBILITY float round(float __lcpp_x) _NOEXCEPT +inline _LIBCPP_INLINE_VISIBILITY float round(float __lcpp_x) _NOEXCEPT { #if __has_builtin(__builtin_round) return __builtin_round(__lcpp_x); @@ -1684,37 +2410,91 @@ // scalbln -inline _LIBCPP_INLINE_VISIBILITY float scalbln(float __lcpp_x, long __lcpp_y) _NOEXCEPT {return ::scalblnf(__lcpp_x, __lcpp_y);} -inline _LIBCPP_INLINE_VISIBILITY long double scalbln(long double __lcpp_x, long __lcpp_y) _NOEXCEPT {return ::scalblnl(__lcpp_x, __lcpp_y);} +inline _LIBCPP_INLINE_VISIBILITY float scalbln(float __lcpp_x, long __lcpp_y) _NOEXCEPT { +#if __has_builtin(__builtin_scalblnf) + return __builtin_scalblnf(__lcpp_x, __lcpp_y); +#else + return ::scalblnf(__lcpp_x, __lcpp_y); +#endif +} +inline _LIBCPP_INLINE_VISIBILITY long double scalbln(long double __lcpp_x, long __lcpp_y) _NOEXCEPT { +#if __has_builtin(__builtin_scalblnl) + return __builtin_scalblnl(__lcpp_x, __lcpp_y); +#else + return ::scalblnl(__lcpp_x, __lcpp_y); +#endif +} template inline _LIBCPP_INLINE_VISIBILITY typename std::enable_if::value, double>::type -scalbln(_A1 __lcpp_x, long __lcpp_y) _NOEXCEPT {return ::scalbln((double)__lcpp_x, __lcpp_y);} +scalbln(_A1 __lcpp_x, long __lcpp_y) _NOEXCEPT { +#if __has_builtin(__builtin_scalbln) + return __builtin_scalbln((double)__lcpp_x, __lcpp_y); +#else + return ::scalbln((double)__lcpp_x, __lcpp_y); +#endif +} // scalbn -inline _LIBCPP_INLINE_VISIBILITY float scalbn(float __lcpp_x, int __lcpp_y) _NOEXCEPT {return ::scalbnf(__lcpp_x, __lcpp_y);} -inline _LIBCPP_INLINE_VISIBILITY long double scalbn(long double __lcpp_x, int __lcpp_y) _NOEXCEPT {return ::scalbnl(__lcpp_x, __lcpp_y);} +inline _LIBCPP_INLINE_VISIBILITY float scalbn(float __lcpp_x, int __lcpp_y) _NOEXCEPT { +#if __has_builtin(__builtin_scalbnf) + return __builtin_scalbnf(__lcpp_x, __lcpp_y); +#else + return ::scalbnf(__lcpp_x, __lcpp_y); +#endif +} +inline _LIBCPP_INLINE_VISIBILITY long double scalbn(long double __lcpp_x, int __lcpp_y) _NOEXCEPT { +#if __has_builtin(__builtin_scalbnl) + return __builtin_scalbnl(__lcpp_x, __lcpp_y); +#else + return ::scalbnl(__lcpp_x, __lcpp_y); +#endif +} template inline _LIBCPP_INLINE_VISIBILITY typename std::enable_if::value, double>::type -scalbn(_A1 __lcpp_x, int __lcpp_y) _NOEXCEPT {return ::scalbn((double)__lcpp_x, __lcpp_y);} +scalbn(_A1 __lcpp_x, int __lcpp_y) _NOEXCEPT { +#if __has_builtin(__builtin_scalbn) + return __builtin_scalbn((double)__lcpp_x, __lcpp_y); +#else + return ::scalbn((double)__lcpp_x, __lcpp_y); +#endif +} // tgamma -inline _LIBCPP_INLINE_VISIBILITY float tgamma(float __lcpp_x) _NOEXCEPT {return ::tgammaf(__lcpp_x);} -inline _LIBCPP_INLINE_VISIBILITY long double tgamma(long double __lcpp_x) _NOEXCEPT {return ::tgammal(__lcpp_x);} +inline _LIBCPP_INLINE_VISIBILITY float tgamma(float __lcpp_x) _NOEXCEPT { +#if __has_builtin(__builtin_tgammaf) + return __builtin_tgammaf(__lcpp_x); +#else + return ::tgammaf(__lcpp_x); +#endif +} +inline _LIBCPP_INLINE_VISIBILITY long double tgamma(long double __lcpp_x) _NOEXCEPT { +#if __has_builtin(__builtin_tgammal) + return __builtin_tgammal(__lcpp_x); +#else + return ::tgammal(__lcpp_x); +#endif +} template inline _LIBCPP_INLINE_VISIBILITY typename std::enable_if::value, double>::type -tgamma(_A1 __lcpp_x) _NOEXCEPT {return ::tgamma((double)__lcpp_x);} +tgamma(_A1 __lcpp_x) _NOEXCEPT { +#if __has_builtin(__builtin_tgamma) + return __builtin_tgamma((double)__lcpp_x); +#else + return ::tgamma((double)__lcpp_x); +#endif +} // trunc -inline _LIBCPP_INLINE_VISIBILITY float trunc(float __lcpp_x) _NOEXCEPT +inline _LIBCPP_INLINE_VISIBILITY float trunc(float __lcpp_x) _NOEXCEPT { #if __has_builtin(__builtin_trunc) return __builtin_trunc(__lcpp_x);