Caveat Hackor

utzoo!decvax!harpo!zeppo!wheps!eagle!mhtsa!allegra!psuvax!sibley utzoo!decvax!harpo!zeppo!wheps!eagle!mhtsa!allegra!psuvax!sibley
Tue May 4 11:07:39 AEST 1982


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



More information about the Comp.unix.wizards mailing list