diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/library/scala/math/BigDecimal.scala | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/library/scala/math/BigDecimal.scala b/src/library/scala/math/BigDecimal.scala index b8dbe03db0..7312c0d2c0 100644 --- a/src/library/scala/math/BigDecimal.scala +++ b/src/library/scala/math/BigDecimal.scala @@ -178,9 +178,10 @@ extends ScalaNumber with ScalaNumericConversions /** Compares this BigDecimal with the specified value for equality. */ override def equals (that: Any): Boolean = that match { - case that: BigDecimal => this equals that - case that: BigInt => this.toBigIntExact exists (that equals _) - case x => (this <= BigDecimal.MaxLong && this >= BigDecimal.MinLong) && unifiedPrimitiveEquals(x) + case that: BigDecimal => this equals that + case that: BigInt => this.toBigIntExact exists (that equals _) + case _: Float | _: Double => unifiedPrimitiveEquals(that) + case x => isWhole && this <= BigDecimal.MaxLong && this >= BigDecimal.MinLong && unifiedPrimitiveEquals(x) } protected[math] def isWhole = (this remainder 1) == BigDecimal(0) |