[Numpy-tickets] [NumPy] #669: Undesired upcasting of uint64 to float64 in NumPy scalars

NumPy numpy-tickets@scipy....
Mon Feb 25 05:00:24 CST 2008


#669: Undesired upcasting of uint64 to float64 in NumPy scalars
--------------------+-------------------------------------------------------
 Reporter:  faltet  |       Owner:  somebody
     Type:  defect  |      Status:  new     
 Priority:  normal  |   Milestone:          
Component:  Other   |     Version:  devel   
 Severity:  normal  |    Keywords:          
--------------------+-------------------------------------------------------
 In the middle of integer arithmetic, I find this quite misleading:

 {{{
 In [8]: 5 % numpy.int64(3)
 Out[8]: 2

 In [9]: 5 % numpy.uint64(3)
 Out[9]: 2.0
 }}}

 But the next is definitely worse:

 {{{
 In [10]: 5 / numpy.int64(3)
 Out[10]: 1

 In [11]: 5 / numpy.uint64(3)
 Out[11]: 1.66666666667
 }}}

 In my case, this lead to many programming errors.

 I do think that the outcome of an operation between integers should be an
 integer, as most of programming languages do.

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


More information about the Numpy-tickets mailing list