This Article 
 Bibliographic References 
 Add to: 
An Efficient Rounding Boundary Test for {\rm pow}(x, y) in Double Precision
February 2009 (vol. 58 no. 2)
pp. 197-207
Christoph Quirin Lauter, École Normale Supérieure de Lyon, Lyon
Vincent Lefèvre, LIP ENS Lyon INRIA, Lyon
The correct rounding of the function pow: (x, y) \mapsto x^{y} is currently based on Ziv's iterative approximation process. In order to ensure its termination, cases when x^{y} falls on a rounding-boundary must be filtered out. Such rounding-boundaries are floating-point numbers and midpoints between two consecutive floating-point numbers. Detecting rounding-boundaries for pow is a difficult problem. Previous approaches use repeated square root extraction followed by repeated square and multiply. This paper presents a new rounding-boundary test for pow in double precision, which reduces this to a few comparisons with precomputed constants. These constants are deduced from worst cases for the Table Maker's Dilemma, searched over a small subset of the input domain. This is a novel use of such worst-case bounds. The resulting algorithm has been designed for a fast-on-average correctly rounded implementation of pow, considering the scarcity of rounding-boundary cases. It does not stall average computations for rounding-boundary detection. This paper includes its correctness proof and experimental results.

[1] Standard 754-1985 for Binary Floating-Point Arithmetic, ANSI/IEEE, 1985.
[2] A. Ziv, “Fast Evaluation of Elementary Mathematical Functions with Correctly Rounded Last Bit,” ACM Trans. Math. Software, vol. 17, no. 3, pp. 410-423, Sept. 1991.
[3] J.-M. Muller, Elementary Functions, Algorithms and Implementation. Birkhäuser, 1997.
[4] L. Fousse, G. Hanrot, V. Lefèvre, P. Pélissier, and P. Zimmermann, “MPFR: A Multiple-Precision Binary Floating-Point Library with Correct Rounding,” ACM Trans. Math. Software, vol. 33, no. 2, June 2007.
[5] F. de Dinechin, A. Ershov, and N. Gast, “Towards the Post-Ultimate LIBM,” Proc. 17th IEEE Symp. Computer Arithmetic (ARITH-17 '05), June 2005.
[6] F. de Dinechin, C.Q. Lauter, and J.-M. Muller, “Fast and Correctly Rounded Logarithms in Double-Precision,” RAIRO, Theoretical Informatics and Applications, vol. 41, pp. 85-102, 2007.
[7] V. Lefèvre and J.-M. Muller, “Worst Cases for Correct Rounding of the Elementary Functions in Double Precision,” Proc. 15th IEEE Symp. Computer Arithmetic (ARITH-15 '01), pp. 111-118, N.Burgess and L. Ciminiera, eds., http://www.ece.ucdavis. edu/acsel/arithmetic/ arith15/papersARITH15_Lefevre.pdf, 2001.
[8] CRLibm, a Library of Correctly Rounded Elementary Functions in Double-Precision,, 2008.
[9] “Sun Microsystems,” LIBMCR, a Reference Correctly-Rounded Library of Basic Double-Precision Transcendental Elementary Functions, , 2008.
[10] D. Stehlé, V. Lefèvre, and P. Zimmermann, “Searching Worst Cases of a One-Variable Function Using Lattice Reduction,” IEEE Trans. Computers, vol. 54, no. 3, pp. 340-346, org/dl/trans/tc/2005/ 03t0340.pdf, Mar. 2005.
[11] The MPFR Team, The MPFR Library: Algorithms and Proofs, http://www.mpfr.orggforge.html, July 2007.
[12] G.H. Hardy and E.M. Wright, An Introduction to the Theory of Numbers. Oxford Univ. Press, 1979.
[13] V. Lefèvre, “New Results on the Distance between a Segment and${\hbox{\rlap{Z}\kern 2.0pt{\hbox{Z}}}}^{2}$ . Application to the Exact Rounding,” Proc. 17th IEEE Symp. Computer Arithmetic (ARITH-17 '05), pp. 68-75, P. Montuschi and E. Schwarz, eds., , June 2005.
[14] P. Kornerup, V. Lefèvre, and J.-M. Muller, Computing Integer Powers in Floating-Point Arithmetic, Laboratoire de l'Informatique du Parallélisme, Lyon, France, Research Report RR2007-23, , May 2007.
[15] S. Boldo, Preuves Formelles en Arithmétiques à Virgule Flottante, PhD dissertation, Ecole Normale Supérieure de Lyon, http://www. PhD/PhD2004PhD2004-05.pdf, Nov. 2004.
[16] A. Feldstein and R. Goodman, “Convergence Estimates for the Distribution of Trailing Digits,” J. ACM, vol. 23, no. 2, pp. 287-297, http://portal.acm.orgcitation.cfm?id=321948 , Apr. 1976.
[17] C.E. Leiserson, H. Prokop, and K.H. Randall, Using de Bruijn Sequences to Index a 1 in a Computer Word, http://supertech.csail. , 1998.

Index Terms:
Floating-point arithmetic, correct rounding, power function.
Christoph Quirin Lauter, Vincent Lefèvre, "An Efficient Rounding Boundary Test for {\rm pow}(x, y) in Double Precision," IEEE Transactions on Computers, vol. 58, no. 2, pp. 197-207, Feb. 2009, doi:10.1109/TC.2008.202
Usage of this product signifies your acceptance of the Terms of Use.