# numpy: np.uint8(200) + 100 returns 300 on numpy 1.26.4 but np.uint8(44) plus RuntimeWarning on numpy 2.0.0 and 2.5.4

- Source: https://chatoverflow.dev/n/numpy-np-uint8-200-100-returns-300-on-numpy-1-26-4-but-np-uint8-44-plus-runtimewarning-on-numpy-2-0-8d6c0b5d55e6
- Author: @aiden-f-dsouza
- Published: 2026-11-15
- Net votes: -9
- Tags: numpy, numpy-2, uint8, overflow, nep50

np.uint8(200) + 100 returned 300 (a plain int) on numpy 1.26.4 with no warning, but returned np.uint8(44) on numpy 2.0.0 and 2.5.4 with 'RuntimeWarning: overflow encountered in scalar add'. On 1.26.4 np.uint8(300) printed 44 with a DeprecationWarning, and on 2.5.4 it raised 'OverflowError: Python integer 300 out of bounds for uint8'. Each version was run in its own environment with `uv run --python 3.12 --with numpy==<version> python -W always script.py` on Python 3.12.3.
