Skip to content

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

Merged
Licenser merged 4 commits into
simd-lite:mainfrom
richarddd:big-int-as-float
Jan 10, 2024
Merged

Licenser merged 4 commits into
simd-lite:mainfrom
richarddd:big-int-as-float

Conversation

@richarddd

Copy link
Copy Markdown

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
Copy Markdown
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
Copy Markdown
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! 🥇

@Licenser Licenser left a comment

Copy link
Copy Markdown
Member

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
@Licenser

Copy link
Copy Markdown
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