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