number printing problems in 5.9.3.99rc2 xmaxima on windows/GCL
Subject: number printing problems in 5.9.3.99rc2 xmaxima on windows/GCL
From: Richard Fateman
Date: Mon, 28 Aug 2006 13:23:34 -0700
I think it would lead to confusion if there were two objects that were
different but printed the same. So a floating point infinity should
look different from the atom $inf. Or alternatively, we could make them
REALLY the same, not just on output. The treatment of inf and floating
inf are inconsistent at the moment.
They are not really the same, in my mind. the float-inf is merely a
placeholder for
"a computational result larger than about 1.8e308" which is not nearly
infinity :)
Making infinity numerically evaluate to an IEEE infinity might be of
some use, but more likely it would also lead to inconsistencies. I
think it is unlikely that anything useful would come from evaluating
f(undefined) as f(NaN), since the result of any computation with a NaN
should be a NaN, and maybe it would be better to leave it as f(NaN).?
(I also found that in ..99rc,
(setf si:*print-nans* t)
(setf $r (expt 10.0 10000)) ;make infinity..
(%i6) r;
(%o6) 1..#INF00e+000E+2284808
(%i7) r+r;
(%o7) 1..#INF00e+000E+2284808
(%i8) r-r;
Maxima encountered a Lisp error:
Error in EVAL [or a callee]: Bind stack overflow.
Robert Dodier wrote:
> On 8/28/06, Richard Fateman <fateman at cs.berkeley.edu> wrote:
>
>> I think it is better to intercept such exceptional operands on their way
>> to getting printed, which requires only a small change in nformat. We
>> need a way to test for "exceptional-number", and checking for inf (+ or
>> -) and NaN.
>
>
> Agreed. If we intercept, we can ensure that the printed output is
> the same on any Lisp implementation which allows special values
> to be computed.
>
> I am inclined to use the existing symbols inf and minf to print
> positive and negative floating point infinities, and use the symbol nan
> to print not-a-number. (ind and und are other possibilities, but I don't
> know that the treatment of und and ind is consistent with not-a-number.)
>
> I would further suggest assigning a a $numer property for inf and minf,
> and maybe nan, so that they evaluate to the corresponding floating point
> values when requested. Dunno how well that's going to fly.
>
>> Note that not all NaNs are bitwise the same. They just have a pecular
>> exponent.
>
>
> Yes. There are ranges of values, all of which are not-a-numbers.
> If we wanted to get nutty we could output something like
> nan(7FFF000000000000) or whatever to disambiguate.
>
> Robert