Taking advantage of the double-double float support in
CMUCL, I have
implemented a quad-double package for CMUCL, based on the
quad-double
package of Yozo Hida (http://www.cs.berke
ley.edu/~yozo/). You can
find the Lisp implementation at
http:
//common-lisp.net/~rtoy/qd-2007-05-30.zip.
A quad-double is an extended-precision floating-point number
with
about 212 bits of precision with the same range as
double-float. The
package implements all of the basic arithmetic operations as
well as
the expected special functions. To make is easy to enter
quad-double
numbers, a reader macro #q has been provided. #q1.2 and
#q1q100 are
quad-double numbers. #q(1 2) is a complex quad-double
number.
The code is also portable, and I've tested the
implementation with
clisp which runs the simple test suite just fine. One minor
issue
with clisp is that you have to turn off floating-point
underflows.
A few quick examples:
QD> (sqrt #q2)
#q1.41421356237309504880168872420969807856967187537694807317
667973799q0
QD> (sqrt #q-2)
#q(0.0q0
1.4142135623730950488016887242096980785696718753769480731766
7973799q0)
QD> (log #q2)
#q0.69314718055994530941723212145817656807550013436025525412
0680009424q0
QD> (* 4 (atan #q1))
#q3.14159265358979323846264338327950288419716939937510582097
49445923q0
QD> (* 6 (asin (/ #q2)))
#q3.14159265358979323846264338327950288419716939937510582097
49445924q0
Unfortunately, there's no documentation except for whatever
is in the
code.
I hope this is useful or interesting to someone,
Ray
|