This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug rtl-optimization/323] optimized code gives strange floating point results
- From: "mbrudka at filbico dot pl" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 17 Jul 2008 10:45:12 -0000
- Subject: [Bug rtl-optimization/323] optimized code gives strange floating point results
- References: <bug-323-4315@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #119 from mbrudka at filbico dot pl 2008-07-17 10:45 -------
Another example related with fp on x87?
EXPECTED RESULT:
0 (with EPS accuracy)
0 (with EPS accuracy)
0 (with EPS accuracy)
0 (with EPS accuracy)
REAL RESULT:
5.313991e+33
5.313991e+33
0.000000e+00
0.000000e+00
CODE
#include <stdio.h>
int main( void )
{
/* register */ double d1 = 1e50;
/* register */ double d2 = -2.7438011834107752e+51;
/* register */ double s = 0.036445789368634796;
/* register */ double d3 = -d1/s;
/* register */ double d4 = s*d2;
/* register */ double d5 = s*d3;
printf( "%e\n", d1 + s*d2);
printf( "%e\n", d1 + s*d3);
printf( "%e\n", d1 + d4);
printf( "%e\n", d1 + d5);
return 0;
}
--
mbrudka at filbico dot pl changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |mbrudka at filbico dot pl
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=323