diff options
author | Joseph Myers <joseph@codesourcery.com> | 2013-03-21 10:27:10 +0000 |
---|---|---|
committer | Joseph Myers <joseph@codesourcery.com> | 2013-03-21 10:27:10 +0000 |
commit | 0a1b2ae6f6d511519ab3c0ccbf54982ae65bc444 (patch) | |
tree | ffa27d00584d224e4b47a9654e192fb3fb0ed0ba /math/k_casinhf.c | |
parent | b33d4ce4a2a05ca8a29798f410657e43722193ff (diff) | |
download | glibc-0a1b2ae6f6d511519ab3c0ccbf54982ae65bc444.tar.gz glibc-0a1b2ae6f6d511519ab3c0ccbf54982ae65bc444.tar.xz glibc-0a1b2ae6f6d511519ab3c0ccbf54982ae65bc444.zip |
Fix casinh inaccuracy for argument with imaginary part 1 (bug 15287).
Diffstat (limited to 'math/k_casinhf.c')
-rw-r--r-- | math/k_casinhf.c | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/math/k_casinhf.c b/math/k_casinhf.c index 7ff4b03a1c..4d1a92f813 100644 --- a/math/k_casinhf.c +++ b/math/k_casinhf.c @@ -77,6 +77,32 @@ __kernel_casinhf (__complex__ float x, int adj) else __imag__ res = __ieee754_atan2f (s, rx); } + else if (ix == 1.0f && rx < 0.5f) + { + if (rx < FLT_EPSILON / 8.0f) + { + __real__ res = __log1pf (2.0f * (rx + __ieee754_sqrtf (rx))) / 2.0f; + if (adj) + __imag__ res = __ieee754_atan2f (__ieee754_sqrtf (rx), + __copysignf (1.0f, __imag__ x)); + else + __imag__ res = __ieee754_atan2f (1.0f, __ieee754_sqrtf (rx)); + } + else + { + float d = rx * __ieee754_sqrtf (4.0f + rx * rx); + float s1 = __ieee754_sqrtf ((d + rx * rx) / 2.0f); + float s2 = __ieee754_sqrtf ((d - rx * rx) / 2.0f); + + __real__ res = __log1pf (rx * rx + d + 2.0f * (rx * s1 + s2)) / 2.0f; + if (adj) + __imag__ res = __ieee754_atan2f (rx + s1, + __copysignf (1.0f + s2, + __imag__ x)); + else + __imag__ res = __ieee754_atan2f (1.0f + s2, rx + s1); + } + } else { __real__ y = (rx - ix) * (rx + ix) + 1.0f; |