List Info

Thread: Quad-double implementation




Quad-double implementation
country flaguser name
United States
2007-05-30 12:23:45
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


Re: Quad-double implementation
country flaguser name
United States
2007-05-31 10:41:01
Raymond Toy wrote:
> 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. 

Oops.  That zip file is missing some files.  Look for
qd-2007-05-31.zip,
which adds the missing files and has a few additional
updates for
portability.  (I was able to build and run this on LW/ppc.)

To check that things are working, compile and load
qd-test.lisp and run
(qdi::all-tests)  The number of bits of accuracy should be
around 212
bits for all cases except too, where it is known the
algorithm is not
accurate

Sorry about that,

Ray


Quad-double implementation
country flaguser name
United States
2007-06-14 11:54:00
>>>>> "Raymond" == Raymond Toy
<raymond.toyericsson.com> writes:

    Raymond> Taking advantage of the double-double float
support in CMUCL, I have
    Raymond> implemented a quad-double package for CMUCL,
based on the quad-double
    Raymond> package of Yozo Hida (http://www.cs.berke
ley.edu/~yozo/).  You can
    Raymond> find the Lisp implementation at
    Raymond> http:
//common-lisp.net/~rtoy/qd-2007-05-30.zip. 

There's a new version at
http:
//common-lisp.net/~rtoy/qd-2007-06-14.zip. 

Mostly bug fixes and better handling of signed zeroes,
infinities, and
NaN's.  One user visible change is that #q() for reading
complex
quad-doubles needs to be written #q(#q1.1 #q2.2) to get the
components
read in as quad-doubles.  #q(1.1 1.2) reads 1.1 and 2.2 as
single-floats and converts them to quad-doubles.

Other than bug fixes, I'm basically done and don't have any
plans to
really do much with this.  I didn't have an application in
mind anyway
for this, so it was just a side project.

Ray


[1-3]

about | contact  Other archives ( Real Estate discussion Medical topics )