[Python-Dev] FP vs. tutorial

Guido van Rossum guido@digicool.com
Mon, 21 May 2001 16:57:08 -0400


[Aahz]
> >>> Or maybe the full story can be an appendix.
> >> 
> >> Or maybe Decimal should go in the standard distribution?  What kind of
> >> deadline do I have for finishing that to go into 2.2?

[Guido]
> > Adding Decimal to the distribution is fine.  But using it by default
> > for floating point literals and other floating point results is a
> > different story.  The PEP about that hasn't really been discussed
> > enough to make a decision, but a conservative estimate is that this
> > change won't be made in 2.2.  So Decimal doesn't solve the problem the
> > tutorial has.

[Aahz]
> Wasn't thinking of going quite that far, only changing the tutorial to
> say something like, "If you want speed, use the hardware FP (which is
> directly supported by Python's floating literals); if you want accuracy,
> use Decimal."  (Or FixedPoint, which is already in the distribution.)
> The full story needn't go in the Appendix; we can simply refer people to
> Cowlishaw and Kahan.

I think that most people don't care about either speed or accuracy,
but (being Python users) everybody cares about convenience, and
convenience is using the built-in floating point literals.  (Also,
most other modules returning or using floating point numbers use
binary floating point, e.g. the time module and of course the math
module.)

As long as the built-in literals are binary floating point, they are
what 99% of the code uses, so we need to explain the pitfalls.

--Guido van Rossum (home page: http://www.python.org/~guido/)