[Numpy-discussion] 0/0 == 0?
Charles R Harris
charlesr.harris at gmail.com
Fri Oct 3 10:30:12 EDT 2014
On Fri, Oct 3, 2014 at 1:33 AM, Stephan Hoyer <shoyer at gmail.com> wrote:
> On Thu, Oct 2, 2014 at 11:29 PM, Nathaniel Smith <njs at pobox.com> wrote:
>> The seterr warning system makes a lot of sense for IEEE754 floats,
>> which are specifically designed so that 0/0 has a unique well-defined
>> answer. For ints though this seems really broken to me. 0 / 0 = 0 is
>> just the wrong answer. It would be nice if we had something reasonable
>> to return, but we don't, and I'd rather raise an error than return the
>> wrong answer.
> An even worse offender (in my opinion) is in-place addition of an integer
> array with np.nan:
> >>> x = np.zeros(1, dtype=int)
> >>> x += np.nan
> RuntimeWarning: invalid value encountered in add
> >>> x
This will be an error in 1.10
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the NumPy-Discussion