DoubleDouble.java is a JavaTM API
which uses the DoubleDouble technique
to provide twice the precision of IEEE-754 floating point numbers.
It implements a floating-point representation which
maintains 106 bits (approximately 30 decimal digits) of precision.
The range of values which can be represented is the same as in IEEE-754. (i.e. ± ~10-323 to ~10308) The precision of the representable numbers is twice as great as IEEE-754 double precision (i.e. approximately 30 digits of precision versus 15 digits)
The implementation uses a representation containing two double-precision values. A number x is represented as a pair of doubles, x.hi and x.lo, such that the number represented by x is x.hi + x.lo, where
|x.lo| <= 0.5*ulp(x.hi), (*)and ulp(y) means "unit in the last place of y".
Arithmetic operations are implemented using convenient properties of IEEE-754 floating-point arithmetic. The correctness of the arithmetic algorithms relies on operations being performed with standard IEEE-754 double precision and rounding. This is the standard floating point behaviour in Java. However, for performance reasons Java implementations are not constrained to use this standard. Some processors (notably the Intel Pentium architecure) perform floating point operations in extended precision (e.g. 80 bits for Intel FP). To ensure that DoubleDouble operations are computed using the correct arithmetic mode, the Java strictfp modifier is used.
Use CasesDoubleDouble has been used for:
Examples(The following examples are computed by sample applications provided with the software distribution)
CreditsThis implementation uses algorithms originally designed variously by Knuth, Kahan, Dekker, and Linnainmaa. Douglas Priest developed the first C implementation of these techniques. Other more recent C++ implementation are due to Keith M. Briggs and David Bailey et al.
JavaTM is a trademark of Sun Microsystems, Inc. in the United States and other countries.