JDK 8 code review request forJDK-8024354: Explicitly permit DoubleStream.sum()/average() implementations to use higher precision summation
Joe Darcy
joe.darcy at oracle.com
Wed Oct 9 01:56:55 UTC 2013
Hello,
Please review the patch below which addresses
JDK-8024354 Explicitly permit DoubleStream.sum()/average()
implementations to use higher precision summation
Thanks,
-Joe
diff -r f1e31376f419
src/share/classes/java/util/DoubleSummaryStatistics.java
--- a/src/share/classes/java/util/DoubleSummaryStatistics.java Wed Oct
09 00:10:02 2013 +0100
+++ b/src/share/classes/java/util/DoubleSummaryStatistics.java Tue Oct
08 18:54:55 2013 -0700
@@ -118,6 +118,11 @@
* value is a {@code NaN} or the sum is at any point a {@code NaN}
then the
* sum will be {@code NaN}.
*
+ * @implNote This method may be implemented using compensated
+ * summation or other technique to reduce the error bound in the
+ * numerical sum compared to a simple summation of {@code double}
+ * values.
+ *
* @return the sum of values, or zero if none
*/
public final double getSum() {
@@ -161,6 +166,10 @@
* value is a {@code NaN} or the sum is at any point a {@code NaN}
then the
* average will be {@code NaN}.
*
+ * @implNote This method may be implemented using compensated
+ * summation or other technique to reduce the error bound in the
+ * numerical sum used to compute the average.
+ *
* @return the arithmetic mean of values, or zero if none
*/
public final double getAverage() {
More information about the core-libs-dev
mailing list