The doubledouble homepage

Overview

This page describes my C++ software package `doubledouble' which
implements approximately 30 decimal place floating point arithmetic.
This code does NOT use multiple-precision or arbitrary-precision methods,
which always have a significant speed penalty. Rather, the intention is to increase
precision beyond double, while maintaining efficiency. The speed penalty
is about a 10-25 times slowdown compared to double precision. Hardware strictly conforming to IEEE 754 is essential,
though the Pentium is also acceptable since the control word is manipulated to override
the effect of double rounding.

This is the probably the simplest way to increase the precision of
existing double-precision C or C++ code. For a quick conversion of simple
programs, all that may be required to convert to doubledouble is the addition of two lines:

#include "doubledouble.h"
#define double doubledouble

and the linking of the doubledouble library.
(This is NOT the recommended method, though. See the file trydd.cc for more
sophisticated examples of usage.)

Internals

The techniques used are the well-known ones due to Dekker, Linnainmaa, Kahan, Knuth and Priest; that is, the same methods normally used for software implementations
of real*16 in Fortran compilers.
I credit Kahan with the addition algorithm (the simplification
which permits the elimination of the tests and branches is due to Knuth);
Dekker and Linnainmaa with the multiply, divide, and square root routines,
and Priest for an initial transcription into C++.

Included is a fairly complete math library, which borrows some ideas
from David Bailey's MPFUN fortran package.

Except where otherwise indicated by comments in the code, this software
is covered by the GNU Public License, as described in the included COPYLEFT notice.

The current version is 2.2. This version includes many improvements suggested
by Stefan Bauberger, Roger Schlafly, Wayne Hayes, Victor Shoup, Tony Dixon, and Alan
Miller. These include new operators, more transcendental functions,
portability enhancements, and improvements to many details.
In particular, I am grateful to Wayne Hayes for writing new output formatting
code, more overloaded operators, modf, and a new test program. Victor Shoup supplied
a fix for the non-IEEE Pentium problem.

Warning: the representable numbers in this system have a strange distribution.
For example, numbers like 1+1e-300 can be represented. This makes the concept
of machine epsilon rather ambiguous. For more information on the theory, see
this paper by Kahan.

This is a development of code formerly released as `Quad version 2.0'.
The name Quad has been dropped as the code does NOT implement the
IEEE quadruple precision format. The name `doubledouble' was chosen instead
since it is distinctive and reminds one that an unusual data type is being
used, and it describes the format of two adjacent doubles.

The code was developed with g++ 2.7.2.1 and egcs-1.0
(See egcs project home page
or UK mirror).
To use doubledouble precision complex numbers,
#include <std/complext.h>
#include <std/complext.cc>
typedef complex<doubledouble> dd_complex;

The code has been tested on:
x86-unknown-linux with gcc 2.7.2.1
mips*-sgi-irix6 with ecgs-1.0
sparc-sun-solaris2.4 with ecgs-1.0
x86-unknown-windows95 with Microsoft C++ 5.0.