[NumPy-Tickets] [NumPy] #1396: Numpy product of zero-length array returns 1.0

NumPy Trac numpy-tickets@scipy....
Sat Feb 27 01:36:15 CST 2010


#1396: Numpy product of zero-length array returns 1.0
----------------------------------------+-----------------------------------
 Reporter:  xdylanm                     |       Owner:  somebody      
     Type:  enhancement                 |      Status:  needs_decision
 Priority:  normal                      |   Milestone:                
Component:  numpy.core                  |     Version:  1.3.0         
 Keywords:  product, prod, zero-length  |  
----------------------------------------+-----------------------------------

Comment(by josefpktd):

 I agree with Stefan, returning starting element is the same as for sum
 (and should be for nansum)
 and it matches with exp sum log

 {{{
 >>> sum([])
 0
 >>> np.sum([])
 0.0

 >>> np.exp(np.sum(np.log([])))
 1.0

 }}}

-- 
Ticket URL: <http://projects.scipy.org/numpy/ticket/1396#comment:2>
NumPy <http://projects.scipy.org/numpy>
My example project


More information about the NumPy-Tickets mailing list