Precision of float and bfloat



Let me preface these remarks by saying that the Common Lisp
spec doesn't recognize any non-numerical floats, such as IEEE
754 infinity and not-a-number. This is a serious gap, which, in
all probability, will never be remedied. Some CL implementations
handle non-numeric floats as a non-standard extension.
Generally speaking we have to work around such values.

On 10/15/09, reyssat <eric.reyssat at math.unicaen.fr> wrote:

> (%i5) f(200);
> 1.0b0
> Maxima encountered a Lisp error:
>  Error in PROGN [or a callee]: Can't print a non-number.

This is a bug in GCL: it has computed a non-numeric float
(from some C code) but it cannot display it.

> **** bfloat is ok. But float cannot calculate this since some
> intermediate result is too big (once again, is the limit for the
> exponent given in the documentation ?), although the result itself is a
> perfectly nice number. Would it be possible to improve the float
> algorithm to avoid this problem ?

I agree that the algorithm for the float function is naive.
Instead of just plugging in floats to get a float result, it would
be more useful try to find the floating point value closest to
the exact value of the expression. That's probably a lot of work,
and for my part, I don';t know how to do it.

best

Robert Dodier