RFR 8005311: Add Scalable Updatable Variables, DoubleAccumulator, DoubleAdder, LongAccumulator, LongAdder
howard.lovatt at gmail.com
Mon Jan 14 06:18:59 UTC 2013
If you make a binary tree and sum it, the rounding errors aren't that bad and this algorithm is easy to parallelise.
Higham, Nicholas J 1993 the accuracy of floating point summation SIAM Sci Comp 14 (4) 783-799
Also see Wikipedia for a description of Kahan summation and a general discussion of this topic.
Why not commit to binary tree reductions and that will allow everyone to understand what is going on and design lambdas accordingly.
Sent from my iPad
On 13/01/2013, at 2:04 AM, Doug Lea <dl at cs.oswego.edu> wrote:
> On 01/11/13 21:37, Joe Darcy wrote:
>> I would prefer to cautionary note along the lines of "if you want numerical
>> accuracy, take care to use a summation algorithm with defined worst-case behavior."
>> (Varying magnitude is not so much of a problem if you add things up in the right
> Thanks. I do not believe such an algorithm exists, because
> no ordering control is possible, and all other known accuracy
> improvements (like Kahn) require multiword atomicity, which we
> explicitly do not provide.
> Which leaves me thinking that the current disclaimer (below)
> is the best we can do.
>>>> "The order of accumulation within or across threads is not guaranteed.
>>>> Thus, this class may not be applicable if numerical stability is
>>>> required, especially when combining values of substantially different
>>>> orders of magnitude."
More information about the core-libs-dev