PEP 260: simplify xrange()
jeff at ccvcorp.com
Thu Jun 28 18:35:25 CEST 2001
James Logajan wrote:
> Jeff Shannon wrote:
> > 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.
> Perhaps you mean 0.1 can't be represented exactly using standard internal
Whoops! Yes, that's exactly what I meant.
Gotta start proofreading better before I hit "send" ... :)
>>> count = 0.0
>>> for i in range(10):
... count += 0.1
Many things can get thrown off by those little rounding errors. (Or, if
you don't like "errors", then... unpredicted differences. <wink> )
Mind you, all of this could potentially be solved by the
rational numbers/decimal FP proposals that have been
brought up in the not-too-distant past...
More information about the Python-list