Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

#79 format w/ floats

closed-works-for-me
nobody
Lisp (13)
5
2008-08-30
2004-06-10
hastings
No

The format function doesn't work with the float
directive. An example:

(format t "~5,2f" 123.45678)

prints ,2f

I'm not sure if this is a bug or simply an unhandled
feature.

Thanks,
John

Discussion

  • Peter Graves
    Peter Graves
    2004-06-10

    Logged In: YES
    user_id=558172

    The full version of FORMAT is not loaded at startup by
    default; you need to do (REQUIRE 'FORMAT) to make sure it's
    there, and then the bug goes away:

    Armed Bear Common Lisp 0.0.3.15+ (built Thu Jun 10 2004
    07:15:21 -0700)
    Java 1.4.2-rc1 Blackdown Java-Linux Team
    Java HotSpot(TM) Server VM
    Control-C handler installed.
    Low-level initialization completed in 1.242 seconds.
    Startup completed in 2.79 seconds.
    ; Loading /home/peter/.abclrc ...
    ; Loaded /home/peter/.abclrc (0.036 seconds)
    Type :HELP for a list of available commands.
    CL-USER(1): (format t "~5,2f" 123.45678)
    ,2f
    NIL
    CL-USER(2): :rq format
    ; Loading
    /home/peter/depot/j/src/org/armedbear/lisp/format.abcl ...
    ; Loading
    /home/peter/depot/j/src/org/armedbear/lisp/loop.abcl ...
    ; Loaded
    /home/peter/depot/j/src/org/armedbear/lisp/loop.abcl (0.507
    seconds)
    ; Loaded
    /home/peter/depot/j/src/org/armedbear/lisp/format.abcl
    (1.549 seconds)
    CL-USER(3): (format t "~5,2f" 123.45678)
    123.45678
    NIL

     
  • Peter Graves
    Peter Graves
    2004-06-10

    • status: open --> closed
     
  • hastings
    hastings
    2004-06-10

    Logged In: YES
    user_id=1039102

    For (format t "~5,2f" 123.45678), I get

    123.45678

    which is still not quite correct. It should be

    123.46

     
  • hastings
    hastings
    2004-06-10

    • status: closed --> open
     
  • Peter Graves
    Peter Graves
    2004-06-10

    Logged In: YES
    user_id=558172

    Yes, you're right. I'll leave the bug open. I probably won't
    get around to fixing it until the ANSI test suite has tests
    covering FORMAT (which probably will be fairly soon). I
    suspect there are many other bugs in the same area.

    Thanks!

     
  • Erik Huelsmann
    Erik Huelsmann
    2008-08-30

    Logged In: YES
    user_id=2169408
    Originator: NO

    I tried with today's version and it works for me now. (Without any special REQUIREs). Closing.

     
  • Erik Huelsmann
    Erik Huelsmann
    2008-08-30

    • status: open --> closed-works-for-me