You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by ah...@apache.org on 2023/10/02 10:29:48 UTC
[commons-numbers] branch master updated: Javadoc
This is an automated email from the ASF dual-hosted git repository.
aherbert pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-numbers.git
The following commit(s) were added to refs/heads/master by this push:
new 587763f7 Javadoc
587763f7 is described below
commit 587763f7fce57e9613b2c0f65fc58dfe37cc170f
Author: aherbert <ah...@apache.org>
AuthorDate: Mon Oct 2 11:29:25 2023 +0100
Javadoc
---
.../src/main/java/org/apache/commons/numbers/core/DD.java | 15 ++++++++++-----
1 file changed, 10 insertions(+), 5 deletions(-)
diff --git a/commons-numbers-core/src/main/java/org/apache/commons/numbers/core/DD.java b/commons-numbers-core/src/main/java/org/apache/commons/numbers/core/DD.java
index bddb39ea..7d84cee9 100644
--- a/commons-numbers-core/src/main/java/org/apache/commons/numbers/core/DD.java
+++ b/commons-numbers-core/src/main/java/org/apache/commons/numbers/core/DD.java
@@ -2242,12 +2242,17 @@ public final class DD
}
/**
- * Returns {@code true} if the values are equal according to semantics of
- * {@link Double#equals(Object)}.
+ * Returns {@code true} if the values are numerically equal.
*
- * @param x Value
- * @param y Value
- * @return {@code Double.valueof(x).equals(Double.valueOf(y))}.
+ * <p>Two {@code double} values are considered to be
+ * the same if and only if the method call
+ * {@link Double#doubleToLongBits(double) Double.doubleToLongBits(value + 0.0)}
+ * returns the identical {@code long} when applied to each value. This provides
+ * numeric equality of different representations of zero as per {@code -0.0 == 0.0},
+ * and equality of {@code NaN} values.
+ *
+ * @param x Value.
+ * @param y Value.
*/
private static boolean equals(double x, double y) {
return Double.doubleToLongBits(x + 0.0) == Double.doubleToLongBits(y + 0.0);