From a5e237635079a57d2e377313eb9c3aaddc2c2d4d Mon Sep 17 00:00:00 2001 From: Tom Hubrecht Date: Tue, 18 Mar 2025 13:40:47 +0100 Subject: [PATCH] documentation: Explain how a float will be transformed into a string `prim_toString` uses `state.coerceToString`, which in turns defers to `std::to_string` for floats, which 'Converts a floating point value to a string as if by std::sprintf(buf, "%f", value)'. Finally, the `%f` specifier 'Converts floating-point number to the decimal notation in the style [-]ddd.ddd. Precision specifies the exact number of digits to appear after the decimal point character. The default precision is 6.' Closes #747 Change-Id: I42339651005d20f272459cf9f80b274f2076b1e3 --- lix/libexpr/builtins/toString.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lix/libexpr/builtins/toString.md b/lix/libexpr/builtins/toString.md index 1db5cd91a..bdc009f13 100644 --- a/lix/libexpr/builtins/toString.md +++ b/lix/libexpr/builtins/toString.md @@ -13,6 +13,8 @@ Convert the expression *e* to a string. *e* can be: - An integer. + - A floating-point value, it will be converted to the decimal notation in the style `[-]ddd.ddd` with 6 digits appearing after the decimal point. + - A list, in which case the string representations of its elements are joined with spaces.