Skip to content

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

@cowtowncoder

Description

@cowtowncoder

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions