GNU bug report logs -
#16987
Bad default mantissa width for ~g format string
Previous Next
Full log
View this message in rfc822 format
scheme@(guile-user)> (format #f "~g" (/ 1e100 3))
$19 = "3333333333333333000000000000000000000000000000000000000000000000000000000000000000000000000000000000.0 "
That, frankly, is pretty ludicrous. The reserved mantissa width should
at least be constrained to the actually available precision of the data
type. If it isn't, there is no useful way to output a variable with
minimal width. Using ~S instead results in the much more reasonable
"3.333333333333333e99" but it will not convert fractions to a floating
point representation:
scheme@(guile-user)> (format #f "~g" (/ 10000000000000000000000000000000 3))
$22 = "3333333333333333600000000000000.0 "
scheme@(guile-user)> (format #f "~S" (/ 10000000000000000000000000000000 3))
$23 = "10000000000000000000000000000000/3"
scheme@(guile-user)>
--
David Kastrup
This bug report was last modified 11 years and 97 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.