MATH-1617: Ensure that "hashCode" is consistent with "equals".
This commit is contained in:
parent
8cd59b991e
commit
30a2593c2c
|
@ -323,7 +323,7 @@ public class BigReal implements FieldElement<BigReal>, Comparable<BigReal>, Seri
|
||||||
/** {@inheritDoc} */
|
/** {@inheritDoc} */
|
||||||
@Override
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
return d.hashCode();
|
return Double.hashCode(d.doubleValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
/** {@inheritDoc} */
|
/** {@inheritDoc} */
|
||||||
|
|
|
@ -178,6 +178,7 @@ public class BigRealTest {
|
||||||
BigReal oneWithScaleOne = new BigReal(new BigDecimal("1.0"));
|
BigReal oneWithScaleOne = new BigReal(new BigDecimal("1.0"));
|
||||||
BigReal oneWithScaleTwo = new BigReal(new BigDecimal("1.00"));
|
BigReal oneWithScaleTwo = new BigReal(new BigDecimal("1.00"));
|
||||||
Assert.assertEquals(oneWithScaleOne, oneWithScaleTwo);
|
Assert.assertEquals(oneWithScaleOne, oneWithScaleTwo);
|
||||||
|
Assert.assertEquals(oneWithScaleOne.hashCode(), oneWithScaleTwo.hashCode());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
Loading…
Reference in New Issue