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:
#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.)
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++ 126.96.36.199 and egcs-1.0
(See egcs project home page
or UK mirror).
To use doubledouble precision complex numbers,
typedef complex<doubledouble> dd_complex;
The code has been tested on:
x86-unknown-linux with gcc 188.8.131.52
mips*-sgi-irix6 with ecgs-1.0
sparc-sun-solaris2.4 with ecgs-1.0
x86-unknown-windows95 with Microsoft C++ 5.0.
Studies of Feigenbaum scaling in discrete dynamical systems.
Two-loop integral for radiative corrections in muon decay.
Number theory research, e.g. in LLL algorithms.
Coefficient generation and checking of double-precision algorithms for transcendental functions.
Testing sensitivity to rounding errors of existing double-precision code.
An earlier version of this code is also used in the C++ libraries
(as xdouble) and
These libraries also implement arbitrary-precision arithmetic.
The sources (not necessarily the current version) may be browsed here:
Please send reports to Keith Briggs, not forgetting to clean up the processed meat first.
Department of Plant Sciences,
University of Cambridge, Downing Street, Cambridge CB2 3EA.