diff options
author | Lukas Rytz <lukas.rytz@typesafe.com> | 2014-12-04 17:55:25 +0100 |
---|---|---|
committer | Lukas Rytz <lukas.rytz@typesafe.com> | 2014-12-04 17:55:25 +0100 |
commit | 3b1ac0671909fef8a4aef35d62a3dc7fd7d98d9d (patch) | |
tree | d35c91c8be4f39e0309ae12f6921a7992004d00c /src/library | |
parent | 78400a1d74a44fca33d04f9d9aa68a878d286cc2 (diff) | |
parent | a151449afb247b08d470c91f090f683ebc7ba5a4 (diff) | |
download | scala-3b1ac0671909fef8a4aef35d62a3dc7fd7d98d9d.tar.gz scala-3b1ac0671909fef8a4aef35d62a3dc7fd7d98d9d.tar.bz2 scala-3b1ac0671909fef8a4aef35d62a3dc7fd7d98d9d.zip |
Merge pull request #4141 from Ichoran/issue/8970
SI-8970 hashCode of BigDecimal and Double do not match
Diffstat (limited to 'src/library')
-rw-r--r-- | src/library/scala/math/BigDecimal.scala | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/library/scala/math/BigDecimal.scala b/src/library/scala/math/BigDecimal.scala index 5a81710986..74a174ea74 100644 --- a/src/library/scala/math/BigDecimal.scala +++ b/src/library/scala/math/BigDecimal.scala @@ -417,7 +417,7 @@ extends ScalaNumber with ScalaNumericConversions with Serializable { private final def computeHashCode(): Unit = { computedHashCode = if (isWhole && (precision - scale) < BigDecimal.maximumHashScale) toBigInt.hashCode - else if (isValidDouble) doubleValue.## + else if (isDecimalDouble) doubleValue.## else { val temp = bigDecimal.stripTrailingZeros scala.util.hashing.MurmurHash3.mixLast( temp.scaleByPowerOfTen(temp.scale).toBigInteger.hashCode, temp.scale ) @@ -477,7 +477,7 @@ extends ScalaNumber with ScalaNumericConversions with Serializable { * `isExactDouble`, `isBinaryDouble`, or `isDecimalDouble`, depending on the intended meaning. * By default, `decimal` creation is used, so `isDecimalDouble` is probably what you want. */ - @deprecated("Validity has two distinct meanings. Use `isExactBinaryDouble` or `equivalentToDouble` instead.", "2.11") + @deprecated("Validity has distinct meanings. Use `isExactDouble`, `isBinaryDouble`, or `isDecimalDouble` instead.", "2.11") def isValidDouble = { val d = toDouble !d.isInfinity && bigDecimal.compareTo(new BigDec(d)) == 0 |