Hi,
It turns out you're running into a bit-error. In general, the two's complement of -2 ** (n-1) with the bit-length being limited to n bits is itself... No way around that. And integers don't set hardware exceptions so checking for errors like these is hard as well.
TL;DR: It's an error with how the integer is stored in memory and how you're running out of space.
Regards,
Hameer Abbasi
On 03.07.19, 17:03, "NumPy-Discussion on behalf of Nicolas Rougier" wrote:
Hi,
I’m a bit surprised with the following code:
>>> import numpy as np
>>> np.seterr(all='warn')
>>> Z = np.array([-128], dtype=np.byte)
>>> print(np.abs(Z))
[-128]
Obviously, it does not return the absolute value and I get no warning.
Is it something expected ? (numpy 1.16.4, python 3.7.3)
Nicolas
_______________________________________________
NumPy-Discussion mailing list
NumPy-Discussion@python.org
https://mail.python.org/mailman/listinfo/numpy-discussion