[Numpy-discussion] Problem with absolute value

Nicolas Rougier Nicolas.Rougier at inria.fr
Wed Jul 3 11:03:34 EDT 2019


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


More information about the NumPy-Discussion mailing list