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

Add JsonParser.getNumberValueExact() to allow precision-retaining buffer #631

Closed
cowtowncoder opened this issue Jul 9, 2020 · 0 comments
Milestone

Comments

@cowtowncoder
Copy link
Member

There are a few databind issues:

that seem to be caused by buffering code that reads floating-point values as Doubles, leading to loss of precision for JSON (and other textual formats), and possibly issues with NaN values as well.

But it seems like there might be a simple fix: if, in case of buffering, there was a method similar to getNumberValue() but that would use BigDecimal in case of floating-point values (to preserve exact value and precision, since that is 10-based), that would solve the problem.
Conversely formats (mostly binary formats) that have concrete/physical representations of 2-based floating-point values could and should still return double / float values as appropriate: change would only occur in cases where precision loss is possible.

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

1 participant