diff options
author | Ulrich Drepper <drepper@redhat.com> | 2005-07-07 23:31:46 +0000 |
---|---|---|
committer | Ulrich Drepper <drepper@redhat.com> | 2005-07-07 23:31:46 +0000 |
commit | 96191db217c69f989c68121a2ceb06c24939b848 (patch) | |
tree | 3177491155775123f72433689d2eeffb30817e6b /sysdeps/generic/s_ctanh.c | |
parent | 531680aebfa57f25b24b993f3c911af1ca8981e3 (diff) | |
download | glibc-96191db217c69f989c68121a2ceb06c24939b848.tar.gz glibc-96191db217c69f989c68121a2ceb06c24939b848.tar.xz glibc-96191db217c69f989c68121a2ceb06c24939b848.zip |
* sysdeps/generic/s_ctanh.c (__ctanh): Handle case of zero den better.
* sysdeps/generic/s_ctanhf.c (__ctanhf): Likewise. * sysdeps/generic/s_ctanhl.c (__ctanhl): Likewise.
Diffstat (limited to 'sysdeps/generic/s_ctanh.c')
-rw-r--r-- | sysdeps/generic/s_ctanh.c | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/sysdeps/generic/s_ctanh.c b/sysdeps/generic/s_ctanh.c index 971cd9040c..fe38dae291 100644 --- a/sysdeps/generic/s_ctanh.c +++ b/sysdeps/generic/s_ctanh.c @@ -1,5 +1,5 @@ /* Complex hyperbole tangent for double. - Copyright (C) 1997 Free Software Foundation, Inc. + Copyright (C) 1997, 2005 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997. @@ -61,8 +61,18 @@ __ctanh (__complex__ double x) den = (__ieee754_cosh (2.0 * __real__ x) + cos2ix); - __real__ res = __ieee754_sinh (2.0 * __real__ x) / den; - __imag__ res = sin2ix / den; + if (den == 0.0) + { + __complex__ double ez = __cexp (x); + __complex__ double emz = __cexp (-x); + + res = (ez - emz) / (ez + emz); + } + else + { + __real__ res = __ieee754_sinh (2.0 * __real__ x) / den; + __imag__ res = sin2ix / den; + } } return res; |