PEP 260: simplify xrange()

Tim Peters tim.one at home.com
Wed Jun 27 14:47:43 EDT 2001


[Michael Hudson]
> Glib truism:
>
>   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"...

It's not just pedantic:  the idea that fp can't be used for exact
computation is simply wrong, and a superstitious belief in it can prevent a
programmer from finding the best solutions to a problem.  The 754 inexact
flag was meant to make this easier:  independent of rounding mode, inexact
gets set if and only if an operation's fp result loses information; when it
doesn't get set, you've got exactly the same result you would have gotten if
you were able to retain infinite precision.  There's nothing fuzzy about
that; unfortunately, you can't get *at* the inexact flag in a portable way
from any brand-name language yet.





More information about the Python-list mailing list