Index: libcxx/include/cmath =================================================================== --- libcxx/include/cmath +++ libcxx/include/cmath @@ -550,26 +550,6 @@ } #endif -template -_LIBCPP_INLINE_VISIBILITY -_LIBCPP_CONSTEXPR typename enable_if::value, bool>::type -__libcpp_isnan_or_builtin(_A1 __lcpp_x) _NOEXCEPT -{ -#if __has_builtin(__builtin_isnan) - return __builtin_isnan(__lcpp_x); -#else - return isnan(__lcpp_x); -#endif -} - -template -_LIBCPP_INLINE_VISIBILITY -_LIBCPP_CONSTEXPR typename enable_if::value, bool>::type -__libcpp_isnan_or_builtin(_A1 __lcpp_x) _NOEXCEPT -{ - return isnan(__lcpp_x); -} - template _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR typename enable_if::value, bool>::type Index: libcxx/include/complex =================================================================== --- libcxx/include/complex +++ libcxx/include/complex @@ -599,16 +599,16 @@ _Tp __bc = __b * __c; _Tp __x = __ac - __bd; _Tp __y = __ad + __bc; - if (__libcpp_isnan_or_builtin(__x) && __libcpp_isnan_or_builtin(__y)) + if (__libcpp_isnan(__x) && __libcpp_isnan(__y)) { bool __recalc = false; if (__libcpp_isinf_or_builtin(__a) || __libcpp_isinf_or_builtin(__b)) { __a = copysign(__libcpp_isinf_or_builtin(__a) ? _Tp(1) : _Tp(0), __a); __b = copysign(__libcpp_isinf_or_builtin(__b) ? _Tp(1) : _Tp(0), __b); - if (__libcpp_isnan_or_builtin(__c)) + if (__libcpp_isnan(__c)) __c = copysign(_Tp(0), __c); - if (__libcpp_isnan_or_builtin(__d)) + if (__libcpp_isnan(__d)) __d = copysign(_Tp(0), __d); __recalc = true; } @@ -616,22 +616,22 @@ { __c = copysign(__libcpp_isinf_or_builtin(__c) ? _Tp(1) : _Tp(0), __c); __d = copysign(__libcpp_isinf_or_builtin(__d) ? _Tp(1) : _Tp(0), __d); - if (__libcpp_isnan_or_builtin(__a)) + if (__libcpp_isnan(__a)) __a = copysign(_Tp(0), __a); - if (__libcpp_isnan_or_builtin(__b)) + if (__libcpp_isnan(__b)) __b = copysign(_Tp(0), __b); __recalc = true; } if (!__recalc && (__libcpp_isinf_or_builtin(__ac) || __libcpp_isinf_or_builtin(__bd) || __libcpp_isinf_or_builtin(__ad) || __libcpp_isinf_or_builtin(__bc))) { - if (__libcpp_isnan_or_builtin(__a)) + if (__libcpp_isnan(__a)) __a = copysign(_Tp(0), __a); - if (__libcpp_isnan_or_builtin(__b)) + if (__libcpp_isnan(__b)) __b = copysign(_Tp(0), __b); - if (__libcpp_isnan_or_builtin(__c)) + if (__libcpp_isnan(__c)) __c = copysign(_Tp(0), __c); - if (__libcpp_isnan_or_builtin(__d)) + if (__libcpp_isnan(__d)) __d = copysign(_Tp(0), __d); __recalc = true; } @@ -683,9 +683,9 @@ _Tp __denom = __c * __c + __d * __d; _Tp __x = scalbn((__a * __c + __b * __d) / __denom, -__ilogbw); _Tp __y = scalbn((__b * __c - __a * __d) / __denom, -__ilogbw); - if (__libcpp_isnan_or_builtin(__x) && __libcpp_isnan_or_builtin(__y)) + if (__libcpp_isnan(__x) && __libcpp_isnan(__y)) { - if ((__denom == _Tp(0)) && (!__libcpp_isnan_or_builtin(__a) || !__libcpp_isnan_or_builtin(__b))) + if ((__denom == _Tp(0)) && (!__libcpp_isnan(__a) || !__libcpp_isnan(__b))) { __x = copysign(_Tp(INFINITY), __c) * __a; __y = copysign(_Tp(INFINITY), __c) * __b; @@ -993,9 +993,9 @@ complex<_Tp> polar(const _Tp& __rho, const _Tp& __theta = _Tp()) { - if (__libcpp_isnan_or_builtin(__rho) || signbit(__rho)) + if (__libcpp_isnan(__rho) || signbit(__rho)) return complex<_Tp>(_Tp(NAN), _Tp(NAN)); - if (__libcpp_isnan_or_builtin(__theta)) + if (__libcpp_isnan(__theta)) { if (__libcpp_isinf_or_builtin(__rho)) return complex<_Tp>(__rho, __theta); @@ -1008,10 +1008,10 @@ return complex<_Tp>(_Tp(NAN), _Tp(NAN)); } _Tp __x = __rho * cos(__theta); - if (__libcpp_isnan_or_builtin(__x)) + if (__libcpp_isnan(__x)) __x = 0; _Tp __y = __rho * sin(__theta); - if (__libcpp_isnan_or_builtin(__y)) + if (__libcpp_isnan(__y)) __y = 0; return complex<_Tp>(__x, __y); } @@ -1047,8 +1047,8 @@ if (__libcpp_isinf_or_builtin(__x.real())) { if (__x.real() > _Tp(0)) - return complex<_Tp>(__x.real(), __libcpp_isnan_or_builtin(__x.imag()) ? __x.imag() : copysign(_Tp(0), __x.imag())); - return complex<_Tp>(__libcpp_isnan_or_builtin(__x.imag()) ? __x.imag() : _Tp(0), copysign(__x.real(), __x.imag())); + return complex<_Tp>(__x.real(), __libcpp_isnan(__x.imag()) ? __x.imag() : copysign(_Tp(0), __x.imag())); + return complex<_Tp>(__libcpp_isnan(__x.imag()) ? __x.imag() : _Tp(0), copysign(__x.real(), __x.imag())); } return polar(sqrt(abs(__x)), arg(__x) / _Tp(2)); } @@ -1074,7 +1074,7 @@ return complex<_Tp>(__x.real(), __i); } } - else if (__libcpp_isnan_or_builtin(__x.real()) && __x.imag() == 0) + else if (__libcpp_isnan(__x.real()) && __x.imag() == 0) return __x; _Tp __e = exp(__x.real()); return complex<_Tp>(__e * cos(__i), __e * sin(__i)); @@ -1145,13 +1145,13 @@ const _Tp __pi(atan2(+0., -0.)); if (__libcpp_isinf_or_builtin(__x.real())) { - if (__libcpp_isnan_or_builtin(__x.imag())) + if (__libcpp_isnan(__x.imag())) return __x; if (__libcpp_isinf_or_builtin(__x.imag())) return complex<_Tp>(__x.real(), copysign(__pi * _Tp(0.25), __x.imag())); return complex<_Tp>(__x.real(), copysign(_Tp(0), __x.imag())); } - if (__libcpp_isnan_or_builtin(__x.real())) + if (__libcpp_isnan(__x.real())) { if (__libcpp_isinf_or_builtin(__x.imag())) return complex<_Tp>(__x.imag(), __x.real()); @@ -1174,7 +1174,7 @@ const _Tp __pi(atan2(+0., -0.)); if (__libcpp_isinf_or_builtin(__x.real())) { - if (__libcpp_isnan_or_builtin(__x.imag())) + if (__libcpp_isnan(__x.imag())) return complex<_Tp>(abs(__x.real()), __x.imag()); if (__libcpp_isinf_or_builtin(__x.imag())) { @@ -1187,7 +1187,7 @@ return complex<_Tp>(-__x.real(), copysign(__pi, __x.imag())); return complex<_Tp>(__x.real(), copysign(_Tp(0), __x.imag())); } - if (__libcpp_isnan_or_builtin(__x.real())) + if (__libcpp_isnan(__x.real())) { if (__libcpp_isinf_or_builtin(__x.imag())) return complex<_Tp>(abs(__x.imag()), __x.real()); @@ -1210,13 +1210,13 @@ { return complex<_Tp>(copysign(_Tp(0), __x.real()), copysign(__pi/_Tp(2), __x.imag())); } - if (__libcpp_isnan_or_builtin(__x.imag())) + if (__libcpp_isnan(__x.imag())) { if (__libcpp_isinf_or_builtin(__x.real()) || __x.real() == 0) return complex<_Tp>(copysign(_Tp(0), __x.real()), __x.imag()); return complex<_Tp>(__x.imag(), __x.imag()); } - if (__libcpp_isnan_or_builtin(__x.real())) + if (__libcpp_isnan(__x.real())) { return complex<_Tp>(__x.real(), __x.real()); } @@ -1276,7 +1276,7 @@ return complex<_Tp>(_Tp(1), _Tp(0)); return complex<_Tp>(_Tp(1), copysign(_Tp(0), sin(_Tp(2) * __x.imag()))); } - if (__libcpp_isnan_or_builtin(__x.real()) && __x.imag() == 0) + if (__libcpp_isnan(__x.real()) && __x.imag() == 0) return __x; _Tp __2r(_Tp(2) * __x.real()); _Tp __2i(_Tp(2) * __x.imag()); @@ -1307,7 +1307,7 @@ const _Tp __pi(atan2(+0., -0.)); if (__libcpp_isinf_or_builtin(__x.real())) { - if (__libcpp_isnan_or_builtin(__x.imag())) + if (__libcpp_isnan(__x.imag())) return complex<_Tp>(__x.imag(), __x.real()); if (__libcpp_isinf_or_builtin(__x.imag())) { @@ -1319,7 +1319,7 @@ return complex<_Tp>(__pi, signbit(__x.imag()) ? -__x.real() : __x.real()); return complex<_Tp>(_Tp(0), signbit(__x.imag()) ? __x.real() : -__x.real()); } - if (__libcpp_isnan_or_builtin(__x.real())) + if (__libcpp_isnan(__x.real())) { if (__libcpp_isinf_or_builtin(__x.imag())) return complex<_Tp>(__x.real(), -__x.imag()); Index: libcxx/test/libcxx/numerics/c.math/constexpr-fns.pass.cpp =================================================================== --- libcxx/test/libcxx/numerics/c.math/constexpr-fns.pass.cpp +++ libcxx/test/libcxx/numerics/c.math/constexpr-fns.pass.cpp @@ -24,9 +24,9 @@ #include "test_macros.h" -static_assert(std::__libcpp_isnan_or_builtin(0.) == false, ""); -static_assert(std::__libcpp_isinf_or_builtin(0.0) == false, ""); -static_assert(std::__libcpp_isfinite_or_builtin(0.0) == true, ""); +static_assert(std::__libcpp_isnan(0.) == false, ""); +static_assert(std::__libcpp_isinf(0.0) == false, ""); +static_assert(std::__libcpp_isfinite(0.0) == true, ""); int main(int, char**) {