Closed plokhotnyuk closed 5 years ago
I have tried v0.5.4 but rounding still occurs for some values.
Inputs:
1.199999988079071
3.4028235677973366e38
7.006492321624086e-46
Expected output:
1.1999999
3.4028235E38
1.4E-45
Actual output:
1.2
Infinity
0.0
Current code from the master branch parses floats with rounding where error ~1ULP that is greater than expected ~0.5ULP of
java.lang.Float.valueOf()
.The rounding error can be easy reproduced when parsing string representation of some values with number of digits greater than usually used for floats.
The detailed explanation is in this comment
The following code can print lot of such numbers after increasing number of iterations:
I see that ScalikeJackson behave exactly as original Jackson, but could you, please, consider documenting this rounding if there are no other option available.
And, also, because it differs how Play-JSON parse floats in its latest release: