Return to BSD News archive
Newsgroups: comp.unix.bsd
Path: sserve!manuel.anu.edu.au!munnari.oz.au!spool.mu.edu!umn.edu!csus.edu!netcom.com!jtk
From: jtk@netcom.com (Jane Valencia)
Subject: [386BSD] Bug in floating point
Message-ID: <1992Oct19.175527.22365@netcom.com>
Organization: Netcom - Online Communication Services (408 241-9760 guest)
Date: Mon, 19 Oct 1992 17:55:27 GMT
Lines: 22
While porting GNU Smalltalk, I ran across the following. I'm sure
it's already found, but I couldn't prove it to myself by scanning
old messages, so....
GCC's treatment of an assignment "r = 0.0" to a double generates
an assignment of -1 instead. "r = 0" works fine. I assume it's
the floating point emulation (I have a 386 without 387) which
is fooling GCC. Test program included below.
Andy Valencia
main()
{
double r;
r = 0.0;
printf("Result %lf\n", r);
r = 0;
printf("Result %lf\n", r);
exit(0);
}