Maxima rationals compared to CL rationals



Two items:

A

1. replacing ((rat) x y)  by the common lisp rational number produced by ( / x y) is almost always a good thing and just messy because all those Maxima rationals and testing for them must be rooted out. 
 
2. I have, in the past, tried to make a case that common lisp rationals could be extended to allow for denominators of zero, the representation for infinity as a rational would be numerator 1, denominator 0.  You can also use -1/0 and 0/0.
It doesn't hurt anything, and makes the rationals look more like IEEE floats with respect to exceptional objects.
It didn't sell.

We could have pursued this in the context of Maxima, allowing ((rat) 0 0) or ((rat) 1 0), but in Maxima we can actually throw in "symbols"  like $Infinity etc, so it is less interesting to try to make infinity out of a rational.

B 

GMP number operations are not faster than typical naive bignums until they are used on data that is more than a few words long. For allegro common lisp, it would  be a big mistake to use GMP for everything because so much of the numeric work is with rather small numbers, say less than 1024 in magnitude.  The old Franz Lisp, which we built on the VAX 11/780, had special locations for some set of numbers (typically -1024 to 1023, I think),  Doing arithmetic on these pre-allocated numbers was fast and produced no garbage.  This idea was dropped in favor of making more sophisticated compilers.




----- Original Message -----
From: Andreas Eder <aeder at arcor.de>
Date: Wednesday, August 1, 2007 1:14 pm
Subject: Re: [Maxima] Maxima rationals compared to CL rationals

> Raymond Toy wrote:
> 
> > Barton Willis wrote:
> > > Which function will compute 1 + 1/2 + ... + 1/5000 the fastest?
> >
> > Speaking of which, should we think about bringing in Richard 
> Fateman's 
> > work on making maxima work with CL rationals?  It would be nice 
> to be 
> > able to use CL rationals in the Lisp code, instead of having to 
> use 
> > ((rat) num den).
> >
> > Ray
> 
> Yes, I think this would be a worthwhile endeavour.
> Unfortunately I'm in deep with other work (hey I have to live on
> something), so I will probably not be able to help much :-(
> OK, we'll see.
> 
> 'Andreas
> _______________________________________________
> Maxima mailing list
> Maxima at math.utexas.edu
> http://www.math.utexas.edu/mailman/listinfo/maxima
>