PEP 260: simplify xrange()
mwh at python.net
Wed Jun 27 20:16:52 CEST 2001
Jeff Shannon <jeff at ccvcorp.com> writes:
> To make a long story short, the discussion regarding FP boils down
> to the fact that "1.0" cannot be exactly represented in FP.
> Every time you increment your "frange", you are introducing nasty
> rounding errors, and by the time you've done several thousand
> iterations, they're going to be very significant rounding errors.
> And the worst part is that there will be *no indication* of where
> the wrong answers are coming from unless you happen to monitor your
> frange index throughout a debugging run... and even then it'll only
> be clear if you know that the FP problem exists.
This is true, though.
Floating point arithmetic *is* exact (given a rounding mode), but
it's not exactly what you think.
My pedant-gland throbs a bit when I see people write "floating point
numbers are approximate"...
That one is easily explained away as massively intricate
conspiracy, though. -- Chris Klein, alt.sysadmin.recovery
More information about the Python-list