diff options
author | Ulrich Drepper <drepper@redhat.com> | 2005-07-07 23:46:51 +0000 |
---|---|---|
committer | Ulrich Drepper <drepper@redhat.com> | 2005-07-07 23:46:51 +0000 |
commit | 3b6c37d48c6ffd7a196fbf96f39dcd62e1781fe0 (patch) | |
tree | a21d388b5b1d7039e40ad26b498cd028aef8a9c8 /sysdeps/generic/s_ctanf.c | |
parent | 96191db217c69f989c68121a2ceb06c24939b848 (diff) | |
download | glibc-3b6c37d48c6ffd7a196fbf96f39dcd62e1781fe0.tar glibc-3b6c37d48c6ffd7a196fbf96f39dcd62e1781fe0.tar.gz glibc-3b6c37d48c6ffd7a196fbf96f39dcd62e1781fe0.tar.bz2 glibc-3b6c37d48c6ffd7a196fbf96f39dcd62e1781fe0.zip |
* sysdeps/generic/s_ctan.c (__ctan): Likewise.
* sysdeps/generic/s_ctanf.c (__ctanf): Likewise.
* sysdeps/generic/s_ctanl.c (__ctanl): Likewise.
Diffstat (limited to 'sysdeps/generic/s_ctanf.c')
-rw-r--r-- | sysdeps/generic/s_ctanf.c | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/sysdeps/generic/s_ctanf.c b/sysdeps/generic/s_ctanf.c index e02971dd44..58d9d13298 100644 --- a/sysdeps/generic/s_ctanf.c +++ b/sysdeps/generic/s_ctanf.c @@ -1,5 +1,5 @@ /* Complex tangent function for float. - 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,19 @@ __ctanf (__complex__ float x) den = cos2rx + __ieee754_coshf (2.0 * __imag__ x); - __real__ res = sin2rx / den; - __imag__ res = __ieee754_sinhf (2.0 * __imag__ x) / den; + + if (den == 0.0) + { + __complex__ float ez = __cexpf (1.0i * x); + __complex__ float emz = __cexpf (-1.0i * x); + + res = (ez - emz) / (ez + emz) * -1.0i; + } + else + { + __real__ res = sin2rx / den; + __imag__ res = __ieee754_sinhf (2.0 * __imag__ x) / den; + } } return res; |