File tree Expand file tree Collapse file tree 1 file changed +13
-8
lines changed Expand file tree Collapse file tree 1 file changed +13
-8
lines changed Original file line number Diff line number Diff line change @@ -1059,16 +1059,21 @@ inline _LIBCPP_HIDE_FROM_ABI complex<_Tp> log10(const complex<_Tp>& __x) {
10591059
10601060// sqrt
10611061
1062+ _LIBCPP_HIDE_FROM_ABI inline _Complex float __csqrt (_Complex float __v) {
1063+ return __builtin_csqrtf (__v);
1064+ }
1065+
1066+ _LIBCPP_HIDE_FROM_ABI inline _Complex double __csqrt (_Complex double __v) {
1067+ return __builtin_csqrt (__v);
1068+ }
1069+
1070+ _LIBCPP_HIDE_FROM_ABI inline _Complex long double __csqrt (_Complex long double __v) {
1071+ return __builtin_csqrtl (__v);
1072+ }
1073+
10621074template <class _Tp >
10631075_LIBCPP_HIDE_FROM_ABI complex <_Tp> sqrt (const complex <_Tp>& __x) {
1064- if (std::isinf (__x.imag ()))
1065- return complex <_Tp>(_Tp (INFINITY), __x.imag ());
1066- if (std::isinf (__x.real ())) {
1067- if (__x.real () > _Tp (0 ))
1068- return complex <_Tp>(__x.real (), std::isnan (__x.imag ()) ? __x.imag () : std::copysign (_Tp (0 ), __x.imag ()));
1069- return complex <_Tp>(std::isnan (__x.imag ()) ? __x.imag () : _Tp (0 ), std::copysign (__x.real (), __x.imag ()));
1070- }
1071- return std::polar (std::sqrt (std::abs (__x)), std::arg (__x) / _Tp (2 ));
1076+ return complex <_Tp>(__from_builtin_tag (), std::__csqrt (__x.__builtin ()));
10721077}
10731078
10741079// exp
You can’t perform that action at this time.
0 commit comments