Gal's accurate tables

From Wikipedia, the free encyclopedia

Gal's accurate tables is a method devised by Shmuel Gal to provide accurate values of special functions using a lookup table and interpolation. It is a fast and efficient method for generating values of functions like the exponential or the trigonometric functions to within last-bit accuracy for almost all argument values without using extended precision arithmetic.

The main idea in Gal's accurate tables is a different tabulation for the special function being computed. Commonly, the range is divided into several subranges, each with precomputed values and correction formulae. To compute the function, look up the closest point and compute a correction as a function of the distance.

Gal's idea is to not precompute equally spaced values, but rather to perturb the points x so that both x and f(x) are very nearly exactly representable in the chosen numeric format. By searching approximately 1000 values on either side of the desired value x, a value can be found such that f(x) can be represented with less than ±1/2000 bit of rounding error. If the correction is also computed to ±1/2000 bit of accuracy (which does not require extra floating-point precision as long as the correction is less than 1/2000 the magnitude of the stored value f(x), and the computed correction is more than ±1/1000 of a bit away from exactly half a bit (the difficult rounding case), then it is known whether the exact function value should be rounded up or down.

The technique provides an efficient way to compute the function value to within ±1/1000 least-significant bit, i.e. 10 extra bits of precision. If this approximation is more than ±1/1000 of a bit away from exactly midway between two representable values (which happens 99.8% of the time), then the correctly rounded result is clear.

Combined with an extended-precision fallback algorithm, this can compute the correctly rounded result in very reasonable average time. In 2/1000 (0.2%) of the time, such a higher-precision evaluation is required to resolve the rounding uncertainty, but this is infrequent enough that it has little effect on the average calculation time.

The problem of generating function values which are accurate to the last bit is known as the table-maker's dilemma.

See also[edit]

References[edit]

  • Gal, Shmuel (1986). "Computing elementary functions: A new approach for achieving high accuracy and good performance". In Miranker, Willard L.; Toupin, Richard A. (eds.). Accurate Scientific Computations (1 ed.). Proceedings of Computations, Symposium, Bad Neuenahr, Federal Republic of Germany, March 12-14, 1985: Springer-Verlag Berlin Heidelberg. p. 1–16. ISBN 978-3-540-16798-3.{{cite book}}: CS1 maint: location (link)
  • Gal, Shmuel; Bachelis, Boris (1991). "An accurate elementary mathematical library for the IEEE floating point standard". ACM Transactions on Mathematical Software.
  • Muller, Jean-Michel (2006). Elementary Functions: Algorithms and Implementation (2 ed.). Boston, MA, USA: Birkhäuser. ISBN 978-0-8176-4372-0. LCCN 2005048094.
  • Muller, Jean-Michel (2016-12-12). Elementary Functions: Algorithms and Implementation (3 ed.). Boston, MA, USA: Birkhäuser. ISBN 978-1-4899-7981-0.
  • Stehlé, Damien; Zimmermann, Paul (2005). "Gal's Accurate Tables Method Revisited" (PDF). 17th IEEE Symposium on Computer Arithmetic (ARITH'05). pp. 257–264. doi:10.1109/ARITH.2005.24. ISBN 0-7695-2366-8. Archived (PDF) from the original on 2018-01-15. Retrieved 2018-01-15.