This is the mail archive of the gcc-bugs@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]

asinh() returns incorrect value with optimization turned on (fwd)


Hi,


1;
The function asinh() returns incorrect values for negative numbers when
optimization is turned on (level 1 or higher).

2;
Seen: on linux 2.2.12, i686 (Pentium III), gcc-2.95.2 compiling with
g++ -o tst-asinh -O3 -Wall tst-asinh.C

The error persists if -O3 is changed to -O2 or -O1. Only -O0 works.

3;
The code:

#include <iostream>
#include <math.h>


int main() {
  while(1) {
  double x;
  cin >> x;
  register const double e = asinh(x);
  cout << e << "; " << sinh(e) << '\n';
  }
}

4;
See the preprocessor outputs attached. The one with extension .E0 is for
the -O0 flag. The other one, .E1, is for -O1. I had to compress these
because you reject mail that is over 100000 bytes.

The best luck,


Denes Molnar

tst-asinh.E0.gz

tst-asinh.E1.gz


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