As the Ordered trait demands, the equals method on Scala's BigDecimal class is consistent with the ordering. However, the hashcode is simply taken from the wrapped java.math.BigDecimal and is therefore inconsistent with equals.
object DecTest {
def main(args: Array[String]) {
val d1 = BigDecimal("2")
val d2 = BigDecimal("2.00")
println(d1 == d2) //prints true
println(d1.hashCode == d2.hashCode) //prints false
}
}
I can't find any reference to this being a known issue. Am I missing something?