Against PEP 240

Aahz Maruch aahz at panix.com
Thu May 31 19:52:46 EDT 2001


In article <3b16a5e2.10711472 at wa.news.verio.net>,
Bengt Richter <bokr at accessone.com> wrote:
>
>Note the following "recovery" of exactness, assuming the result has
>two legitimate decimals ;-)
>
> >>> 0.98
> 0.97999999999999998
> >>> "%4.2f" % (.98,)
> '0.98'

That's what Python used to do.  Problem is, error propagates rapidly,
especially with multiplication, division, and addition/subtraction of
numbers with differing magnitude.
-- 
                      --- Aahz  <*>  (Copyright 2001 by aahz at pobox.com)

Androgynous poly kinky vanilla queer het Pythonista   http://www.rahul.net/aahz/
Hugs and backrubs -- I break Rule 6

"Characters exist to suffer, you know.  An author needs a little sadism
in her makeup."  --Brenda Clough



More information about the Python-list mailing list