[Python-ideas] Float range class

Guido van Rossum guido at python.org
Fri Jan 9 22:24:50 CET 2015

On Fri, Jan 9, 2015 at 12:58 PM, Andrew Barnert <
abarnert at yahoo.com.dmarc.invalid> wrote:

> [...]
> arange is actually very easy to get right, but hard to _use_ properly. A
> half-open range of values from 0 to .9 by .3 is going to include a number
> just under 0.9 if properly implemented. However you slice it, .3*3<.9,
> .3+.3+.3<.9, etc., so that number belongs in the range. [...]

I don't know if this some kind of fp in-joke that I'm missing, but I find
that the wording "if properly implemented" comes on a little strong. It
depends on behavior of IEEE binary fp that's far from obvious -- I observe
that .3*4 > 1.2, for example.

--Guido van Rossum (python.org/~guido)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20150109/4fcd1118/attachment.html>

More information about the Python-ideas mailing list