Feature suggestion: sum() ought to use a compensated summation algorithm
Robert Kern
robert.kern at gmail.com
Mon May 5 13:21:49 EDT 2008
Gabriel Genellina wrote:
> Python doesn't require __add__ to be associative, so this should not be used as a general sum replacement. But if you know that you're adding floating point numbers you can use whatever algorithm best fits you. Or use numpy arrays; I think they implement Kahan summation or a similar algorithm.
No, we do a straightforward sum, too. Less magic in the default case.
--
Robert Kern
"I have come to believe that the whole world is an enigma, a harmless enigma
that is made terrible by our own mad attempt to interpret it as though it had
an underlying truth."
-- Umberto Eco
More information about the Python-list
mailing list