[Scipy-tickets] [SciPy] #526: scipy.stats.gmean cannot handle large numbers

SciPy scipy-tickets@scipy....
Wed Oct 31 17:33:04 CDT 2007


#526: scipy.stats.gmean cannot handle large numbers
--------------------+-------------------------------------------------------
 Reporter:  tonym   |        Owner:  somebody
     Type:  defect  |       Status:  new     
 Priority:  normal  |    Milestone:  0.7     
Component:  Other   |      Version:          
 Severity:  normal  |   Resolution:          
 Keywords:          |  
--------------------+-------------------------------------------------------
Comment (by tonym):

 Using logs allows it to handle large numbers without overflow.
 A simple version (without axis handling or hanlding of zero
 or negative numbers) is:

 def gmean(data):
     a = numpy.log(data)
     gmean = numpy.exp(a.mean())
     return gmean

-- 
Ticket URL: <http://scipy.org/scipy/scipy/ticket/526#comment:1>
SciPy <http://www.scipy.org/>
SciPy is open-source software for mathematics, science, and engineering.


More information about the Scipy-tickets mailing list