[NumPy-Tickets] [NumPy] #1929: numpy.diff fails on unsigned integers

NumPy Trac numpy-tickets@scipy....
Wed Aug 10 15:28:55 CDT 2011


#1929: numpy.diff fails on unsigned integers
-------------------------------------------------+--------------------------
 Reporter:  tlatorre                             |       Owner:  somebody   
     Type:  defect                               |      Status:  new        
 Priority:  high                                 |   Milestone:  Unscheduled
Component:  numpy.lib                            |     Version:  1.6.0      
 Keywords:  unsigned, diff, numpy.diff, np.diff  |  
-------------------------------------------------+--------------------------
 It appears numpy.diff insists on returning an array of the same datatype
 as the input which is incorrect for unsigned integers.

 >>> np.diff(np.array([3,2], dtype=np.uint8))
 array([255], dtype=uint8)
 >>> np.diff(np.array([1,0], dtype=np.uint16))
 array([65535], dtype=uint16)
 >>> np.diff(np.array([3,2,0], dtype=np.uint32))
 array([4294967295, 4294967294], dtype=uint32)
 >>> np.diff(np.array([3,2,0], dtype=np.uint64))
 array([18446744073709551615, 18446744073709551614], dtype=uint64)

-- 
Ticket URL: <http://projects.scipy.org/numpy/ticket/1929>
NumPy <http://projects.scipy.org/numpy>
My example project


More information about the NumPy-Tickets mailing list