Skip to content

Commit

Permalink
fix hashing of Rational{<:Integer} (fixes #25814) (#25817)
Browse files Browse the repository at this point in the history
  • Loading branch information
Jutho authored and JeffBezanson committed Jan 30, 2018
1 parent f11d820 commit 9d5aebb
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion base/hashing2.jl
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ function hash(x::Rational{<:BitInteger64}, h::UInt)
den >>= pow
pow = -pow
if den == 1 && abs(num) < 9007199254740992
return hash(ldexp(Float64(num),pow))
return hash(ldexp(Float64(num),pow),h)
end
end
h = hash_integer(den, h)
Expand Down
1 change: 1 addition & 0 deletions test/hashing.jl
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ for T = types[2:end],
x = vals,
a = coerce(T, x)
@test hash(a,zero(UInt)) == invoke(hash, Tuple{Real, UInt}, a, zero(UInt))
@test hash(a,one(UInt)) == invoke(hash, Tuple{Real, UInt}, a, one(UInt))
end

for T = types,
Expand Down

0 comments on commit 9d5aebb

Please sign in to comment.