On Thu, Sep 18, 2014 at 3:38 PM, Ian Cordasco email@example.com wrote:
On Sep 18, 2014 2:31 AM, "Petr Viktorin" firstname.lastname@example.org wrote:
For the record, this gives inf in Numpy.
import numpy numpy.array(float('inf')) // 1
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).
Well, in `x = y // a`, as y tends towards infinity, x will also tend towards infinity, though in discrete steps. Yes, you get an indeterminate value, but one that's larger than any real number.
Are any Numpy developers around? Is there a reason it has different behavior from Python?