JuliaLang/julia — comment on commit 43bebc54c7e2925edac0c94900be0cec38e29abd
File:  line 0
By StefanKarpinski:

I don't think this is as bad as this. See 5f85042532ca3a8209f49ef11adff5d1c5bc5000: the basic idea is just to hash all floats with absolute value up to `typemax(Uint64)` as integers. That puts them in the same bucket as what they convert to as integers, but not as all the surrounding integers which *cannot* be represented exactly as floats. Likewise, to fix `isequal` without comparing hashes (which is admittedly a bit of a hack), we just need to compare floats with absolute value up to `typemax(Uint64)` against integers by converting the float to an integer rather than converting the integer to a float, as we do now — which loses precision. Of course you have to eliminate floats that don't truncate to themselves first before even doing the comparison — if the float doesn't truncate to itself, you needn't even look at the integer to determine that they're unequal.