floating point FORMAT
Bug #308961 reported by
Nikodemus Siivola
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
SBCL |
Fix Released
|
Medium
|
Unassigned |
Bug Description
(format nil "~4,1F" 0.001) => "0.00" (should be " 0.0");
(format nil "~4,1@F" 0.001) => "+.00" (should be "+0.0").
(format nil "~E" 0.01) => "10.e-3" (should be "1.e-2");
(format nil "~G" 0.01) => "10.e-3" (should be "1.e-2");
Changed in sbcl: | |
importance: | Undecided → Medium |
status: | New → Confirmed |
Changed in sbcl: | |
assignee: | nobody → David Vázquez (davazp) |
tags: | added: review |
Changed in sbcl: | |
assignee: | David Vázquez (davazp) → Nikodemus Siivola (nikodemus) |
status: | Confirmed → In Progress |
tags: | added: floating-point |
Changed in sbcl: | |
status: | Fix Committed → Fix Released |
To post a comment you must log in.
I attach a patch for these bugs.
The first bug, corresponding to two first expressions, it is due to flonum-to-digits tries to accept positive numbers,
however when it rounds, it could be zero. I fix flonum-to-digits to accept non-negative numbers.
The second bug, corresponding to two last expressions, it is due to format-exp-aux assumes the value returned
from scale-exponent is in (0.1, 1.0), though 1.0 could be reached.