Path: utzoo!utgpu!news-server.csri.toronto.edu!mailrus!iuvax!valnet!joseph From: joseph@valnet.UUCP (Joseph P. Hillenburg) Newsgroups: comp.sys.amiga Subject: Re: Lattice C double Message-ID: Date: 29 Sep 90 03:04:14 GMT References: <1990Sep28.063045.2599@ericsson.se> Organization: Valley BBS Network Lines: 33 etxpnil@etxsj23.ericsson.se (Per Nilsson TT/SJG 98194 ) writes: > The following is a test program I've compiled with the Lattice C compiler. > > main() > { > double dub; > > dub = 12345678.0; > > dub = dub * 10.0; > > printf("%.9g\n",dub); > } > > When compiled with the Lattice C V5.04, I've got the following output: > > 123456779.999999999 > > On my SPARC station I got the correct result: > > 123456780 > > Is this some kind of bug in the Lattice C compiler ? > Is there any way around this problem ? Nope...just has to do with the way the different compilers use rounding. -Joseph Hillenburg UUCP: ...iuvax!valnet!joseph ARPA: valnet!joseph@iuvax.cs.indiana.edu INET: joseph@valnet.UUCP