Changeset View
Changeset View
Standalone View
Standalone View
libcxx/include/complex
Show First 20 Lines • Show All 1,041 Lines • ▼ Show 20 Lines | sqrt(const complex<_Tp>& __x) | ||||
if (__libcpp_isinf_or_builtin(__x.imag())) | if (__libcpp_isinf_or_builtin(__x.imag())) | ||||
return complex<_Tp>(_Tp(INFINITY), __x.imag()); | return complex<_Tp>(_Tp(INFINITY), __x.imag()); | ||||
if (__libcpp_isinf_or_builtin(__x.real())) | if (__libcpp_isinf_or_builtin(__x.real())) | ||||
{ | { | ||||
if (__x.real() > _Tp(0)) | 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>(__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>(__libcpp_isnan_or_builtin(__x.imag()) ? __x.imag() : _Tp(0), copysign(__x.real(), __x.imag())); | ||||
} | } | ||||
return polar(sqrt(abs(__x)), arg(__x) / _Tp(2)); | return std::polar(std::sqrt(std::abs(__x)), std::arg(__x) / _Tp(2)); | ||||
} | } | ||||
// exp | // exp | ||||
template<class _Tp> | template<class _Tp> | ||||
_LIBCPP_HIDE_FROM_ABI complex<_Tp> | _LIBCPP_HIDE_FROM_ABI complex<_Tp> | ||||
exp(const complex<_Tp>& __x) | exp(const complex<_Tp>& __x) | ||||
{ | { | ||||
▲ Show 20 Lines • Show All 437 Lines • Show Last 20 Lines |