Hello,
comparing output from different implementations I've found the following (minor) bug:
(format t "~,2f" 0.999)
1.0 ;; should be 1.00
I think there is a problem here as well:
(format t "~5f" 0.00000001)
.0000 ;; should print " 0.0"
Only SBCL gives the output I would expect, most implementations print ".0000" as ABCL does. From the HyperSpec 22.3.3.1: "If the parameter d is omitted, then there is no constraint on the number of digits to appear after the decimal point. A value is chosen for d in such a way that as many digits as possible may be printed subject to the width constraint imposed by the parameter w and the constraint that ___no trailing zero digits may appear in the fraction, except that if the fraction to be printed is zero, then a single zero digit should appear after the decimal point___ if permitted by the width constraint." This problem appears only when the value is close to zero, otherwise the output is fine:
(format t "~5f" 1.00000001)
1.0 ;; OK
I guess those zero digits are not considered trailing because there is no non-zero digit before but I think the specification still requires the fraction to be printed with a single zero digit after the decimal point.
Regards,
Carlos Ungil
On 3/31/13 1:14 PM, Carlos Ungil wrote:
Hello,
comparing output from different implementations I've found the following (minor) bug:
(format t "~,2f" 0.999)
1.0 ;; should be 1.00
I think there is a problem here as well:
(format t "~5f" 0.00000001)
.0000 ;; should print " 0.0"
[…]
Recorded as ticket [314][]. Thanks for the bug report.
[314]: http://trac.common-lisp.net/armedbear/ticket/314
armedbear-devel@common-lisp.net