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.berkeley.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.41421356237309504880168872420969807856967187537694807317667973799q0
    QD> (sqrt #q-2)
    #q(0.0q0 
1.41421356237309504880168872420969807856967187537694807317667973799q0)
    QD> (log #q2)
    #q0.693147180559945309417232121458176568075500134360255254120680009424q0
    QD> (* 4 (atan #q1))
    #q3.1415926535897932384626433832795028841971693993751058209749445923q0
    QD> (* 6 (asin (/ #q2)))
    #q3.1415926535897932384626433832795028841971693993751058209749445924q0

Unfortunately, there's no documentation except for whatever is in the
code.

I hope this is useful or interesting to someone,

Ray

Reply via email to