Detecting integer overflow in numpy ndarray

Viewed 90

I want to detect overflow in integer operations of numpy ndarray. It is possible in element-wise operation.

#  no warning.
array = np.array([100_000], np.int32)
array * array

#  RuntimeWarning: overflow encountered in long_scalars
x = array[0]
x * x

I want to get some warning or error in array operation, as element-wise operation. Is it possible?

0 Answers
Related