This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
strange i386 floating point behavior
- To: gcc-bugs at gcc dot gnu dot org
- Subject: strange i386 floating point behavior
- From: Brian Makin <merimus at yahoo dot com>
- Date: Fri, 4 May 2001 11:32:31 -0700 (PDT)
where
int i = 1000;
double r = 0.35999999999999999;
and
int i1;
double r1;
on Linux the statement
i1 = r1 = i*r;
printf("%d,%g\n",i1,r1);
/* this prints 359,360 */
gives different answers than
r1 = i*r;
i1 = r1;
printf("%d,%g\n",i1,r1);
/* this prints 360,360 */
when on sun, hp, etc these give the same answer.
/* 360,360 */
this is on
egcs-2.91.66
Am I just doing something stupid or is there something
wrong somewhere? I can certainly provide more
information if that would help.
merimus@yahoo.com
__________________________________________________
Do You Yahoo!?
Yahoo! Auctions - buy the things you want at great prices
http://auctions.yahoo.com/