On 11/27/07, Zou Yuan-Chuan <yuanchuan at gmail.com> wrote:
> I don't know whether it is a real bug, but...
Yep, it's a real bug, all right.
> (%i301) radcan(x^0.000000001/x^0.00000001);
>
> `rat' replaced -9.0E-9 by -1/111111111 = -9.000000008999999E-9
> Exponent out of range
A lot of the stuff to work on integers was originally coded to
exploit faster operations for fixed-size integers, which means the
code could fail if some integers turn out to be too large (and the
definition of "too large" depends on the Lisp implementation).
I believe most of that code has been cut out, and that error message
is a left-over: there is a test to detemine if 111111111 is a
"big number" (via a function named BIGNUMP), and for at least
one Lisp implementation, it is. I suspect that test (in PCOEFADD)
can be cut out, without harm.
If the above error message is causing trouble for you, you might
redefine PCOEFADD (from src/rat3a.lisp) as follows.
(defmfun pcoefadd (e c x)
(cond ((pzerop c) x)
(t (cons e (cons c x)))))
There are still some other calls to BIGNUMP. Maybe some or all
of those calls could be cut out. Maybe Andreas Eder can weigh
in on this since he spent some time revising the fixnum code.
Hope this helps,
Robert