Bump... I've run in to this while running tests that check computation results against the expected bounds of a Kahan summation. Any chance that this gets picked up in the near future?
Thanks, Chris On 12/13/18, 6:16 PM, "core-libs-dev on behalf of Ivan Gerasimov" <core-libs-dev-boun...@openjdk.java.net on behalf of ivan.gerasi...@oracle.com> wrote: Gentle ping. On 12/9/18 7:37 PM, Ivan Gerasimov wrote: > Hello! > > DoubleSummaryStatistics takes advantage of Kahan summation algorithm > to reduce the error of the total sum. > > Internally it maintains a field double sumCompensation, which keeps > lower bits (which were rounded off) of the last addition. > > Note, that the compensation has to be subtracted from the result to > add those bits back: > > 166 private void sumWithCompensation(double value) { > 167 double tmp = value - sumCompensation; > 168 double velvel = sum + tmp; // Little wolf of rounding error > 169 sumCompensation = (velvel - sum) - tmp; > 170 sum = velvel; > 171 } > > At the line 169, tmp normally has more lower bits than (velvel - sum). > > However, when two DoubleSummaryStatistics objects are combined, this > compensation part is *added* to the total, which may result in a less > accurate result. > > The same bug is replicated in DoubleStreams. > > Would you please help review the fix? > > BUGURL: https://bugs.openjdk.java.net/browse/JDK-8214761 > WEBREV: http://cr.openjdk.java.net/~igerasim/8214761/00/webrev/ > -- With kind regards, Ivan Gerasimov