[NumPy-Tickets] [NumPy] #1629: np.prod returns 0 in case of integer overflow
NumPy Trac
numpy-tickets@scipy....
Sat Oct 9 19:11:52 CDT 2010
#1629: np.prod returns 0 in case of integer overflow
--------------------+-------------------------------------------------------
Reporter: kilian | Owner: somebody
Type: defect | Status: new
Priority: normal | Milestone: Unscheduled
Component: Other | Version: 1.4.0
Keywords: |
--------------------+-------------------------------------------------------
I am using np.prod to calculate the number of elements of a sparse matrix
(np.prod(C.shape)) and I noticed the following behavior: In case the
result is greater than 2**31, zero is returned. Instead, the result should
be converted to int long int (or at least an exception should be raised).
{{{
>>> import numpy as np
>>> np.version.version
'1.4.0'
>>> np.prod([2**16,2**16])
0
}}}
--
Ticket URL: <http://projects.scipy.org/numpy/ticket/1629>
NumPy <http://projects.scipy.org/numpy>
My example project
More information about the NumPy-Tickets
mailing list