[Numpy-tickets] [NumPy] #492: integer overflow on plus and sum (at least)

NumPy numpy-tickets@scipy....
Thu Apr 5 17:36:26 CDT 2007


#492: integer overflow on plus and sum (at least)
------------------------+---------------------------------------------------
 Reporter:  socha       |        Owner:  somebody     
     Type:  defect      |       Status:  closed       
 Priority:  normal      |    Milestone:  1.0.2 Release
Component:  numpy.core  |      Version:  none         
 Severity:  normal      |   Resolution:  wontfix      
 Keywords:              |  
------------------------+---------------------------------------------------
Changes (by rkern):

  * status:  new => closed
  * resolution:  => wontfix

Comment:

 It was a conscious decision not to automatically upgrade integer
 precisions on overflow. Math happens more or less as it happens in C.

 For {{{sum()}}}, at least, you can specify the dtype that you want the
 accumulator to be:

 {{{

 In [1]: from numpy import *

 In [2]: a = array([127,127], dtype='int8')

 In [3]: a.sum(dtype=int32)
 Out[3]: 254
 }}}

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


More information about the Numpy-tickets mailing list