I’m still sitting on the third rework of the Nyquist/XLISP reference and have found that there are more float-format options available than described in the old versions of the manuals.
Old - float formats already known:
"%e" - print with exponent
"%f" - print a flat float
"%g" - print the shorter version of the both above[/list]
New - additional flags and options:
+ - always print the sign
# - always print the dot, do not remove zeros after the dot
.n - number of digits after the dot
Examples
Always print the sign:
(setq *float-format* "%+g")
(print 1.1) => +1.1
(print -1.1) => -1.1
Print floats with ten digits after the dot:
(setq *float-format* "%#.10g")
(print 1.0) => 1.000000000
(print 1.0e7) => 10000000.00
(print -999.9999999e99) => -9.999999999e+101
Print floats with ten digits after the dot plus sign:
(setq *float-format* "%+#.10g")
(print 1.2345) => +1.234500000
(print -1.2345) => -1.234500000
The # is not only needed with “%g”, because “%e” and “%f” always print the dot by default.
The “new” options currently are only tested with Audacity_1.3.13 on my old Debian Linux, but they are built-ins since a long time, they only were nowhere documented, so they should work with all Audacity versions, including Audacity_1.2.x.
Could anybody test this on other Linux Systems or Windows or Mac etc. please?
Thanks,
- edgar