diff options
Diffstat (limited to 'sysdeps/libm-ieee754/s_csqrtf.c')
-rw-r--r-- | sysdeps/libm-ieee754/s_csqrtf.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/sysdeps/libm-ieee754/s_csqrtf.c b/sysdeps/libm-ieee754/s_csqrtf.c index 2289045cfd..5fdf2c1d66 100644 --- a/sysdeps/libm-ieee754/s_csqrtf.c +++ b/sysdeps/libm-ieee754/s_csqrtf.c @@ -84,6 +84,7 @@ __csqrtf (__complex__ float x) } else { +#if 0 /* FIXME: this is broken. */ __complex__ float q; float t, r; @@ -99,6 +100,15 @@ __csqrtf (__complex__ float x) /* Heron iteration in complex arithmetic. */ res = 0.5 * (q + q / x); +#else + float d, imag; + + d = __ieee754_hypotf (__real__ x, __imag__ x); + imag = __ieee754_sqrtf (0.5 * (d - __real__ x)); + + __real__ res = __ieee754_sqrtf (0.5 * (d + __real__ x)); + __imag__ res = __copysignf (imag, __imag__ x); +#endif } } |