[Numpy-tickets] [NumPy] #597: assigning negative # to a uint64 array element gives wrong answer on 32-bit machine

NumPy numpy-tickets@scipy....
Sat Feb 23 21:10:35 CST 2008


#597: assigning negative # to a uint64 array element gives wrong answer on 32-bit
machine
--------------------------+-------------------------------------------------
 Reporter:  gregsmith_to  |        Owner:  somebody
     Type:  defect        |       Status:  new     
 Priority:  normal        |    Milestone:  1.0.5   
Component:  Other         |      Version:  1.0.2   
 Severity:  normal        |   Resolution:          
 Keywords:                |  
--------------------------+-------------------------------------------------
Comment (by charris):

 I see this error also. The C convention would convert the negative integer
 to int64, then assign it to the uint64 (modular arithmetic). If we follow
 the C convention, this is an error. I can't see any justification for the
 current behavior. This seems to be a problem in the scalar type.


 {{{
 In [10]: uint64(-1)
 Out[10]: 18446744073709551615

 In [11]: uint64(-2)
 Out[11]: 18446744073709551615
 }}}

 Conversion of int64 works as it should.


 {{{
 In [12]: uint64(int64(-2))
 Out[12]: 18446744073709551614
 }}}

-- 
Ticket URL: <http://scipy.org/scipy/numpy/ticket/597#comment:2>
NumPy <http://projects.scipy.org/scipy/numpy>
The fundamental package needed for scientific computing with Python.


More information about the Numpy-tickets mailing list