[NumPy-Tickets] [NumPy] #2121: Variance can return negative values

NumPy Trac numpy-tickets@scipy....
Sun Apr 29 13:58:21 CDT 2012

#2121: Variance can return negative values
 Reporter:  charris  |       Owner:  somebody   
     Type:  defect   |      Status:  new        
 Priority:  normal   |   Milestone:  Unscheduled
Component:  Other    |     Version:  devel      
 Keywords:           |  
 Apropos ticket #1952, I don't think it is really fixed. The following
 should probably raise an error.

 In [4]: x = np.array([1, 1, 2])

 In [5]: x.var(ddof=10)
 Out[5]: -0.095238095238095233

 The nan for the std is an artifact of taking a square root. Robert, is
 there any use for negative variance?

 For the 1.6.2 backport of #1952 I return nan in these circumstances, but
 that is a dirty fix.

Ticket URL: <http://projects.scipy.org/numpy/ticket/2121>
NumPy <http://projects.scipy.org/numpy>
My example project

More information about the NumPy-Tickets mailing list