This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/21607] New: Optimizations convert 0 to -0 leading to difference in answers.
- From: "fsmith at mathworks dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 16 May 2005 13:45:54 -0000
- Subject: [Bug c/21607] New: Optimizations convert 0 to -0 leading to difference in answers.
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
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