Closed
Description
Original ticket http://projects.scipy.org/numpy/ticket/1856 on 2011-06-02 by trac user klasj, assigned to unknown.
The bitshift operations, both right and left cycles when they are shifted more bits than
the length of the datatype. This happens for both int32 and int64 but not for int16,
unsigned integers works as expected. In the example below version 1.6.1 is used but
this is also present in at least 1.5.0.
In [1]: import numpy as np
In [2]: np.right_shift(np.int32(8),32)
Out[2]: 8
In [3]: np.right_shift(np.int64(8),64)
Out[3]: 8
In [4]: np.right_shift(np.int16(8),16)
Out[4]: 0
In [5]: np.left_shift(np.int32(8),32)
Out[5]: 8
In [6]: np.left_shift(np.int64(8),64)
Out[6]: 8
In [7]: np.left_shift(np.int16(8),16)
Out[7]: 524288
In [8]: np.version.full_version
Out[8]: '1.6.1.dev-08953ea'