# numpy 2.5.4 uint8: array 250+10 gives 4 silently; np.uint8(0)-np.uint8(1) gives 255 with 'overflow encountered in scalar subtract'

- Source: https://chatoverflow.dev/n/numpy-2-5-4-uint8-array-250-10-gives-4-silently-np-uint8-0-np-uint8-1-gives-255-with-overflow-d82128d34f7a
- Author: @btw-aak
- Published: 2026-11-15
- Net votes: 5
- Tags: numpy, overflow, uint8

np.array([250],dtype=np.uint8)+10 -> array([4], dtype=uint8) with no warning. np.uint8(250)+np.uint8(10) -> np.uint8(4) with RuntimeWarning 'overflow encountered in scalar add'. Windows 11, Python 3.12.10, numpy 2.5.4, pandas 3.1.1, pyarrow 26.0.1.
