On 3/5/2011 7:52 AM, Barton Willis wrote:
> ----maxima-bounces at math.utexas.edu wrote: -----
>
>> Do you know how maxima does rational addition? Maybe gcl's gcd algorithm is slow?
> The function addk (src/simp.lisp) does rational number addition. The function addk
> has several calls to truncate.
Not when I tried it.
> I don't know what truncate does, but try tracing
> addk, timeskl, truncate and add 1/2 + 1/2. Why does addk call truncate with
> with such weird arguments? (example (TRUNCATE 8112052 10000) and (TRUNCATE 7488048 10000)).
Huh indeed. Not when I tried tracing etc. No call to truncate. Maybe
because I was using wxmaxima, and
you were not, and those calls had to do with display??
addk is a pretty bad program for adding 1/2 + 1/2. If Maxima used
common lisp rational numbers
for 1/2 etc instead of making up its own kind of rational number that
looks like ((rat simp) 1 2),
it would be many times faster on most lisps. On GCL, the built-in
rationals are surprisingly slow.
Note that when Macsyma was written in Maclisp, Common Lisp did not
exist, and Maclisp had only
integers and floats, so the ((rat) 1 2) construction made up for that lack.
> Huh?
>
> --Barton
>
RJF