summary refs log tree commit diff
path: root/math/k_casinh.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_casinh.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_casinh.c')
-rw-r--r--math/k_casinh.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/math/k_casinh.c b/math/k_casinh.c
index 7f98f24a80..41cd5ec47d 100644
--- a/math/k_casinh.c
+++ b/math/k_casinh.c
@@ -57,6 +57,26 @@ __kernel_casinh (__complex__ double x, int adj)
       res = __clog (y);
       __real__ res += M_LN2;
     }
+  else if (rx >= 0.5 && ix < DBL_EPSILON / 8.0)
+    {
+      double s = __ieee754_hypot (1.0, rx);
+
+      __real__ res = __ieee754_log (rx + s);
+      if (adj)
+	__imag__ res = __ieee754_atan2 (s, __imag__ x);
+      else
+	__imag__ res = __ieee754_atan2 (ix, s);
+    }
+  else if (rx < DBL_EPSILON / 8.0 && ix >= 1.5)
+    {
+      double s = __ieee754_sqrt ((ix + 1.0) * (ix - 1.0));
+
+      __real__ res = __ieee754_log (ix + s);
+      if (adj)
+	__imag__ res = __ieee754_atan2 (rx, __copysign (s, __imag__ x));
+      else
+	__imag__ res = __ieee754_atan2 (s, rx);
+    }
   else
     {
       __real__ y = (rx - ix) * (rx + ix) + 1.0;