diff options
author | Ulrich Drepper <drepper@redhat.com> | 2005-07-07 23:29:00 +0000 |
---|---|---|
committer | Ulrich Drepper <drepper@redhat.com> | 2005-07-07 23:29:00 +0000 |
commit | 531680aebfa57f25b24b993f3c911af1ca8981e3 (patch) | |
tree | 634e80ce5a4f474e7cadaba2755f36d0ad86eeab | |
parent | 8df08cb248ed8fe5fb489678774f984c4a08a534 (diff) | |
download | glibc-531680aebfa57f25b24b993f3c911af1ca8981e3.tar.gz glibc-531680aebfa57f25b24b993f3c911af1ca8981e3.tar.xz glibc-531680aebfa57f25b24b993f3c911af1ca8981e3.zip |
(__ctanhl): Handle case of zero den better.
-rw-r--r-- | sysdeps/generic/s_ctanhl.c | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/sysdeps/generic/s_ctanhl.c b/sysdeps/generic/s_ctanhl.c index 7bf6b39199..77ca8f8717 100644 --- a/sysdeps/generic/s_ctanhl.c +++ b/sysdeps/generic/s_ctanhl.c @@ -1,5 +1,5 @@ /* Complex hyperbole tangent for long 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 @@ __ctanhl (__complex__ long double x) den = (__ieee754_coshl (2.0 * __real__ x) + cos2ix); - __real__ res = __ieee754_sinhl (2.0 * __real__ x) / den; - __imag__ res = sin2ix / den; + if (den == 0.0L) + { + __complex__ long double ez = __cexpl (x); + __complex__ long double emz = __cexpl (-x); + + res = (ez - emz) / (ez + emz); + } + else + { + __real__ res = __ieee754_sinhl (2.0 * __real__ x) / den; + __imag__ res = sin2ix / den; + } } return res; |