-
Notifications
You must be signed in to change notification settings - Fork 10
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
float conversion on dump/load #73
Comments
Strange, I'm using the latest archlinux, and this is the environment of my system here is the log:
Any advice on how to debug the issue, or any other info that I should provide? |
pytomlpp is backed by a C++ library, so this would be down to differences in how the C++ implementation handles floats, versus what python does. For more context: I'm the author of the backing C++ library, toml++, and the way that I've written float handling is to exactly round-trip floats, regardless of how small the decimal component is. I suspect what's happening here is that there's some precision loss or rounding happening on in the pure-python libraries, giving you Personally I don't see this as a problem worth solving; even things as simple as compiler floating-point optimizations can break this from one build to the next so it's a bit of a crapshoot. |
Agreed, so the point is that one should avoid expecting float number to be serialized with exactly the same literal string as its wrote manually. |
Yep, with decimal representations, at least. This is a pretty common problem across the serialization space, and is usually solved via hexfloats, which TOML doesn't currently support (there's a proposal in discussion: toml-lang/toml#562) |
Thanks @marzer for clarification. I will close this for now. Looking forward for the hexfloat support and then I will update the underlying. |
not clear about the underlying conversion, is it possible to keep consistent with other python implementation?
The text was updated successfully, but these errors were encountered: