You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The reasons is that Document has only one type for all numeric values - DNumber that is backed by BigDecimal.
Some json encoders including the one from jsonitter perform a clever optimization in order to render float values in an optimal way. That can't done on the right side because we lost the information that it was a single precision floating point number.
The left side will encode 123.4 float value as 123.4 json number literal. On the right hand side we will instead get 123.4000015258789 which is the closest number that can be represented in binary format when using IEEE 754 encoding.
While this is not an issue for IEE 754 compatible parsers (so almost everyone), extending the Document ADT with more granular types for numeric values will allow greater control over how are they encoded when going through the Document type.
The text was updated successfully, but these errors were encountered:
For some values following doesn't hold
The reasons is that
Document
has only one type for all numeric values -DNumber
that is backed byBigDecimal
.Some json encoders including the one from jsonitter perform a clever optimization in order to render float values in an optimal way. That can't done on the right side because we lost the information that it was a single precision floating point number.
The left side will encode
123.4
float value as123.4
json number literal. On the right hand side we will instead get123.4000015258789
which is the closest number that can be represented in binary format when using IEEE 754 encoding.While this is not an issue for IEE 754 compatible parsers (so almost everyone), extending the
Document
ADT with more granular types for numeric values will allow greater control over how are they encoded when going through theDocument
type.The text was updated successfully, but these errors were encountered: