[Python-Dev] Expert floats

Greg Ewing greg at cosc.canterbury.ac.nz
Tue Apr 6 21:33:21 EDT 2004


> How did the class react to floating-point?  Seeing behaviour like this:
> 
>     >>> 3.3
>     3.2999999999999998
>     >>>
> 
> confused and frightened them, and continues to confuse and frighten
> almost everyone i teach. ... Every time this happens, the teaching is
> derailed and i am forced to go into an explanation of binary
> floating-point to assuage their fears.

This is an argument for making some form of decimal floating
point the default in Python, with binary FP an option for
advanced users -- not an argument for trying to hide the fact
that binary FP is being used.

Because you *can't* hide that fact completely, and as has
been pointed out, it *will* rear up and bite these people
eventually. It's much better if that happens early, while there
is someone on hand who understands the issues and can guide
them gently through the shock-and-awe phase.

Greg Ewing, Computer Science Dept, +--------------------------------------+
University of Canterbury,	   | A citizen of NewZealandCorp, a	  |
Christchurch, New Zealand	   | wholly-owned subsidiary of USA Inc.  |
greg at cosc.canterbury.ac.nz	   +--------------------------------------+



More information about the Python-Dev mailing list