Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The Format function's $ directive only displays one 0 after the decimal when default is two #54

Closed
ninejaguar opened this issue Feb 18, 2019 · 3 comments

Comments

@ninejaguar
Copy link

ninejaguar commented Feb 18, 2019

Environment:
Corman Common Lisp 3.1 (Patch level 2) under Windows 10 64bit

Issue:
The Format function's $ directive fails to display ".00" as the default when preceded by a tilde. It displays ".0" instead. This fails in Corman CL, but works in SBCL 1.4.14 64bit and in Clozure CL 1.11.5 64bit when tested.

Corman CL Example1: Note the issue is that 10.0 is returned rather than 10.00.

?(format t "10 Dollars ~$ ~%" 10)
10 Dollars 10.0
NIL

SBCL Example1: SBCL produces the correct result, just as Clozure CL does.

* (format t "10 Dollars ~$ ~%" 10)
10 Dollars 10.00
NIL

Reference:

  1. CLHS: 22.3.3.4 Tilde Dollarsign: Monetary Floating-Point.
    "The full form is ~d,n,w,padchar$. The parameter d is the number of digits to print after the decimal point (default value 2); n is the minimum number of digits to print before the decimal point (default value 1); w is the minimum total width of the field to be printed (default value 0). "
    http://www.lispworks.com/documentation/lw70/CLHS/Body/22_ccd.htm
@arbv arbv closed this as completed in 2b35295 Feb 19, 2019
@arbv
Copy link
Member

arbv commented Feb 19, 2019

@ninejaguar

Thank you for reporting this!

Hopefully the issue is fixed (and no new ones were introduced).

Could you verify this one as well as the other one (#53)?

arbv added a commit that referenced this issue Feb 19, 2019
…ne 0 after the decimal when default is two
@arbv
Copy link
Member

arbv commented Feb 19, 2019

I managed to produce a better fix.

@ninejaguar, could you verify?

CormanLispBinaries.zip

@ninejaguar
Copy link
Author

It works! Thank you for taking care of it!

(format t "10 Dollars ~$ ~%" 10)
10 Dollars 10.00 
Nil

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants