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

Treat big ints as floats via feature flag "big-int-as-float" #363

Merged
merged 4 commits into from
Jan 10, 2024

Conversation

richarddd
Copy link

Currently simd-json errors when a to large integer overflows while parsing.

This PR adds a feature flag big-int-as-float that handles cases when int overflows and interprets that as a float instead.
The downside is that you loose some precision but that's ok if you opt into it and how it currently works in most JavaScript based engines.

For example:
JSON.parse("999999999999999999999999999999") in Chrome (v8) returns 1e+30

@Licenser
Copy link
Member

Good idea 👍 I like it; makes sense that in some places, not failing on icky input is more important than being 100% correct; the only thing could you add a section to the README.md where the other feature flags are listed that explains the flag and the restrictions?

@richarddd
Copy link
Author

Good idea 👍 I like it; makes sense that in some places, not failing on icky input is more important than being 100% correct; the only thing could you add a section to the README.md where the other feature flags are listed that explains the flag and the restrictions?

Done! 🥇

Copy link
Member

@Licenser Licenser left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome thank you so much :)

@Licenser Licenser merged commit 5991eae into simd-lite:main Jan 10, 2024
23 of 24 checks passed
@Licenser
Copy link
Member

released as v0.13.7

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

Successfully merging this pull request may close these issues.

3 participants