[Gcl-devel] Re: [Maxima] float to bfloat



> test integer-decode-float  on NaN, Infinity, etc.
> before you decide your program is correct.   I think that
> such non-numbers should be "bigfloated" into symbols / 
> gensyms with appropriate properties.
> e.g. NaN - NaN  = NaN     (not 0).

Using gensyms (or unique subscripts or whatever) for non-standard
numbers (NSN) this way does solve a lot of problems, though Maxima
currently doesn't ever do it.  For it to be useful, you'd need to change
other parts of Maxima, too.

It fixes the problem of inf-inf=>0 etc., but it means you need a special
predicate for testing them -- both for user code and for internal code.
It also means that every such symbol needs to be *read* specially, so
that inf-inf gets interned as inf[[234]]-inf[[235]].  Then of course
you'd like to have some way of representing the unique symbol in
external form so that it can be dumped to a file and restored later....

Using gensyms this way has the interesting property that (x:NSN, x-x)
simplifies to 0 (using current simplifier), unlike (NSN-NSN), which
doesn't simplify at allThis may actually be useful and meaningful in
many cases.  For example, r:limit(sin(x),x,inf) is IND; perhaps r-r
really *should* be 0, since limit(sin(x)-sin(x),x,inf) is 0.  Are there
cases where this is NOT the right thing?

Of course rules could be added so that inf-inf=>und, inf-minf=>inf (not
the same inf), inf+1 => inf (not the same inf), etc.

You could do the same thing with intervals: x:interval(0,1)$ x-x => 0
(it is the same number, even if it is not known where it lies in 0..1)
vs. interval(0,1)-interval(0,1) => interval(-1,1).  That is assuming the
"some number" interpretation of intervals as opposed to the "all
numbers" interpretation of intervals.  This could be confusing though.

This is not rocket science, just the classic small matter of
programming....

      -s