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

Official website try! tab is not right for int64 #327

Open
ebwood opened this issue Mar 7, 2023 · 2 comments
Open

Official website try! tab is not right for int64 #327

ebwood opened this issue Mar 7, 2023 · 2 comments

Comments

@ebwood
Copy link

ebwood commented Mar 7, 2023

In official website https://msgpack.org/, choose Try! tab and input value like below:
Screenshot 2023-03-07 at 17 05 54

The value of age is -2^63 + 1
The result is wrong in the last byte, it should be 01 instead of 00.

@ebwood ebwood closed this as not planned Won't fix, can't repro, duplicate, stale Mar 7, 2023
@ebwood ebwood reopened this Mar 7, 2023
@DrewMcArthur
Copy link

DrewMcArthur commented Apr 23, 2023

pretty sure i'm seeing this too; both numbers 1111111111111111168 and 1111111111111111111 return the same packed value: cf 0f 6b 75 ab 2b c4 72 00 (which i think decodes to the former int, according to the spec).

@ObjectBoxPC
Copy link

This is because JavaScript numbers are IEEE 754 double-precision floating point numbers, which can't precisely represent integers that large. So when the JSON input is parsed, the resulting number may be off, which is then carried over to the MsgPack output.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants