From 52bbbaeb09859b02561a1895f0516e094b2f9d67 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Na=C3=AFm=20Favier?= Date: Fri, 9 Sep 2022 15:39:35 +0200 Subject: [PATCH] nixos/doc/option-types: add precision loss warning for floats --- nixos/doc/manual/development/option-types.section.md | 5 +++++ .../manual/from_md/development/option-types.section.xml | 9 +++++++++ 2 files changed, 14 insertions(+) diff --git a/nixos/doc/manual/development/option-types.section.md b/nixos/doc/manual/development/option-types.section.md index 7864b62605c2..40b4d78b250e 100644 --- a/nixos/doc/manual/development/option-types.section.md +++ b/nixos/doc/manual/development/option-types.section.md @@ -140,6 +140,11 @@ merging is handled. : A floating point number. + ::: {.warning} + Converting a floating point number to a string with `toString` or `toJSON` + may result in [precision loss](https://github.com/NixOS/nix/issues/5733). + ::: + `types.number` : Either a signed integer or a floating point number. No implicit conversion diff --git a/nixos/doc/manual/from_md/development/option-types.section.xml b/nixos/doc/manual/from_md/development/option-types.section.xml index e207b97a46f8..4036bc0ba743 100644 --- a/nixos/doc/manual/from_md/development/option-types.section.xml +++ b/nixos/doc/manual/from_md/development/option-types.section.xml @@ -256,6 +256,15 @@ A floating point number. + + + Converting a floating point number to a string with + toString or toJSON + may result in + precision + loss. + +