[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#578316: libc6: tanh(50000+50000i) gives invalid result



Package: libc6
Version: 2.10.2-6
Severity: normal

Hi,

the value of tanh(50000 + 50000I) should be (close to) (1,0). However,
with the attached file trig.cc, I get

libc version 2.10.2
arg       (50000,50000)
sinh(arg) (-inf,-inf)
cosh(arg) (-inf,-inf)
s/c       (nan,nan)
tanh(arg) (nan,0)

This came up on the GNU Octave list, see
http://www-old.cae.wisc.edu/pipermail/help-octave/2010-April/019226.html

I also tried 2.11 from experimental, same problem.

Thanks
        Thomas



-- System Information:
Debian Release: squeeze/sid
  APT prefers unstable
  APT policy: (500, 'unstable'), (1, 'experimental')
Architecture: amd64 (x86_64)

Kernel: Linux 2.6.26-2-amd64 (SMP w/2 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages libc6 depends on:
ii  libc-bin                      2.10.2-6   Embedded GNU C Library: Binaries
ii  libgcc1                       1:4.4.3-7  GCC support library

libc6 recommends no packages.

Versions of packages libc6 suggests:
ii  debconf [debconf-2.0]         1.5.32     Debian configuration management sy
pn  glibc-doc                     <none>     (no description available)
ii  locales                       2.10.2-6   Embedded GNU C Library: National L

-- debconf information excluded
// trig.cc
#include <iostream>
#include <complex>
#include <gnu/libc-version.h>
using namespace std;
int main(int argc, char **argv) {
  complex<double> arg(50000,50000);
  complex<double> s,c,r,t;
  s=sinh(arg);
  c=cosh(arg);
  r=s/c;
  t=tanh(arg);
  cout << "libc version " << gnu_get_libc_version() << endl;
  cout << "arg       " << arg << endl;
  cout << "sinh(arg) " << s << endl;
  cout << "cosh(arg) " << c << endl;
  cout << "s/c       " << r << endl;
  cout << "tanh(arg) " << t << endl;
  return 0;
}


Reply to: