-
-
Notifications
You must be signed in to change notification settings - Fork 5.7k
Closed
Labels
bugIndicates an unexpected problem or unintended behaviorIndicates an unexpected problem or unintended behaviorhashing
Milestone
Description
using InteractiveUtils
using Printf
function myhash(x)
# the following is valid for x == Inf
h = UInt(0)
num, pow, den = Base.decompose(x)
den == 0 && return hash(ifelse(num > 0, Inf, -Inf), h)
return nothing
end
versioninfo()
h = hash(Inf)
@printf("%#x\n", h)
h = myhash(Inf)
@printf("%#x\n", h)
With LLVM 9 I get the expected output:
Julia Version 1.6.0-DEV.1014
Commit 2a36f83ce9 (2020-09-22 20:52 UTC)
Platform Info:
OS: macOS (x86_64-apple-darwin18.7.0)
CPU: Intel(R) Core(TM) i7-7567U CPU @ 3.50GHz
WORD_SIZE: 64
LIBM: libopenlibm
LLVM: libLLVM-9.0.1 (ORCJIT, skylake)
0x807bb202c9cbfc6f
0x807bb202c9cbfc6f
With LLVM 10 I get:
Julia Version 1.6.0-DEV.1015
Commit 9adcdd42a0 (2020-09-23 03:04 UTC)
Platform Info:
OS: macOS (x86_64-apple-darwin18.7.0)
CPU: Intel(R) Core(TM) i7-7567U CPU @ 3.50GHz
WORD_SIZE: 64
LIBM: libopenlibm
LLVM: libLLVM-10.0.1 (ORCJIT, skylake)
0x807bb202c9cbfc6f
0x15d7d083d04ecb90
Edit:
0x15d7d083d04ecb90 is the correct hash for NaN
Metadata
Metadata
Assignees
Labels
bugIndicates an unexpected problem or unintended behaviorIndicates an unexpected problem or unintended behaviorhashing