Author steven.daprano
Recipients agthorr, belopolsky, christian.heimes, ethan.furman, gregory.p.smith, mark.dickinson, oscarbenjamin, pitrou, ronaldoussoren, sjt, steven.daprano, stutzbach, terry.reedy, tshepang, vajrasky
Date 2013-08-26.15:07:58
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1377529681.12.0.801241568699.issue18606@psf.upfronthosting.co.za>
In-reply-to
Content
I have changed the algorithm for statistics.sum to use long integer summation of numerator/denominator pairs.

This removes the concerns Mark raised about the float addition requiring correct rounding. Unless I've missed something, this now means that statistics.sum is now exact, including for floats and Decimals.

The cost is that stats.sum(ints) is a little slower, sum of Decimals is a lot slower (ouch!) but sum of floats is faster and of Fractions a lot faster. (Changes are relative to my original implementation.) In my testing, algorithmic complexity is O(N) on the number of items, at least up to 10 million items.
History
Date User Action Args
2013-08-26 15:08:01steven.dapranosetrecipients: + steven.daprano, terry.reedy, gregory.p.smith, ronaldoussoren, mark.dickinson, belopolsky, pitrou, agthorr, christian.heimes, stutzbach, sjt, ethan.furman, tshepang, oscarbenjamin, vajrasky
2013-08-26 15:08:01steven.dapranosetmessageid: <1377529681.12.0.801241568699.issue18606@psf.upfronthosting.co.za>
2013-08-26 15:08:01steven.dapranolinkissue18606 messages
2013-08-26 15:08:00steven.dapranocreate