How not to write a loop, revisited

Michael michael at stb.UUCP
Fri Jul 15 11:50:58 AEST 1988


In article <3637 at teklds.TEK.COM> daniels at teklds.UUCP (Scott Daniels) writes:
>In article <329 at accelerator.eng.ohio-state.edu> 
>	rob at kaa.eng.ohio-state.edu (Rob Carriere) writes:
>>... nobody I know *guarantees* that integers are representable (i.e. 
>>the closest approximation to 2 might be 1.999999)
>    In fact, I have read interesting arguments that propose that many
>integers be purposely mis-represented.  The argument goes as follows:
>
>Assume (for concreteness) a binary floating point representation with 
>an 4-bit mantissa ranging [0..1),and a 3-bit signed exponent field, and a 

Hang on, you give a nice example for why FLOATS may not be accurate. If you
actually did that for integers, I wouldn't touch you with a ten foot pole.

Besides, in your example you give a tighter specification that does not
include 2. However, I think you'll find that a specification that is
symetrical around two (i.e., has 2 in the middle of the what it represents
range) will work better.

				Michael
: --- 
: Michael Gersten			 uunet.uu.net!denwa!stb!michael
:				sdcsvax!crash!gryphon!denwa!stb!michael
: What would have happened if we had lost World War 2. Well, the west coast
: would be owned by Japan, we would all be driving foreign cars, hmm...



More information about the Comp.lang.c mailing list