Apsuvax.1044
net.unix-wizards
utzoo!decvax!harpo!zeppo!wheps!eagle!mhtsa!allegra!psuvax!sibley
Tue May 4 11:07:39 1982
Re: Caveat Hackor
In spite of some recent comments here, the "n *= z" bug is
real. Even if z is set to 3.6 or 3.99999 instead of 3.5
the result is 6. I.e.,
int n;
float z;
n = 2;
z = 3.99999;
n *= z;
printf("%d\n", n );
produces 6 instead of 7. Thus, the discussion about accuracy
of floating point arithmetic is moot. Furthermore, the assembler
source produced by the compiler clearly shows that z is converted
to int before the multiplication, which is not correct.
dave
psuvax!sibley
-----------------------------------------------------------------
gopher://quux.org/ conversion by John Goerzen <
[email protected]>
of
http://communication.ucsd.edu/A-News/
This Usenet Oldnews Archive
article may be copied and distributed freely, provided:
1. There is no money collected for the text(s) of the articles.
2. The following notice remains appended to each copy:
The Usenet Oldnews Archive: Compilation Copyright (C) 1981, 1996
Bruce Jones, Henry Spencer, David Wiseman.