Caveat Hackers

utzoo!decvax!harpo!floyd!vax135!lime!jlw utzoo!decvax!harpo!floyd!vax135!lime!jlw
Tue May 4 23:10:03 AEST 1982


When I made my comment a few days ago about 10.0 times 0.1
hardly ever being 1.0, I naturally was thinking about
the folly of trusting floating point roundoff.  It has become
clear to me through the good offices of a hacker in the woods
that the compiler was really converting the floating point
number to fixed point 'cvtfl' upon transferring it to the
register prior to multiplying it times the fixed point
number.  As I see it there is some ambiguity in the C language
specification.  If you take Appendix A, section 6.6 as gospel,
then the result is wrong.  If, on the other hand, you believe
Appendix A, section 7.14 as gospel, then the result is correct.
The only cogent argument I heard from the mob out to get my head
was that the language should provide consistent results.  Therefore,
I would also agree that there is a bug in the compiler.

I won't even deign to comment on the person who sent me the closest
binary representation of 0.1 and then expected the compiler
to make a special case because 0.5 could be exactly represented
in binary.

Everyone who replied to me missed the point completely.  Uncontrolled
conversions are to be avoided in any language.  This is especially
true in an monster like PL/I, and I know whereof I speak.



More information about the Comp.unix.wizards mailing list