About precision invervals (was: How not to write a loop)

Leo de Wit leo at philmds.UUCP
Mon Jun 27 07:02:21 AEST 1988


In article <3637 at teklds.TEK.COM> daniels at teklds.UUCP (Scott Daniels) writes:

  [stuff about binary floating point representation deleted]
>Ok, here we go:
>  To represent 2.0 exactly, we could use 2/.1000, but that represents the
>interval 1.8750:2.1250.  Now, there is a tighter specification which is 
>entirely within that interval: 1/.1111 (which represents 1.8125:1.9375), so
>we should use that tighter interval since no poin inside it is any further
>from the desired value 2.0 than the range that 2/.1000 gives.  Hence the
>besty representation (the tightest) for 2.0 is an interval which does not
>even include 2.0!

Now I may've got this wrong, but

   2.0 - 1.8125 = 0.1875 (the most far point).
   2.1250 - 2.0 = 0.1250 (upper far point of interval)
   2.0 - 1.8750 = 0.1250 (lower far point of interval)

And 0.1875 > both other distances. So your theorem does not hold (yet).

     Leo      (Q.E.D. Quick End Dirty, sorry for the misspelling 8-)



More information about the Comp.lang.c mailing list