[Numpy-discussion] abs for max negative integers - desired behavior?
Tue Oct 11 13:23:15 CDT 2011
I recently ran into this:
In : arr = np.array(-128, np.int8)
In : arr
Out: array(-128, dtype=int8)
In : np.abs(arr)
Of course, I can see why this happens, but it is still surprising, and
it seems to me that it would be a confusing source of bugs, because of
course it only happens for the maximum negative integer.
One particular confusing result was:
In : np.allclose(arr, arr)
I wanted to ask whether this is the desired behavior, and whether it
might be worth planning a change in the long term?
More information about the NumPy-Discussion