|
91 | 91 | * |
92 | 92 | */ |
93 | 93 | public strictfp final class DD |
94 | | - implements Serializable, Comparable, Cloneable |
| 94 | + implements Serializable, Comparable<DD>, Cloneable |
95 | 95 | { |
96 | 96 | /** |
97 | 97 | * The value nearest to the constant Pi. |
@@ -985,9 +985,12 @@ public boolean isPositive() |
985 | 985 | * @param y a DoubleDouble value |
986 | 986 | * @return true if this value = y |
987 | 987 | */ |
988 | | - public boolean equals(DD y) |
| 988 | + public boolean equals(Object o) |
989 | 989 | { |
990 | | - return hi == y.hi && lo == y.lo; |
| 990 | + if (this == o) return true; |
| 991 | + if (o == null || getClass() != o.getClass()) return false; |
| 992 | + DD dd = (DD) o; |
| 993 | + return hi == dd.hi && lo == dd.lo; |
991 | 994 | } |
992 | 995 |
|
993 | 996 | /** |
@@ -1030,13 +1033,12 @@ public boolean le(DD y) |
1030 | 1033 | /** |
1031 | 1034 | * Compares two DoubleDouble objects numerically. |
1032 | 1035 | * |
| 1036 | + * @param other a DD value to compare to |
1033 | 1037 | * @return -1,0 or 1 depending on whether this value is less than, equal to |
1034 | 1038 | * or greater than the value of <tt>o</tt> |
1035 | 1039 | */ |
1036 | | - public int compareTo(Object o) |
| 1040 | + public int compareTo(DD other) |
1037 | 1041 | { |
1038 | | - DD other = (DD) o; |
1039 | | - |
1040 | 1042 | if (hi < other.hi) return -1; |
1041 | 1043 | if (hi > other.hi) return 1; |
1042 | 1044 | if (lo < other.lo) return -1; |
|
0 commit comments