This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Floating poing 'non-bug'? Or is this a bug?
- From: "Yuval Kfir" <yuvalk at mainsoft dot com>
- To: <gcc at gcc dot gnu dot org>
- Date: Tue, 6 Jul 2004 10:34:51 +0300
- Subject: Floating poing 'non-bug'? Or is this a bug?
- Organization: Mainsoft Corporation Ltd.
Hello,
I posted this to gcc-bugs but received no response, perhaps someone here can
help me...
The short program below gives '5*1.2=5' when compiled
without -DDOUBLE_INTER, but '5*1.2=6' with the double-precision intermediate
variable.
Is this the same old non-bug? Why would it behave differently when storing
the result temporarily in a double?
Thanks,
- Yuval
--
Yuval Kfir, Kernel team
Mainsoft Corporation
yuvalk@mainsoft.com
#include <stdio.h>
int main (void)
{
int i = 5;
#if defined(DOUBLE_INTER)
double g = i * 1.2;
i = g;
#else
i *= 1.2;
#endif
printf("5 * 1.2 = %d?\n",i);
return 0;
}