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

Nix: Use mkDouble constructor for doubles #106

Merged
merged 1 commit into from
May 19, 2024
Merged

Nix: Use mkDouble constructor for doubles #106

merged 1 commit into from
May 19, 2024

Conversation

jtojnar
Copy link
Contributor

@jtojnar jtojnar commented May 19, 2024

Nix truncates floats, which makes the float literal unsuitable for keys that expect certain level of precision and reset the key otherwise, like /org/gnome/shell/world-clocks/locations.

https://www.github.com/NixOS/nix/issues/5733#issuecomment-1529002378
https://discourse.nixos.org/t/set-a-dconf-key-without-double-quotes/36142

nix-repl> builtins.toJSON [ [(-0.65740735740229495) 2.5278185274873568] [(-0.6600253512802865) 2.5301456447922108] ]
"[[-0.657407357402295,2.527818527487357],[-0.6600253512802865,2.530145644792211]]"

nix-repl> builtins.toString (-0.65740735740229495)
"-0.657407"

Fixes: #98

Nix truncates floats, which makes the float literal unsuitable for keys
that expect certain level of precision and reset the key otherwise, like
`/org/gnome/shell/world-clocks/locations`.

https://www.github.com/NixOS/nix/issues/5733#issuecomment-1529002378
https://discourse.nixos.org/t/set-a-dconf-key-without-double-quotes/36142

    nix-repl> builtins.toJSON [ [(-0.65740735740229495) 2.5278185274873568] [(-0.6600253512802865) 2.5301456447922108] ]
    "[[-0.657407357402295,2.527818527487357],[-0.6600253512802865,2.530145644792211]]"

    nix-repl> builtins.toString (-0.65740735740229495)
    "-0.657407"
@jtojnar jtojnar merged commit f966c98 into master May 19, 2024
1 check passed
@jtojnar jtojnar deleted the double branch May 19, 2024 20:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Use mkDouble for doubles
1 participant