Skip to content

Commit

Permalink
In format-fixed-aux, don't print free form if k (scale) is non-nil
Browse files Browse the repository at this point in the history
Although the spec says "If both w and d are omitted, then the effect
is to print the value using ordinary free-format output", this
surely cannot mean that k (the scale factor) would be ignored in
that case.

See #51 and #72
  • Loading branch information
xrme committed Mar 28, 2018
1 parent f3b52e8 commit c80d02b
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions lib/format.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -346,12 +346,13 @@ and (nthcdr *format-arguments-variance* *format-arguments*)")
(declare (dynamic-extent format-arguments))
(if (null stream)
(with-output-to-string (s)
(apply #'format s control-string format-arguments))
(apply #'format s control-string format-arguments))
(if (stringp stream)
(with-output-to-string (s stream)
(apply #'format s control-string format-arguments))
(apply #'format s control-string format-arguments))
(let ((*format-top-level* t))
(when (xp-structure-p stream)(setq stream (xp-stream-stream stream))) ; for xp tests only! They call format on a structure
(when (xp-structure-p stream)
(setq stream (xp-stream-stream stream))) ; for xp tests only! They call format on a structure
(setq stream (if (eq stream t)
*standard-output*
(require-type stream 'stream)))
Expand Down Expand Up @@ -1824,7 +1825,8 @@ and (nthcdr *format-arguments-variance* *format-arguments*)")

(defun format-fixed-aux (stream number w d k ovf pad atsign)
(and w (<= w 0) (setq w nil)) ; if width is unreasonable, ignore it.
(if (not (or w d))
(if (and (not k)
(not (or w d)))
(print-float-free-form number stream)
(let ((spaceleft w)
(abs-number (abs number))
Expand Down

0 comments on commit c80d02b

Please sign in to comment.