hash(big(pi)) == hash(float64(pi)) && big(pi) != float64(pi). #3385
Labels
breaking
This change will break code
bug
Indicates an unexpected problem or unintended behavior
needs decision
A decision on this change is needed
Milestone
The problem seems to be that
hash(x::FloatingPoint)
callshash64(float64(x))
, implicitly assuming thatFloat64
is the widest possible floating-point type.A lot of the mess here seems to stem from an attempt to make
x == y
implyhash(x) == hash(y)
even ifx
andy
are arbitrarily different types. This seems unworkable to me in the long run, as more numeric types are added. Especially user-defined types. However, the converse should certainly be true:x != y
should implyhash(x) != hash(y)
(except in the extremely unlikely event of a hash collision).The text was updated successfully, but these errors were encountered: