Javadoc.
Project: http://git-wip-us.apache.org/repos/asf/commons-numbers/repo Commit: http://git-wip-us.apache.org/repos/asf/commons-numbers/commit/3f3b7ad0 Tree: http://git-wip-us.apache.org/repos/asf/commons-numbers/tree/3f3b7ad0 Diff: http://git-wip-us.apache.org/repos/asf/commons-numbers/diff/3f3b7ad0 Branch: refs/heads/feature__NUMBERS-51__field Commit: 3f3b7ad0122b37a9e831ea0eedfc7602956de5d2 Parents: b2d2267 Author: Gilles Sadowski <gil...@harfang.homelinux.org> Authored: Tue Jan 30 15:43:40 2018 +0100 Committer: Gilles Sadowski <gil...@harfang.homelinux.org> Committed: Tue Jan 30 15:43:40 2018 +0100 ---------------------------------------------------------------------- .../apache/commons/numbers/complex/Complex.java | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/commons-numbers/blob/3f3b7ad0/commons-numbers-complex/src/main/java/org/apache/commons/numbers/complex/Complex.java ---------------------------------------------------------------------- diff --git a/commons-numbers-complex/src/main/java/org/apache/commons/numbers/complex/Complex.java b/commons-numbers-complex/src/main/java/org/apache/commons/numbers/complex/Complex.java index 281822b..b1e7f50 100644 --- a/commons-numbers-complex/src/main/java/org/apache/commons/numbers/complex/Complex.java +++ b/commons-numbers-complex/src/main/java/org/apache/commons/numbers/complex/Complex.java @@ -475,7 +475,7 @@ public class Complex implements Serializable { } /** - * Get a hashCode for the complex number. + * Get a hash code for the complex number. * Any {@code Double.NaN} value in real or imaginary part produces * the same hash code {@code 7}. * @@ -489,6 +489,10 @@ public class Complex implements Serializable { return 37 * (17 * hash(imaginary) + hash(real)); } + /** + * @param d Value. + * @return a hash code for the given value. + */ private int hash(double d) { final long v = Double.doubleToLongBits(d); return (int)(v^(v>>>32)); @@ -1291,6 +1295,18 @@ public class Complex implements Serializable { return new Double(x).equals(new Double(y)); } + /** + * Check that a value meets all the following conditions: + * <ul> + * <li>it is not {@code NaN},</li> + * <li>it is not infinite,</li> + * <li>it is not zero,</li> + * </ul> + * + * @param d Value. + * @return {@code true} if {@code d} meets all the conditions and + * {@code false} otherwise. + */ private static boolean neitherInfiniteNorZeroNorNaN(double d) { if (!Double.isNaN(d) && !Double.isInfinite(d) && d != 0) { return true;