Skip to content
Snippets Groups Projects
Forked from cmucl / cmucl
Source project has a limited visibility.
user avatar
rtoy authored
exceeding the specified width.  I think the correct answer is
".0000".

So, add a parameter, allow-overflow-p, to FLONUM-TO-STRING to allow
the width constraint to be exceeded.  This defaults to T.
FLONUM-TO-STRING looks at this and decides whether or not to print out
all the leading zeroes or not.  In FIXED-FORMAT-AUX, set
allow-overflow-p to NIL so we don't exceed the width.

I wish there were another way to do this, but I can't think of one
right now.

All print tests pass, and add the following test:

(format nil "~5F" 1d-10) -> ".0000"

print.lisp:
o Change FLONUM-TO-STRING to use keyword parameters instead of
  optional parameters.
o Add :ALLOW-OVERFLOW-P, defaulting to T.
o Use :ALLOW-OVERFLOW-P to determine if all the leading zeroes should
  be printed or not.

format.lisp:
o Update calls to FLONUM-TO-STRING to use keywords parameters.
o In FIXED-FORMAT-AUX, set :ALLOW-OVERFLOW-P to NIL
a660c8de
History
Name Last commit Last update