mirror of
https://gitlab.com/embeddable-common-lisp/ecl.git
synced 2026-01-16 06:12:25 -08:00
format: flonum-to-string: Fix corner-case when printing "0.0".
When printing 0.0 and fdigits parameter set to 0 or nil, single "." was printed, what is not valid float number. Now it at least prints ".0". Signed-off-by: Daniel Kochmański <dkochmanski@turtle-solutions.eu>
This commit is contained in:
parent
5cbb3b905a
commit
1e2d00ed3a
1 changed files with 3 additions and 3 deletions
|
|
@ -99,11 +99,11 @@
|
|||
(declare (type float x))
|
||||
(cond ((zerop x)
|
||||
;; Zero is a special case which FLOAT-STRING cannot handle.
|
||||
(if fdigits
|
||||
(if (and fdigits (/= fdigits 0))
|
||||
(let ((s (make-string (1+ fdigits) :initial-element #\0)))
|
||||
(setf (schar s 0) #\.)
|
||||
(values s (length s) t (zerop fdigits) 0))
|
||||
(values "." 1 t t 0)))
|
||||
(values s (length s) t nil 0))
|
||||
(values ".0" 2 t nil 0)))
|
||||
(t
|
||||
(multiple-value-bind (e string)
|
||||
(cond
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue