You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
BUG: shift with a negative number should fail #13898
A negative shift is undefined in C. Python raises a ValueError, numpy returns the undefined values. We should at least warn, and probably raise an Error.
>>> a = np.arange(4)
>>> 10 << -1
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ValueError: negative shift count
>>> a << -1
array([-9223372036854775808, 0, -9223372036854775808,
0])
Activity
mattip commentedon Sep 18, 2023
The last example now returns
array([0, 0, 0, 0]), but should it raise?