There is a subtle bug in the hashing code of Rational{<:BigInteger64}, in the file hashing2.jl, line 158:
return hash(ldexp(Float64(num),pow))
This does not pass the incoming hash argument h, and thus, while it produces the correct result when just comparing hash(3//2) with hash(1.5), it does not produce the same result for hash(3//2,h) and hash(1.5,h) for any non-zero h.
I would fix myself but I am traveling and hence not in my normal workflow.
Pinging @StefanKarpinski as I think he wrote the hashing code.
Good catch! Yes, this seems like a simple enough fix 鈥撀爅ust pass the h argument on this line:
I.e. change it to
return hash(ldexp(Float64(num), pow), h)
Then add a test to verify that this is done correctly.
Note that we're not going to backport this to 0.4 or 0.5 at this point, but I've tagged this anyway since it could be backported to those releases.
What prevents it from being backported to 0.3 though?
Only the lack of a label. I drew the line at creating a label for backports that we will never do.
Most helpful comment
Note that we're not going to backport this to 0.4 or 0.5 at this point, but I've tagged this anyway since it could be backported to those releases.