Skip to content

Review: A Floating-Point Technique for Extending the Available Precision

Citation

  • Dekker, T. J. (1971). A floating-point technique for extending the available precision. Numerische Mathematik, 18(3), 224–242.
  • DOI

Abstract

A technique is described for expressing multilength floating-point arithmetic in terms of singlelength floating point arithmetic, i.e. the arithmetic for an available (say: single or double precision) floating-point number system. The basic algorithms are exact addition and multiplication of two singlelength floating-point numbers, delivering the result as a doublelength floating-point number. A straightforward application of the technique yields a set of algorithms for doublelength arithmetic which are given as ALGOL 60 procedures.


The paper represents a number of twice the working precision as "the sum of two singlelength floating-point numbers, one of them being (almost) negligeable in singlelength precision" (p. 224). The two building blocks are an exact sum and an exact product, each returned as such a pair. The author writes the algorithms "entirely in a high-level language", without a double-length accumulator, so that they can use the widest format a machine has (p. 225).

Exact addition

For \(z = fl(x + y)\), the correction term \(zz\) that satisfies \(z + zz = x + y\) exactly is (p. 228, formula 4.3)

\[w = fl(z - x), \qquad zz = fl(y - w).\]

Theorem 4.7 proves this for radix 2 or 3 with optimal (correctly rounded) addition and faithful subtraction, when the exponents satisfy \(e_x \ge e_y\), which holds when \(|x| \ge |y|\) (p. 228). Corollary 4.15 gives the same result for the equivalent form \(zz = fl(fl(x - z) + y)\) (p. 230). This is the algorithm that later literature calls FastTwoSum. "In the applications, it will often be necessary to interchange the roles of the terms x and y when \(|x| < |y|\)" (p. 230). For operands in either order, the paper gives a longer formula and attributes its proof to Møller (1965) and Knuth (1969) (p. 231, Theorem 4.17).

The paper also notes the limit of the result: with normalized numbers, "underflow may occur in forming zz", and the theorems then do not hold (p. 229, Remark 1).

Exact multiplication

The exact product splits each factor into a head and a tail of about half the precision (p. 232). For a \(t\)-bit format, the head \(h_x\) has \(t_2 = \lfloor t/2 \rfloor\) bits, rounded to nearest, and the tail is \(t_x = x - h_x\). Each of the four partial products \(h_x h_y\), \(h_x t_y\), \(t_x h_y\) and \(t_x t_y\) then fits in \(t\) bits, so it is computed without error (p. 232, formulas 5.7 and 5.8), and an exact addition combines them (Theorem 5.11). The split itself is computed with the constant \(c = 2^{t_1} + 1\) (p. 234, Theorem 6.3):

\[p = fl(x \cdot c), \qquad h_x = fl(fl(x - p) + p), \qquad t_x = fl(x - h_x).\]

The analysis of Section 5 assumes binary arithmetic and disregards overflow and underflow (p. 231).

Double-length arithmetic

Section 7 builds double-length addition, subtraction, multiplication, division and square root from the two exact operations, and gives each as an ALGOL 60 procedure (pp. 235–242). The addition add2 has an error that is small "with respect to the sum of the magnitudes of the terms", but "the relative error of the doublelength sum, however, is not always small, because severe cancellation may take place" (p. 237). Joldes, Muller and Popescu (2017) later analyze this algorithm as SloppyDWPlusDW, and the multiplication mul2 as DWTimesDW1.

Relevance to Hifuku

Hifuku's WGSL float-float library uses both of the paper's exact operations.

  • FastTwoSum is the default form of the exact sum. The library orders the operands with a branch, \(|a| \ge |b|\), which meets the hypothesis of Theorem 4.7, and computes the error in three operations.
  • The exact product by splitting is the form of TwoProduct for devices that do not fuse fma. The library takes the split by masking bits: the head keeps the top 12 bits of the 24-bit significand, and the tail is the exact remainder. This head is truncated, not rounded as in formula 5.5, so the tail has the sign of the factor and at most 12 bits. The counting argument of formulas 5.7 and 5.8 still holds: each partial product has at most 24 bits and is exact in float32. The library then adds the partial products with its exact sum, not with formula 5.12.
  • Underflow limits both operations, as the paper states. The library states the domain of its product as a lower bound on \(|ab|\).

The paper assumes that the arithmetic follows the order written, as ALGOL 60 defines it (p. 230). WGSL does not: its specification lets a compiler reassociate floating-point operations, which can remove the correction term. The library therefore protects every intermediate of FastTwoSum from the compiler.