GNU bug report logs -
#33773
Problem with format ~g mantdigits argument
Previous Next
To reply to this bug, email your comments to 33773 AT debbugs.gnu.org.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
bug-guile <at> gnu.org
:
bug#33773
; Package
guile
.
(Sun, 16 Dec 2018 20:12:02 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Luther Thompson <lutheroto <at> gmail.com>
:
New bug report received and forwarded. Copy sent to
bug-guile <at> gnu.org
.
(Sun, 16 Dec 2018 20:12:02 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
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
This bug report was last modified 6 years and 180 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.