Skip to content
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

rather simple decimal floats are converted to scientific / "E" notation #244

Closed
WilliButz opened this issue Aug 28, 2024 · 2 comments · Fixed by #246
Closed

rather simple decimal floats are converted to scientific / "E" notation #244

WilliButz opened this issue Aug 28, 2024 · 2 comments · Fixed by #246
Labels
bug Something isn't working

Comments

@WilliButz
Copy link
Member

Description

Literal floats that I'd consider short and simple enough to represent them in decimal notation are reformatted to scientific / e notation.
I didn't find any specific reasoning about this behavior and I find it quite unexpected, therefore this issue.

Small example input

{ a = 0.2; b = 0.068; c = 0.009; }

Expected output

{
  a = 0.2;
  b = 0.068;
  c = 0.009;
}

Actual output

{
  a = 0.2;
  b = 6.8e-2;
  c = 9.0e-3;
}
@dasJ dasJ added the bug Something isn't working label Aug 28, 2024
@infinisil
Copy link
Member

Damn, I don't even think I knew that Nix supports scientific notation, nor that nixfmt rewrites floats in that way. Definitely should be fixed!

@infinisil
Copy link
Member

Fix in #246

@github-project-automation github-project-automation bot moved this from Todo to Done in Nix formatting Sep 3, 2024
mweinelt added a commit to NixOS/infra that referenced this issue Jan 12, 2025
mweinelt added a commit to NixOS/infra that referenced this issue Jan 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

3 participants