Feature suggestion: sum() ought to use a compensated summation algorithm

Gabriel Genellina gagsl-py2 at yahoo.com.ar
Tue May 6 01:18:16 EDT 2008


En Mon, 05 May 2008 05:08:15 -0300, Raymond Hettinger <python at rcn.com>  
escribió:

> On May 3, 9:50 am, Szabolcs Horvát <szhor... at gmail.com> wrote:
>> I did the following calculation:  Generated a list of a million random
>> numbers between 0 and 1, constructed a new list by subtracting the mean
>> value from each number, and then calculated the mean again.
>>
>> The result should be 0, but of course it will differ from 0 slightly
>> because of rounding errors.
>
> See:
> http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/393090

Awesome!

> See:
> http://svn.python.org/view/sandbox/trunk/statistics/statistics.py?rev=40981&view=markup

Wonderful!

-- 
Gabriel Genellina




More information about the Python-list mailing list