[Ecls-list] [Maxima] Maxima/ECL combination not printing a leading zero

Robert Dodier robert.dodier at gmail.com
Fri Aug 6 05:59:44 UTC 2010


On 8/5/10, Dr. David Kirkby <david.kirkby at onetel.net> wrote:

> (%i1) asinh(1.0);
> (%o1)                          .8813735870195429

Appears to be a consequence of the way ECL formats
floating point numbers. I can produce an example on Linux
so it's not specific to Solaris. e.g.

(format nil "~vf" 17 (/ 1d0 1.39239992382181823812d0))
 => ".7181844690534236"

By default Maxima calls (format nil "~vf" 17 x) where x
is the number to be formatted. It appears that sometimes
the leading 0 is omitted in order to squeeze x into 17 characters.

I think ECL's behavior is reasonable. It seems likely that the
we could make the 0 reappear by giving at least one more
character in the field width (circa line 339 in EXPLODEN in
maxima/src/commac.lisp) ... be that as it may, I'm not
inclined to do it; the number formatting stuff has been thrashed
a lot over the years and I'm not convinced this is a change
of lasting importance. Maybe someone wants to talk me into it.

A work-around might be to set the Maxima global variable
maxfpprintprec to something greater than 16 (the default).
Does that help?

FWIW

Robert Dodier




More information about the ecl-devel mailing list