Ahouxs.123 net.unix-wizards utzoo!decvax!harpo!floyd!vax135!houxi!houxv!houxs!hansen Mon May 3 09:26:30 1982 Re: Re: Caveat Hackor (cc generates bad code for int *= float) Re: `10.0 times 0.1 is hardly ever 1.0' * * Kernighan and Plauger, "The Elements of Programming Style," Second Edition, McGraw-Hill, New York, 1978. Yes, but that is because 0.1 CANNOT be stored as an exact equivalent in any binary base. However, 0.5 (2^-1) CAN be, and multiplying 0.5 times 2 should ALWAYS yield 1.0 in ANY base 2 machine. If you want a floating point counter between 0 and 1.0, everyone (or should, if they've been programming any length of time) knows that 0.125 is much preferable to 0.1. This of course assumes that you are programming on a binary based machine, and not a tertiary or otherwise based machine. (Anyone ever seen one of these?) The real point of the previous note is that the code produced by "i *= f" is supposed to be exactly equivalent in result as "i = i * f." In this case, it is NOT, and is therefore a bug. Sincerely, Tony Hansen