Additional *float-format* options

Thanks to all for testing!

There’s another one, “Space”, printing a space-character instead of a plus sign:

(setq *float-format* "%g")   ; default format
(print  1.1)                 => 1.1
(print -1.1)                 => -1.1

(setq *float-format* "% g")  ; print a space instead of the + sign
(print  1.1)                 =>  1.1
(print -1.1)                 => -1.1

If you want to participate in this game, the XLISP float-format is the “format” string argument to the underlying “sprintf” C-function. Google for “ANSI C printf format” to get all options for the format string. There are three “printf” functions, “printf” prints to standard out, “fprintf” prints to a file, and “sprintf” prints into a new string, they all three use the same “format” string options. There are many other “printf” options, but only a few make sense with floating-point numbers.

The XLISP integer-format uses the same “sprintf” C-function (same game with “sprintf” format options for integers), maybe there are also more useful options for printing integers with XLISP.

I’m pretty sure that at least the ANSI C “sprintf” options today work on all systems (Windows, Mac, Linux, etc.), but testing is better…

Thanks,

  • edgar