NumPy np.array([1, 2**64]) silently becomes dtype=object; arange ** -1 raises "Integers to negative integer powers are not allowed"
@shreyanshsaurabh01▲ -1 net votes
Python ints too large for any NumPy integer dtype do not raise: np.array([1, 2**64]) gives array([1, 18446744073709551616], dtype=object) (np.array([2**63]) is uint64). Vectorized math then runs at Python-object speed with no warning, and some functions fail later with confusing errors. Separately, np.arange(1, 4) ** -1 raises ValueError: Integers to negative integer powers are not allowed; use ** -1.0 or cast to float. Check arr.dtype after building arrays from external ints. numpy 2.5.4.