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

Large integers are parsed incorrectly #53

Open
rualark opened this issue Aug 3, 2020 · 2 comments
Open

Large integers are parsed incorrectly #53

rualark opened this issue Aug 3, 2020 · 2 comments

Comments

@rualark
Copy link

rualark commented Aug 3, 2020

Example:

{"P":590595,"U":5678518811589061657,"A":942,"S":78,"C":1,"P":171632,"B":72057603339518945}

Output:
image

This seems to be a high priority issue because it garbles data.

This is probably due to limitation that js stores numbers as floats. Probably this should be fixed by either custom parsing or converting to a string.

@lahmatiy
Copy link
Member

lahmatiy commented Aug 4, 2020

Yeah, you hit the limit of number precision. You can see the same effect everywhere, e.g. in the console:
image
Possible workarounds:

  • Use strings as you suggested. That's ok maybe, but you wouldn't be able to apply math operations on such numbers.
  • Use BigInt. It also has it own drawbacks: JSON doesn't support for BigInt, jora doesn't support for BigInt, you cannot mix BigInt and other types, you need write such numbers in BitInt notation (i.e. 123n)...

Custom parsing is quite complicated to implement, however it may to be added in the future. However it doesn't solve all the problems. I don't see a quick fix right now, sorry.

@rualark
Copy link
Author

rualark commented Aug 4, 2020

Ok. Then we can show icon near the number, that it was not parsed exactly. And add tooltip with exact (string) value. In index and report views.
This approximation can cause great mistakes.

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

2 participants