-
-
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
Print float values with full precision. #3480
base: master
Are you sure you want to change the base?
Conversation
Instead of printing at most 6 digits, print as many digits as are necessary to preserve float values exactly. See also http://www2.open-std.org/JTC1/SC22/WG21/docs/papers/2005/n1822.pdf
It's important to note that this change causes evaluation results to diverge between different versions of Nix. But maybe we shouldn't care because few people use floating point anyway. |
Is there anything I can do to help getting this merged? |
Ping |
Any news? |
I marked this as stale due to inactivity. → More info |
There is a PR related to this #6238, though it's kind of blocked on a solution like NixOS/rfcs#137 |
See also #8259: we accidentally made float printing in JSON more precise. I will mention this PR in that issue. |
Marking draft because this is old and there are conflicts. |
Instead of printing at most 6 digits, print as many digits as are
necessary to preserve float values exactly.
I did run into this when building a config file using nix which has float values requiring at least seven significant digits. With this PR the values are sometimes less pretty, but it is less surprising and makes the float values more versatile.
See also http://www2.open-std.org/JTC1/SC22/WG21/docs/papers/2005/n1822.pdf