common lisp complex numbers, also common lisp rational numbers
Subject: common lisp complex numbers, also common lisp rational numbers
From: Richard Fateman
Date: Thu, 01 Mar 2012 22:09:00 -0800
On 3/1/2012 1:30 PM, Steve Haflich wrote:
>
> One could of course modify an exiting CL implementation to make all the
> desired functions generic, but this would be a larger,
> more-destabilizing, and more performance-killing job than one first
> might think. But I do agree it would be a neat thing to have!
a generic arithmetic system for CL with many (all?) the "data types" in
Maxima
is posted in http://www.cs.berkeley.edu/~fateman/generic, using mpfr for
bigfloats. It also has some data types not in Maxima like intervals,
quad-precision.
It even has a compiler. The difficulty remains that many of the
coercions are
not obvious. what do you do with interval + complex + symbol. etc.
This code is more of a proof of concept than otherwise. Though I've used
parts of it repeatedly. It uses allegro common lisp / foreign function
interface
for some things; this can be run in a free version, or you can leave off
those pieces relying on external libmpfr.dll, libgmp, qd.dll