# Computing elementary functions: A new approach for achieving high accuracy and good performance

• Shmuel Gal
Conference paper
Part of the Lecture Notes in Computer Science book series (LNCS, volume 235)

## Abstract

We present a method developed in the IBM Israel Scientific Center for designing algorithms for computing the elementary mathematical functions. This method which we call the “Accurate Tables Method” achieves high performance and produces very accurate results.

Our method is based on a table lookup and then a minimax polynomial approximation of the function near the table value. It overcomes one of the main problems encountered in elementary mathematical functions computations of achieving last bit accuracy even for the double precision routines. This task is difficult since using extended precision calculations (or simulating them) leads to a significant degradation of the performance. We found a way to obtain correctly rounded results for more than 99.9% of the argument values without using extended precision calculations.

Our main idea in the Accurate Tables Method is to use “nonstandard tables” different from the natural tables of equally spaced points in which the rounding error prevents obtaining last bit accuracy. In order to achieve a small error we use the following idea: Perturb the original, equally spaced, points in such a way that the table value (or tables values in case we need several tables) will be very close to numbers which can be exactly represented by the computer (much closer than the the usual double precision representation). Thus, we were able to control the error introduced by the computer representation of real numbers and extended the accuracy without actually using extended precision arithmetic.

## References

1. 1.
J. W. S. Cassels, An Introduction to Diophantine approximation, Cambridge University Press 1957.Google Scholar
2. 2.
W. Cody and W. Waite, Software Manual for the Elementary Functions, Prentice-Hall 1980.Google Scholar
3. 3.
B. Tuckermam, IBM T. J. Watson Research Center, Private Communication. The test is described in P. 14 of IBM Elementary Math Library, Program Reference and Operations Manual, SH20-2230-1, Second Edition (August 1984).Google Scholar
4. 4.
I. Tzur and S. Gal, A General Purpose Program for Minimax Polynomial Approximation, IBM Israel Scientific Center Classified Technical Report.Google Scholar