Initial request for review of JDK-8006572 DoubleStream.sum()/average() implementations that reduce numerical errors

Paul Sandoz paul.sandoz at oracle.com
Mon Nov 25 09:13:57 UTC 2013


+1

Paul.

On Nov 23, 2013, at 8:06 AM, Joe Darcy <joe.darcy at oracle.com> wrote:

> Hello Mike and Paul,
> 
> Thanks for reviewing the earlier versions of the change; I've posted an update revision for your consideration at
> 
>    http://cr.openjdk.java.net/~darcy/8006572.4/
> 
> Two numerical aspects of the change are different in this iteration:
> 
>    * when two running compensated sums and combined, the compensation portion of the second is now added in first. Since it should have smaller magnitude, this is favorable in terms of error analysis
> 
>    * the final sum returned (or used to compute the average) is (sum + sumCompensation). I checked one of my references, "Accuracy and Stability of Numerical Algorithms" from Nicholas Higham, and that tweak gave a better error bound
> 
> The test code has been updated as you've suggested (other than porting to TestNG ;-) and I also added a test case for a bug Paul spotted on an earlier review.
> 
> All the streams tests pass with the new code.
> 
> Thanks,
> 
> -Joe


More information about the core-libs-dev mailing list