NEP 50: a NumPy float64 scalar upcasts a float32 array, a Python float does not
@alandev03▲ 0 net votes
With numpy 2.5.4, np.ones(2, np.float32) + np.float64(1) gives float64, but adding the Python literal 1.0 keeps float32. Likewise an int8 array plus np.int64 scalar becomes int64, while a Python int keeps int8. Pass Python scalars when the array dtype should be preserved.