about summary refs log tree commit diff
path: root/math/k_casinhf.c
diff options
context:
space:
mode:
authorJoseph Myers <joseph@codesourcery.com>2013-01-31 22:55:29 +0000
committerJoseph Myers <joseph@codesourcery.com>2013-01-31 22:55:29 +0000
commit8cf28c5ebe7b02e769a3f3082fd390e6d8c11542 (patch)
treebe283a6db0d8e4fb2674efab398cbd0a9199f819 /math/k_casinhf.c
parentc4e33b8d8ba03ecb094904fb8c07c0858496b586 (diff)
downloadglibc-8cf28c5ebe7b02e769a3f3082fd390e6d8c11542.tar.gz
glibc-8cf28c5ebe7b02e769a3f3082fd390e6d8c11542.tar.xz
glibc-8cf28c5ebe7b02e769a3f3082fd390e6d8c11542.zip
Fix casinh spurious underflows away from [-i,i] (bug 15062).
Diffstat (limited to 'math/k_casinhf.c')
-rw-r--r--math/k_casinhf.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/math/k_casinhf.c b/math/k_casinhf.c
index 9401636348..3152ea2f7d 100644
--- a/math/k_casinhf.c
+++ b/math/k_casinhf.c
@@ -57,6 +57,26 @@ __kernel_casinhf (__complex__ float x, int adj)
       res = __clogf (y);
       __real__ res += (float) M_LN2;
     }
+  else if (rx >= 0.5f && ix < FLT_EPSILON / 8.0f)
+    {
+      float s = __ieee754_hypotf (1.0f, rx);
+
+      __real__ res = __ieee754_logf (rx + s);
+      if (adj)
+	__imag__ res = __ieee754_atan2f (s, __imag__ x);
+      else
+	__imag__ res = __ieee754_atan2f (ix, s);
+    }
+  else if (rx < FLT_EPSILON / 8.0f && ix >= 1.5f)
+    {
+      float s = __ieee754_sqrtf ((ix + 1.0f) * (ix - 1.0f));
+
+      __real__ res = __ieee754_logf (ix + s);
+      if (adj)
+	__imag__ res = __ieee754_atan2f (rx, __copysignf (s, __imag__ x));
+      else
+	__imag__ res = __ieee754_atan2f (s, rx);
+    }
   else
     {
       __real__ y = (rx - ix) * (rx + ix) + 1.0;