[Numpy-discussion] Bug in numpy.mean() revisited

Henry Gomersall heng@cantab....
Fri Jul 27 02:22:46 CDT 2012

On Thu, 2012-07-26 at 22:15 -0600, Charles R Harris wrote:
> I would support accumulating in 64 bits but, IIRC, the function will
> need to be rewritten so that it works by adding 32 bit floats to the
> accumulator to save space. There are also more stable methods that
> could also be investigated. There is a nice little project there for
> someone to cut their teeth on.

So a (very) quick read around suggests that using an interim mean gives
a more robust algorithm. The problem being, that these techniques are
either multi-pass, or inherently slower (due to say a division in the

Higher precision would not suffer the same potential slow down and would
solve most cases of this problem.


More information about the NumPy-Discussion mailing list