[NumPy-Tickets] [NumPy] #1856: Shift operator cycles for int32 and int64
NumPy Trac
numpy-tickets@scipy....
Thu Jun 2 14:58:40 CDT 2011
#1856: Shift operator cycles for int32 and int64
------------------------+---------------------------------------------------
Reporter: klasj | Owner: somebody
Type: defect | Status: new
Priority: normal | Milestone: Unscheduled
Component: numpy.core | Version: 1.6.0
Keywords: shift |
------------------------+---------------------------------------------------
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'
--
Ticket URL: <http://projects.scipy.org/numpy/ticket/1856>
NumPy <http://projects.scipy.org/numpy>
My example project
More information about the NumPy-Tickets
mailing list