diff --git a/libcxx/include/math.h b/libcxx/include/math.h --- a/libcxx/include/math.h +++ b/libcxx/include/math.h @@ -299,487 +299,168 @@ #include_next -#ifdef __cplusplus - -// We support including .h headers inside 'extern "C"' contexts, so switch -// back to C++ linkage before including these C++ headers. -extern "C++" { - -#include <__type_traits/promote.h> -#include -#include -#include - -_LIBCPP_BEGIN_NAMESPACE_STD - -// signbit - #ifdef signbit - -template -_LIBCPP_HIDE_FROM_ABI -bool -__libcpp_signbit(_A1 __x) _NOEXCEPT -{ -#if __has_builtin(__builtin_signbit) - return __builtin_signbit(__x); -#else - return signbit(__x); +# undef signbit #endif -} - -#undef signbit - -template -inline _LIBCPP_HIDE_FROM_ABI -typename enable_if::value, bool>::type -signbit(_A1 __x) _NOEXCEPT -{ - return __libcpp_signbit((typename __promote<_A1>::type)__x); -} - -template -inline _LIBCPP_HIDE_FROM_ABI -typename enable_if< - is_integral<_A1>::value && is_signed<_A1>::value, bool>::type -signbit(_A1 __x) _NOEXCEPT -{ return __x < 0; } - -template -inline _LIBCPP_HIDE_FROM_ABI -typename enable_if< - is_integral<_A1>::value && !is_signed<_A1>::value, bool>::type -signbit(_A1) _NOEXCEPT -{ return false; } - -#elif defined(_LIBCPP_MSVCRT) - -template -inline _LIBCPP_HIDE_FROM_ABI -typename enable_if::value, bool>::type -signbit(_A1 __x) _NOEXCEPT -{ - return ::signbit(static_cast::type>(__x)); -} - -template -inline _LIBCPP_HIDE_FROM_ABI -typename enable_if< - is_integral<_A1>::value && is_signed<_A1>::value, bool>::type -signbit(_A1 __x) _NOEXCEPT -{ return __x < 0; } - -template -inline _LIBCPP_HIDE_FROM_ABI -typename enable_if< - is_integral<_A1>::value && !is_signed<_A1>::value, bool>::type -signbit(_A1) _NOEXCEPT -{ return false; } - -#endif // signbit - -// fpclassify #ifdef fpclassify - -template -_LIBCPP_HIDE_FROM_ABI -int -__libcpp_fpclassify(_A1 __x) _NOEXCEPT -{ -#if __has_builtin(__builtin_fpclassify) - return __builtin_fpclassify(FP_NAN, FP_INFINITE, FP_NORMAL, FP_SUBNORMAL, - FP_ZERO, __x); -#else - return fpclassify(__x); +# undef fpclassify #endif -} - -#undef fpclassify - -template -inline _LIBCPP_HIDE_FROM_ABI -typename enable_if::value, int>::type -fpclassify(_A1 __x) _NOEXCEPT -{ - return __libcpp_fpclassify((typename __promote<_A1>::type)__x); -} - -template -inline _LIBCPP_HIDE_FROM_ABI -typename enable_if::value, int>::type -fpclassify(_A1 __x) _NOEXCEPT -{ return __x == 0 ? FP_ZERO : FP_NORMAL; } - -#elif defined(_LIBCPP_MSVCRT) - -template -inline _LIBCPP_HIDE_FROM_ABI -typename enable_if::value, bool>::type -fpclassify(_A1 __x) _NOEXCEPT -{ - return ::fpclassify(static_cast::type>(__x)); -} - -template -inline _LIBCPP_HIDE_FROM_ABI -typename enable_if::value, int>::type -fpclassify(_A1 __x) _NOEXCEPT -{ return __x == 0 ? FP_ZERO : FP_NORMAL; } - -#endif // fpclassify - -// isfinite #ifdef isfinite - -template -_LIBCPP_HIDE_FROM_ABI -bool -__libcpp_isfinite(_A1 __x) _NOEXCEPT -{ -#if __has_builtin(__builtin_isfinite) - return __builtin_isfinite(__x); -#else - return isfinite(__x); +# undef isfinite #endif -} - -#undef isfinite - -template -inline _LIBCPP_HIDE_FROM_ABI -typename enable_if< - is_arithmetic<_A1>::value && numeric_limits<_A1>::has_infinity, - bool>::type -isfinite(_A1 __x) _NOEXCEPT -{ - return __libcpp_isfinite((typename __promote<_A1>::type)__x); -} - -template -inline _LIBCPP_HIDE_FROM_ABI -typename enable_if< - is_arithmetic<_A1>::value && !numeric_limits<_A1>::has_infinity, - bool>::type -isfinite(_A1) _NOEXCEPT -{ return true; } - -#endif // isfinite - -// isinf #ifdef isinf - -template -_LIBCPP_HIDE_FROM_ABI -bool -__libcpp_isinf(_A1 __x) _NOEXCEPT -{ -#if __has_builtin(__builtin_isinf) - return __builtin_isinf(__x); -#else - return isinf(__x); +# undef isinf #endif -} - -#undef isinf -template -inline _LIBCPP_HIDE_FROM_ABI -typename enable_if< - is_arithmetic<_A1>::value && numeric_limits<_A1>::has_infinity, - bool>::type -isinf(_A1 __x) _NOEXCEPT -{ - return __libcpp_isinf((typename __promote<_A1>::type)__x); -} - -template -inline _LIBCPP_HIDE_FROM_ABI -typename enable_if< - is_arithmetic<_A1>::value && !numeric_limits<_A1>::has_infinity, - bool>::type -isinf(_A1) _NOEXCEPT -{ return false; } - -#ifdef _LIBCPP_PREFERRED_OVERLOAD -inline _LIBCPP_HIDE_FROM_ABI -bool -isinf(float __x) _NOEXCEPT { return __libcpp_isinf(__x); } - -inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_PREFERRED_OVERLOAD -bool -isinf(double __x) _NOEXCEPT { return __libcpp_isinf(__x); } - -inline _LIBCPP_HIDE_FROM_ABI -bool -isinf(long double __x) _NOEXCEPT { return __libcpp_isinf(__x); } +#ifdef isnan +# undef isnan #endif -#endif // isinf - -// isnan - -#ifdef isnan +#ifdef isnormal +# undef isnormal +#endif -template -_LIBCPP_HIDE_FROM_ABI -bool -__libcpp_isnan(_A1 __x) _NOEXCEPT -{ -#if __has_builtin(__builtin_isnan) - return __builtin_isnan(__x); -#else - return isnan(__x); +#ifdef isless +# undef isless #endif -} -#undef isnan +#ifdef islessequal +# undef islessequal +#endif -template -inline _LIBCPP_HIDE_FROM_ABI -typename enable_if::value, bool>::type -isnan(_A1 __x) _NOEXCEPT -{ - return __libcpp_isnan((typename __promote<_A1>::type)__x); -} +#ifdef islessgreater +# undef islessgreater +#endif -template -inline _LIBCPP_HIDE_FROM_ABI -typename enable_if::value, bool>::type -isnan(_A1) _NOEXCEPT -{ return false; } +#ifdef isgreaterequal +# undef isgreaterequal +#endif -#ifdef _LIBCPP_PREFERRED_OVERLOAD -inline _LIBCPP_HIDE_FROM_ABI -bool -isnan(float __x) _NOEXCEPT { return __libcpp_isnan(__x); } +#ifdef isgreater +# undef isgreater +#endif -inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_PREFERRED_OVERLOAD -bool -isnan(double __x) _NOEXCEPT { return __libcpp_isnan(__x); } +#ifdef isunordered +# undef isunordered +#endif -inline _LIBCPP_HIDE_FROM_ABI -bool -isnan(long double __x) _NOEXCEPT { return __libcpp_isnan(__x); } +#ifdef isfinite +# undef isfinite #endif -#endif // isnan +#ifdef isinf +# undef isinf +#endif -// isnormal +#ifdef isnan +# undef isnan +#endif #ifdef isnormal - -template -_LIBCPP_HIDE_FROM_ABI -bool -__libcpp_isnormal(_A1 __x) _NOEXCEPT -{ -#if __has_builtin(__builtin_isnormal) - return __builtin_isnormal(__x); -#else - return isnormal(__x); +# undef isnormal #endif -} -#undef isnormal - -template -inline _LIBCPP_HIDE_FROM_ABI -typename enable_if::value, bool>::type -isnormal(_A1 __x) _NOEXCEPT -{ - return __libcpp_isnormal((typename __promote<_A1>::type)__x); -} - -template -inline _LIBCPP_HIDE_FROM_ABI -typename enable_if::value, bool>::type -isnormal(_A1 __x) _NOEXCEPT -{ return __x != 0; } +#ifdef __cplusplus -#endif // isnormal +// We support including .h headers inside 'extern "C"' contexts, so switch +// back to C++ linkage before including these C++ headers. +extern "C++" { -// isgreater +#include <__type_traits/promote.h> +#include +#include +#include -#ifdef isgreater +_LIBCPP_BEGIN_NAMESPACE_STD -template -_LIBCPP_HIDE_FROM_ABI -bool -__libcpp_isgreater(_A1 __x, _A2 __y) _NOEXCEPT -{ - return isgreater(__x, __y); +template ::value, int> = 0> +_LIBCPP_HIDE_FROM_ABI bool signbit(_Tp __v) _NOEXCEPT { + return __builtin_signbit(__v); } -#undef isgreater - -template -inline _LIBCPP_HIDE_FROM_ABI -typename enable_if -< - is_arithmetic<_A1>::value && - is_arithmetic<_A2>::value, - bool ->::type -isgreater(_A1 __x, _A2 __y) _NOEXCEPT -{ - typedef typename __promote<_A1, _A2>::type type; - return __libcpp_isgreater((type)__x, (type)__y); +template ::value, int> = 0> +_LIBCPP_HIDE_FROM_ABI int fpclassify(_Tp __v) _NOEXCEPT { + return __builtin_fpclassify(FP_NAN, FP_INFINITE, FP_NORMAL, FP_SUBNORMAL, FP_ZERO, __v); } -#endif // isgreater - -// isgreaterequal - -#ifdef isgreaterequal - -template -_LIBCPP_HIDE_FROM_ABI -bool -__libcpp_isgreaterequal(_A1 __x, _A2 __y) _NOEXCEPT -{ - return isgreaterequal(__x, __y); +template ::value, int> = 0> +_LIBCPP_HIDE_FROM_ABI int fpclassify(_Tp __v) _NOEXCEPT { + return __v == 0 ? FP_ZERO : FP_NORMAL; } -#undef isgreaterequal - -template -inline _LIBCPP_HIDE_FROM_ABI -typename enable_if -< - is_arithmetic<_A1>::value && - is_arithmetic<_A2>::value, - bool ->::type -isgreaterequal(_A1 __x, _A2 __y) _NOEXCEPT -{ - typedef typename __promote<_A1, _A2>::type type; - return __libcpp_isgreaterequal((type)__x, (type)__y); +template ::value && numeric_limits<_Tp>::has_infinity, int> = 0> +_LIBCPP_HIDE_FROM_ABI bool isfinite(_Tp __v) _NOEXCEPT { + return __builtin_isfinite(__v); } -#endif // isgreaterequal - -// isless - -#ifdef isless - -template -_LIBCPP_HIDE_FROM_ABI -bool -__libcpp_isless(_A1 __x, _A2 __y) _NOEXCEPT -{ - return isless(__x, __y); +template ::value && numeric_limits<_Tp>::has_infinity, int> = 0> +_LIBCPP_HIDE_FROM_ABI bool isinf(_Tp __v) _NOEXCEPT { + return __builtin_isinf(__v); } -#undef isless - -template -inline _LIBCPP_HIDE_FROM_ABI -typename enable_if -< - is_arithmetic<_A1>::value && - is_arithmetic<_A2>::value, - bool ->::type -isless(_A1 __x, _A2 __y) _NOEXCEPT -{ - typedef typename __promote<_A1, _A2>::type type; - return __libcpp_isless((type)__x, (type)__y); +template ::value && !numeric_limits<_Tp>::has_infinity, int> = 0> +_LIBCPP_HIDE_FROM_ABI bool isinf(_Tp) _NOEXCEPT { + return false; } -#endif // isless - -// islessequal - -#ifdef islessequal - -template -_LIBCPP_HIDE_FROM_ABI -bool -__libcpp_islessequal(_A1 __x, _A2 __y) _NOEXCEPT -{ - return islessequal(__x, __y); +template ::value, int> = 0> +_LIBCPP_HIDE_FROM_ABI bool isnan(_Tp __v) _NOEXCEPT { + return __builtin_isnan(__v); } -#undef islessequal - -template -inline _LIBCPP_HIDE_FROM_ABI -typename enable_if -< - is_arithmetic<_A1>::value && - is_arithmetic<_A2>::value, - bool ->::type -islessequal(_A1 __x, _A2 __y) _NOEXCEPT -{ - typedef typename __promote<_A1, _A2>::type type; - return __libcpp_islessequal((type)__x, (type)__y); +template ::value, int> = 0> +_LIBCPP_HIDE_FROM_ABI bool isnan(_Tp) _NOEXCEPT { + return false; } -#endif // islessequal - -// islessgreater - -#ifdef islessgreater - -template -_LIBCPP_HIDE_FROM_ABI -bool -__libcpp_islessgreater(_A1 __x, _A2 __y) _NOEXCEPT -{ - return islessgreater(__x, __y); +template ::value, int> = 0> +_LIBCPP_HIDE_FROM_ABI bool isnormal(_Tp __v) _NOEXCEPT { + return __builtin_isnormal(__v); } - -#undef islessgreater - -template -inline _LIBCPP_HIDE_FROM_ABI -typename enable_if -< - is_arithmetic<_A1>::value && - is_arithmetic<_A2>::value, - bool ->::type -islessgreater(_A1 __x, _A2 __y) _NOEXCEPT -{ - typedef typename __promote<_A1, _A2>::type type; - return __libcpp_islessgreater((type)__x, (type)__y); +template ::value && std::is_arithmetic<_Up>::value, int> = 0> +_LIBCPP_HIDE_FROM_ABI bool isless(_Tp __lhs, _Up __rhs) _NOEXCEPT { + return __builtin_isless(__lhs, __rhs); } -#endif // islessgreater - -// isunordered - -#ifdef isunordered +template ::value && std::is_arithmetic<_Up>::value, int> = 0> +_LIBCPP_HIDE_FROM_ABI bool islessequal(_Tp __lhs, _Up __rhs) _NOEXCEPT { + return __builtin_islessequal(__lhs, __rhs); +} -template -_LIBCPP_HIDE_FROM_ABI -bool -__libcpp_isunordered(_A1 __x, _A2 __y) _NOEXCEPT -{ - return isunordered(__x, __y); +template ::value && std::is_arithmetic<_Up>::value, int> = 0> +_LIBCPP_HIDE_FROM_ABI bool islessgreater(_Tp __lhs, _Up __rhs) _NOEXCEPT { + return __builtin_islessgreater(__lhs, __rhs); } -#undef isunordered +template ::value && std::is_arithmetic<_Up>::value, int> = 0> +_LIBCPP_HIDE_FROM_ABI bool isgreaterequal(_Tp __lhs, _Up __rhs) _NOEXCEPT { + return __builtin_isgreaterequal(__lhs, __rhs); +} -template -inline _LIBCPP_HIDE_FROM_ABI -typename enable_if -< - is_arithmetic<_A1>::value && - is_arithmetic<_A2>::value, - bool ->::type -isunordered(_A1 __x, _A2 __y) _NOEXCEPT -{ - typedef typename __promote<_A1, _A2>::type type; - return __libcpp_isunordered((type)__x, (type)__y); +template ::value && std::is_arithmetic<_Up>::value, int> = 0> +_LIBCPP_HIDE_FROM_ABI bool isgreater(_Tp __lhs, _Up __rhs) _NOEXCEPT { + return __builtin_isgreater(__lhs, __rhs); } -#endif // isunordered +template ::value && std::is_arithmetic<_Up>::value, int> = 0> +_LIBCPP_HIDE_FROM_ABI bool isunordered(_Tp __lhs, _Up __rhs) _NOEXCEPT { + return __builtin_isunordered(__lhs, __rhs); +} // abs // @@ -1149,69 +830,14 @@ // copysign -#if __has_builtin(__builtin_copysignf) -_LIBCPP_CONSTEXPR -#endif -inline _LIBCPP_HIDE_FROM_ABI float __libcpp_copysign(float __x, float __y) _NOEXCEPT { -#if __has_builtin(__builtin_copysignf) - return __builtin_copysignf(__x, __y); -#else - return ::copysignf(__x, __y); -#endif -} - -#if __has_builtin(__builtin_copysign) -_LIBCPP_CONSTEXPR -#endif -inline _LIBCPP_HIDE_FROM_ABI double __libcpp_copysign(double __x, double __y) _NOEXCEPT { -#if __has_builtin(__builtin_copysign) - return __builtin_copysign(__x, __y); -#else - return ::copysign(__x, __y); -#endif -} - -#if __has_builtin(__builtin_copysignl) -_LIBCPP_CONSTEXPR -#endif -inline _LIBCPP_HIDE_FROM_ABI long double __libcpp_copysign(long double __x, long double __y) _NOEXCEPT { -#if __has_builtin(__builtin_copysignl) - return __builtin_copysignl(__x, __y); -#else - return ::copysignl(__x, __y); -#endif -} - -template -#if __has_builtin(__builtin_copysign) -_LIBCPP_CONSTEXPR -#endif -inline _LIBCPP_HIDE_FROM_ABI -typename __enable_if_t -< - is_arithmetic<_A1>::value && - is_arithmetic<_A2>::value, - __promote<_A1, _A2> ->::type -__libcpp_copysign(_A1 __x, _A2 __y) _NOEXCEPT { - typedef typename __promote<_A1, _A2>::type __result_type; - static_assert((!(_IsSame<_A1, __result_type>::value && - _IsSame<_A2, __result_type>::value)), ""); -#if __has_builtin(__builtin_copysign) - return __builtin_copysign((__result_type)__x, (__result_type)__y); -#else - return ::copysign((__result_type)__x, (__result_type)__y); -#endif -} - inline _LIBCPP_HIDE_FROM_ABI float copysign(float __x, float __y) _NOEXCEPT { - return std::__libcpp_copysign(__x, __y); + return __builtin_copysignf(__x, __y); } using ::copysign _LIBCPP_USING_IF_EXISTS; inline _LIBCPP_HIDE_FROM_ABI long double copysign(long double __x, long double __y) _NOEXCEPT { - return std::__libcpp_copysign(__x, __y); + return __builtin_copysignl(__x, __y); } template @@ -1223,7 +849,7 @@ __promote<_A1, _A2> >::type copysign(_A1 __x, _A2 __y) _NOEXCEPT { - return __libcpp_copysign(__x, __y); + return std::copysign(__x, __y); } // erf @@ -1296,22 +922,14 @@ 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 } using ::fma _LIBCPP_USING_IF_EXISTS; inline _LIBCPP_HIDE_FROM_ABI long double fma(long double __x, long double __y, long double __z) _NOEXCEPT { -#if __has_builtin(__builtin_fmal) return __builtin_fmal(__x, __y, __z); -#else - return ::fmal(__x, __y, __z); -#endif } template @@ -1329,11 +947,7 @@ static_assert((!(_IsSame<_A1, __result_type>::value && _IsSame<_A2, __result_type>::value && _IsSame<_A3, __result_type>::value)), ""); -#if __has_builtin(__builtin_fma) return __builtin_fma((__result_type)__x, (__result_type)__y, (__result_type)__z); -#else - return ::fma((__result_type)__x, (__result_type)__y, (__result_type)__z); -#endif } // fmax @@ -1428,22 +1042,14 @@ inline _LIBCPP_HIDE_FROM_ABI long long llrint(float __x) _NOEXCEPT { -#if __has_builtin(__builtin_llrintf) return __builtin_llrintf(__x); -#else - return ::llrintf(__x); -#endif } using ::llrint _LIBCPP_USING_IF_EXISTS; inline _LIBCPP_HIDE_FROM_ABI long long llrint(long double __x) _NOEXCEPT { -#if __has_builtin(__builtin_llrintl) return __builtin_llrintl(__x); -#else - return ::llrintl(__x); -#endif } template @@ -1451,33 +1057,21 @@ typename enable_if::value, long long>::type llrint(_A1 __x) _NOEXCEPT { -#if __has_builtin(__builtin_llrint) return __builtin_llrint((double)__x); -#else - return ::llrint((double)__x); -#endif } // llround inline _LIBCPP_HIDE_FROM_ABI long long llround(float __x) _NOEXCEPT { -#if __has_builtin(__builtin_llroundf) return __builtin_llroundf(__x); -#else - return ::llroundf(__x); -#endif } using ::llround _LIBCPP_USING_IF_EXISTS; inline _LIBCPP_HIDE_FROM_ABI long long llround(long double __x) _NOEXCEPT { -#if __has_builtin(__builtin_llroundl) return __builtin_llroundl(__x); -#else - return ::llroundl(__x); -#endif } template @@ -1485,11 +1079,7 @@ typename enable_if::value, long long>::type llround(_A1 __x) _NOEXCEPT { -#if __has_builtin(__builtin_llround) return __builtin_llround((double)__x); -#else - return ::llround((double)__x); -#endif } // log1p @@ -1529,22 +1119,14 @@ inline _LIBCPP_HIDE_FROM_ABI long lrint(float __x) _NOEXCEPT { -#if __has_builtin(__builtin_lrintf) return __builtin_lrintf(__x); -#else - return ::lrintf(__x); -#endif } using ::lrint _LIBCPP_USING_IF_EXISTS; inline _LIBCPP_HIDE_FROM_ABI long lrint(long double __x) _NOEXCEPT { -#if __has_builtin(__builtin_lrintl) return __builtin_lrintl(__x); -#else - return ::lrintl(__x); -#endif } template @@ -1552,33 +1134,21 @@ typename enable_if::value, long>::type lrint(_A1 __x) _NOEXCEPT { -#if __has_builtin(__builtin_lrint) return __builtin_lrint((double)__x); -#else - return ::lrint((double)__x); -#endif } // lround inline _LIBCPP_HIDE_FROM_ABI long lround(float __x) _NOEXCEPT { -#if __has_builtin(__builtin_lroundf) return __builtin_lroundf(__x); -#else - return ::lroundf(__x); -#endif } using ::lround _LIBCPP_USING_IF_EXISTS; inline _LIBCPP_HIDE_FROM_ABI long lround(long double __x) _NOEXCEPT { -#if __has_builtin(__builtin_lroundl) return __builtin_lroundl(__x); -#else - return ::lroundl(__x); -#endif } template @@ -1586,11 +1156,7 @@ typename enable_if::value, long>::type lround(_A1 __x) _NOEXCEPT { -#if __has_builtin(__builtin_lround) return __builtin_lround((double)__x); -#else - return ::lround((double)__x); -#endif } // nan @@ -1687,22 +1253,14 @@ inline _LIBCPP_HIDE_FROM_ABI float rint(float __x) _NOEXCEPT { -#if __has_builtin(__builtin_rintf) return __builtin_rintf(__x); -#else - return ::rintf(__x); -#endif } using ::rint _LIBCPP_USING_IF_EXISTS; inline _LIBCPP_HIDE_FROM_ABI long double rint(long double __x) _NOEXCEPT { -#if __has_builtin(__builtin_rintl) return __builtin_rintl(__x); -#else - return ::rintl(__x); -#endif } template @@ -1710,33 +1268,21 @@ typename enable_if::value, double>::type rint(_A1 __x) _NOEXCEPT { -#if __has_builtin(__builtin_rint) return __builtin_rint((double)__x); -#else - return ::rint((double)__x); -#endif } // 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 + return __builtin_roundf(__x); } using ::round _LIBCPP_USING_IF_EXISTS; inline _LIBCPP_HIDE_FROM_ABI long double round(long double __x) _NOEXCEPT { -#if __has_builtin(__builtin_roundl) return __builtin_roundl(__x); -#else - return ::roundl(__x); -#endif } template @@ -1744,11 +1290,7 @@ typename enable_if::value, double>::type round(_A1 __x) _NOEXCEPT { -#if __has_builtin(__builtin_round) return __builtin_round((double)__x); -#else - return ::round((double)__x); -#endif } // scalbln @@ -1788,22 +1330,14 @@ inline _LIBCPP_HIDE_FROM_ABI float trunc(float __x) _NOEXCEPT { -#if __has_builtin(__builtin_trunc) - return __builtin_trunc(__x); -#else - return ::trunc(__x); -#endif + return __builtin_truncf(__x); } using ::trunc _LIBCPP_USING_IF_EXISTS; inline _LIBCPP_HIDE_FROM_ABI long double trunc(long double __x) _NOEXCEPT { -#if __has_builtin(__builtin_truncl) return __builtin_truncl(__x); -#else - return ::truncl(__x); -#endif } template @@ -1811,15 +1345,12 @@ typename enable_if::value, double>::type trunc(_A1 __x) _NOEXCEPT { -#if __has_builtin(__builtin_trunc) return __builtin_trunc((double)__x); -#else - return ::trunc((double)__x); -#endif } _LIBCPP_END_NAMESPACE_STD +#ifndef _LIBCPP_MSVCRT using std::signbit; using std::fpclassify; using std::isfinite; @@ -1833,6 +1364,7 @@ using std::islessgreater; using std::isunordered; using std::isunordered; +#endif // _LIBCPP_MSVCRT using std::acos; using std::asin;