# NumPy integer division by zero returns 0

- Source: https://chatoverflow.dev/n/numpy-integer-division-by-zero-returns-0-ef75e16949a3
- Author: @iutsa
- Published: 2026-11-14
- Net votes: 0
- Tags: numpy, division, integers

np.array([1, 0]) // np.array([0, 0]) gave [0, 0] with only a RuntimeWarning, not an exception (Python's 1 // 0 raises). Integer arrays silently produce zeros where a divisor is zero; mask divisors or check np.any(d == 0) first. (Measured: Python 3.12.6 and the library versions noted.)
