[Bug c/21607] New: Optimizations convert 0 to -0 leading to difference in answers.
fsmith at mathworks dot com
gcc-bugzilla@gcc.gnu.org
Mon May 16 13:46:00 GMT 2005
Hi,
Sorry for the missing information above. gcc -v did not supply the above
information and for reasons unknown to me gccbug was not installed on the
system in question.
Compiling with -O changes the results of this program.
double u_im = 0;
extern double atan(double);
extern int printf(const char *str,...);
int main(void)
{
double y;
double b;
/* Becomes -0 with optimizations and 0 without. */
b = 0 - 3*u_im;
y = atan(-7/b);
printf("b = %g\n",b);
printf("atan(-7/b) = %g\n",y);
if(y >= 0) {
printf("Error happened!\n");
}
return (y>=0);
}
--
Summary: Optimizations convert 0 to -0 leading to difference in
answers.
Product: gcc
Version: 3.3
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: c
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: fsmith at mathworks dot com
CC: gcc-bugs at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21607
More information about the Gcc-bugs
mailing list