I'm running Guile 2.2.4 on GuixSD. In the documentation for `format`[0], under `~g`, it says this about the mantdigits argument:
"When fixed-point is used, the decimals parameter to ~f is established from mantdigits, so as to give a total mantdigits+1 figures." The example just above this sentence contradicts this, as we can see here: ---BEGIN--- $ guile GNU Guile 2.2.4 Copyright (C) 1995-2017 Free Software Foundation, Inc. Guile comes with ABSOLUTELY NO WARRANTY; for details type `,show w'. This program is free software, and you are welcome to redistribute it under certain conditions; type `,show c' for details. Enter `,help' for help. scheme@(guile-user)> (format #f "~,4g" 999) $1 = "999.0 " scheme@(guile-user)> (format #f "~,4g" 100000) $2 = "1.0000E+5" ---END--- When ~g uses fixed-point, it shows mantdigits significant digits. When ~g uses an exponent, it shows mantdigits+1 significant digits. I think it's important that ~g does not change the number of significant digits depending on fixed-point vs. exponential. Also, I think ~g should show a number of significant digits equal to mantdigits. In my opinion, this would be more intuitive than adding 1, and would be more in line with C's printf. (I figure it's worth it to ask for this, because fixing this bug means having to choose between the two behaviors anyway. I don't know if backward compatibility factors into this.) uname -a: Linux targaryen 4.19.6-gnu #1 SMP 1 x86_64 GNU/Linux [0] https://www.gnu.org/software/guile/manual/html_node/Formatted-Output.html#Formatted-Output Luther
