This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author steven.daprano
Recipients cool-RR, mark.dickinson, rhettinger, steven.daprano
Date 2016-06-09.11:59:04
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <20160609115850.GA27919@ando.pearwood.info>
In-reply-to <1465464244.51.0.950912500459.issue27181@psf.upfronthosting.co.za>
Content
On Thu, Jun 09, 2016 at 09:24:04AM +0000, Mark Dickinson wrote:

> On the other hand, apparently `exp(mean(log(...)))` is good enough for SciPy:

Hmm, well, I don't have SciPy installed, but I've found that despite 
their (well-deserved) reputation, numpy (and presumably scipy) often 
have rather naive algorithms that can lose accuracy rather 
spectacularly.

py> statistics.mean([1e50, 2e-50, -1e50, 2e-50])
1e-50
py> np.mean(np.array([1e50, 2e-50, -1e50, 2e-50]))
5e-51

py> statistics.mean([1e50, 2e-50, -1e50, 2e-50]*1000)
1e-50
py> np.mean(np.array([1e50, 2e-50, -1e50, 2e-50]*1000))
5.0000000000000002e-54

On the other hand, np is probably a hundred times (or more) faster, so I 
suppose accuracy/speed makes a good trade off.
History
Date User Action Args
2016-06-09 11:59:05steven.dapranosetrecipients: + steven.daprano, rhettinger, mark.dickinson, cool-RR
2016-06-09 11:59:05steven.dapranolinkissue27181 messages
2016-06-09 11:59:04steven.dapranocreate