Skip to content
New issue

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

hash float doesn't work in JS or VM backend #16542

Closed
ringabout opened this issue Jan 1, 2021 · 4 comments
Closed

hash float doesn't work in JS or VM backend #16542

ringabout opened this issue Jan 1, 2021 · 4 comments
Assignees
Labels

Comments

@ringabout
Copy link
Member

import hashes

echo hash(0.3456)

devel

Output:

D:\QQPCmgr\Desktop\Nim\pair.js:265
          var res   = hi_xor_lo_js(hi_xor_lo_js(P0, BigInt(x_486539499) ^ P1), P58);
                                                    ^

RangeError: The number 0.3456 cannot be converted to a BigInt because it is not an integer

I will revisit #16403 and make it work for JS backend.

@timotheecour
Copy link
Member

worked in 1.2.6, fails in 1.4.0

@ringabout
Copy link
Member Author

ringabout commented Jan 2, 2021

Not really, it should return int, never return float

Nim 1.2.6

import hashes

echo hash(0.1234)

0.1234

@timotheecour
Copy link
Member

indeed, it's only a "partial regression"; depending on use case, it could've been good enough or not; but ya, this should be fixed properly

ringabout added a commit to ringabout/Nim that referenced this issue Jan 2, 2021
@ringabout
Copy link
Member Author

It doesn't work in VM too.

@timotheecour timotheecour added the VM see also `const` label label Jan 2, 2021
@timotheecour timotheecour changed the title hash float doesn't work in JS backend hash float doesn't work in JS or VM backend Jan 2, 2021
@Araq Araq closed this as completed in d8b1ffc Jan 2, 2021
@ringabout ringabout mentioned this issue Jan 2, 2021
mildred pushed a commit to mildred/Nim that referenced this issue Jan 11, 2021
ardek66 pushed a commit to ardek66/Nim that referenced this issue Mar 26, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants