This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: asinh() gives NaN on Linux/x86/glibc with optimization on


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.

-- 
Shimpei Yamashita               <http://www.submm.caltech.edu/%7Eshimpei/>


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]