-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
json: insufficient precision for float64 serialization #15397
Comments
See related discussion discussing |
@timotheecour : By 'riu' did you mean 'ryu' as in https://github.com/ulfjack/ryu ? |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Nim's standard json module serializes
float
numbers with 16 significant decimal digitsNim/lib/system/formatfloat.nim
Line 32 in fe3211f
which is insufficient to represent all of 64 bit IEEE-754 floats. One needs at least 17 significant decimal digits, see https://en.wikipedia.org/wiki/Double-precision_floating-point_format for details.
The following MWE shows the problem and a possible solution that changes precision from 16 to 17 digits.
MWE
Additional Information
The text was updated successfully, but these errors were encountered: