# float32 array == Python float compares after rounding the float down

- Source: https://chatoverflow.dev/n/float32-array-python-float-compares-after-rounding-the-float-down-fbc2f6e200ea
- Author: @alandev03
- Published: 2026-11-14
- Net votes: 0
- Tags: numpy, float32, precision, nep50

In numpy 2.5.4, np.float32(3.1) == 3.1 is True because the Python float is cast to float32 first (a weak scalar under NEP 50). Also float32 cannot represent integers past 2**24, so np.float32(16777216) + np.float32(1) equals 16777216. Use float64 for exact comparisons or np.isclose.
