number printing problems in 5.9.3 xmaxima onwindows/GCL
Subject: number printing problems in 5.9.3 xmaxima onwindows/GCL
From: Robert Dodier
Date: Tue, 29 Aug 2006 23:32:14 -0600
On 29 Aug 2006 12:47:40 -0400, Camm Maguire <camm at enhanced.com> wrote:
> Greetings! Would it be useful to have +inf, -inf, and nan symbols
> holding the respective values, and print these explicitly in a
> standard way?
Well, for Maxima, I think I'll just put #+gcl (setq si::*print-nans* t)
somewhere, to suppress the error message which is triggered
by attempting to print +/- inf or nan. That should be OK.
> I've never understood if same should be readable.
Certainly inf and -inf can be readable, because they are
unique bit patterns. Although I guess for completeness
there would have to be short-inf, single-inf, double-inf,
and long-inf.
nan is harder because there are many bit patterns
(with same exponent and different sign bit and significand)
which are all nans. If you wanted to be careful something
like #qnan(significand) and #snan(significand) could be
readable (with qnan for sign bit = 1 and snan for 0).
Or, to handle it the same as some widely-used numerical
packages, just have one nan symbol and let its value be
some specific nan value. All nans have the same
arithmetic and comparison properties, so unless
someone is smashing extra info into the significand bits
(which they're free to do according to IEEE 754)
there's no loss. As with inf, there is the same need for
short, single, double, and long variations.
>From Maxima's point of view, I don't know that it matters
much what choices are made for GCL, because we have
to try to be implementation-neutral. Be that as it may,
my recommendation is to make inf and nan readable
in some way, and to do away with si::*print-nans*
and act as if it were t.
FWIW
Robert