Boost logo

Boost :

Subject: Re: [boost] accurate sum accumulator (kahan)
From: Jeffrey Lee Hellrung, Jr. (jhellrung_at_[hidden])
Date: 2010-07-26 12:55:54

On 07/26/2010 09:46 AM, Simonson, Lucanus J wrote:
> David Abrahams wrote:
>> At Mon, 26 Jul 2010 16:20:16 +0100,
>> Paul A. Bristow wrote:
>>>> At Mon, 26 Jul 2010 14:59:29 +0100,
>>>> Paul A. Bristow wrote:
>>>>> PS As for naming, I'd vote for sum and accurate_sum (to keep
>>>>> backward compatibility).
>>>> It's possible I'm completely off the mark here, but I think maybe we
>>>> want sum and quick_sum.
>>> This would be ideal - but doesn't accumulator already use 'sum' so
>>> it would change behaviour of existing programs?
>> Technically, of course it would, but aren't they getting the wrong
>> answer currently?
> In the past I've had people tell me that they couldn't accept my code that gives the right answer to replace code that gives the wrong answer because it might cause their regression tests to fail. I don't think I need to tell you my opinion on that, but if you change the sum behavior you might get people who will complain. Anyone who writes a regression test that compares equality of a floating point summation result to a reference value is pretty much asking for what they would be getting. I say we do it. My position is that people use libraries expecting superior results to what they could achieve themselves with little effort (better algorithmic complexity/accuracy of outputs) and that such behavior should be the default.

Without being too familiar with the accumulators framework, wouldn't
replacing sum with the kahan summation algorithm penalize
non-floating-point types? Or worse, it will cause compiler errors,
since kahan requires subtraction?

Or is the proposition to replace the (naive) summation algorithm with
kahan summation algorithm for only floating point types?

- Jeff

Boost list run by bdawes at, gregod at, cpdaniel at, john at