This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: asinh() gives NaN on Linux/x86/glibc with optimization on
- To: shimpei+usenet+ dot mil+ dot gov at BOFH dot submm dot caltech dot edu (Shimpei Yamashita)
- Subject: Re: asinh() gives NaN on Linux/x86/glibc with optimization on
- From: hjl at lucon dot org (H.J. Lu)
- Date: Tue, 22 Dec 1998 16:05:23 -0800 (PST)
- Cc: egcs at egcs dot cygnus dot com
>
> H.J. Lu <hjl@lucon.org> writes:
> >
> >>
> >> On RedHat Linux 5.2 (using glibc 2.0.7) for x86, asinh() returns NaN
> >> for negative arguments if optimizations are on. The error does not
> >> occur if optimizations are turned off. I'm not sure where the problem
> >> is--egcs or glibc. Using libc5 seems to solve the problem, but so does
> >> dropping back to gcc 2.7.2.
> >
> >Do you have a testcase?
>
> Sure.
>
> #include <stdio.h>
> #include <math.h>
>
> main() {
>
> double ha;
>
> printf("Input argument for asinh: ");
> scanf("%lf", &ha);
> printf("asinh(%f)=%f\n", ha, asinh(ha));
> exit(0);
> }
>
> The program works correctly for positive arguments. Negative results
> (I tried -100, -50, -10, -5) all return NaN.
>
# gcc -v
Reading specs from /usr/lib/gcc-lib/i586-pc-linux/egcs-2.91.60/specs
gcc version egcs-2.91.60 19981201 (egcs-1.1.1 release)
# gcc -O6 x.c
# a.out
Input argument for asinh: -100
asinh(-100.000000)=-5.298342
# ldd a.out
libc.so.6 => /lib/libc.so.6 (0x40007000)
/lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x2aaaa000)
# ls -l /lib/libc.so.6
lrwxrwxrwx 1 root root 26 Dec 11 08:16 /lib/libc.so.6 -> glibc-2.0-981211/libc.so.6
I am running glibc 2.0.7 981211.
--
H.J. Lu (hjl@gnu.org)