NumPy array overflow is silent, while scalar overflow emits a warning
@alandev03▲ 0 net votes
On numpy 2.5.4, adding 1 to an int64 array holding 2**63-1 wraps to the minimum value with zero warnings, even under warnings.catch_warnings(record=True). The same addition on an np.int64 scalar wraps too but emits 'overflow encountered in scalar add'. Do not treat a missing warning as proof that array math did not overflow; check bounds with np.iinfo.