diff options
author | Adrien Hopkins <ahopk127@my.yorku.ca> | 2021-03-13 14:58:01 -0500 |
---|---|---|
committer | Adrien Hopkins <ahopk127@my.yorku.ca> | 2021-03-13 14:58:01 -0500 |
commit | 8def3bbda9331b9178e24400d8189afbdaf47e36 (patch) | |
tree | 7801eb5935624619a1b18e4ede32b74653117552 /src/org/unitConverter/math/UncertainDouble.java | |
parent | 77a798f3da39731886b55f0036be2af7dfa44263 (diff) |
Small internal changes to some classes (no feature changes)
Diffstat (limited to 'src/org/unitConverter/math/UncertainDouble.java')
-rw-r--r-- | src/org/unitConverter/math/UncertainDouble.java | 13 |
1 files changed, 4 insertions, 9 deletions
diff --git a/src/org/unitConverter/math/UncertainDouble.java b/src/org/unitConverter/math/UncertainDouble.java index 9601c75..3651bd5 100644 --- a/src/org/unitConverter/math/UncertainDouble.java +++ b/src/org/unitConverter/math/UncertainDouble.java @@ -164,11 +164,9 @@ public final class UncertainDouble implements Comparable<UncertainDouble> { if (!(obj instanceof UncertainDouble)) return false; final UncertainDouble other = (UncertainDouble) obj; - if (Double.doubleToLongBits(this.uncertainty) != Double - .doubleToLongBits(other.uncertainty)) + if (Double.compare(this.value, other.value) != 0) return false; - if (Double.doubleToLongBits(this.value) != Double - .doubleToLongBits(other.value)) + if (Double.compare(this.uncertainty, other.uncertainty) != 0) return false; return true; } @@ -216,11 +214,8 @@ public final class UncertainDouble implements Comparable<UncertainDouble> { public final int hashCode() { final int prime = 31; int result = 1; - long temp; - temp = Double.doubleToLongBits(this.uncertainty); - result = prime * result + (int) (temp ^ temp >>> 32); - temp = Double.doubleToLongBits(this.value); - result = prime * result + (int) (temp ^ temp >>> 32); + result = prime * result + Double.hashCode(this.value); + result = prime * result + Double.hashCode(this.uncertainty); return result; } |