We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
2.2.2
The hash proc for floats casts float to int even if these types are not of the same size.
Valid hash or error
Custom hash proc:
proc hash*(x: float): Hash {.inline.} = let y = x + 0.0 when nimvm: # workaround a JS VM bug: bug #16547 result = hashWangYi1(cast[int64](float64(y))) else: when not defined(js): when sizeof(system.int) == 4: result = hashWangYi1(cast[int64](float64(y))) else: result = hashWangYi1(cast[Hash](y)) else: result = hashWangYiJS(toBits(y))
No response
The text was updated successfully, but these errors were encountered:
So? What exactly is the problem with this?
Sorry, something went wrong.
assert hash(0.0) != hash(1.0) fails because both floats seem to get truncated to 0 before before hashWangYi1 is called.
assert hash(0.0) != hash(1.0)
No branches or pull requests
Nim Version
2.2.2
Description
The hash proc for floats casts float to int even if these types are not of the same size.
Current Output
Expected Output
Known Workarounds
Custom hash proc:
Additional Information
No response
The text was updated successfully, but these errors were encountered: