[Python-ideas] Fwd: Make `float('inf') //1 == float('inf')`
Ian Cordasco
graffatcolmingov at gmail.com
Thu Sep 18 15:38:58 CEST 2014
On Sep 18, 2014 2:31 AM, "Petr Viktorin" <encukou at gmail.com> wrote:
>
> For the record, this gives inf in Numpy.
>
> >>> import numpy
> >>> numpy.array(float('inf')) // 1
> inf
>
> AFAIK this and http://bugs.python.org/issue22198 are the only
> differences from Python floats, at least on my machine.
That's an interesting bug report and it's significantly different
(mathematically speaking) from the discussion here. That aside, I have to
wonder if numpy has its own way of representing infinity and how that
behaves. I still maintain that it's least surprising for float('inf') // 1
to be NaN. You're trying to satisfy float('inf') = mod + 1 * y and in this
case mod and y are both indeterminate (because this is basically a
nonsensical equation).
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20140918/490b834d/attachment.html>
More information about the Python-ideas
mailing list