Abstract
We develop fast and accurate algorithms for evaluating √x2+y2 for two floating-point numbers x and y. Library functions that perform this computation are generally named hypot(x,y). We compare five approaches that we will develop in this article to the current resident library function that is delivered with Julia 1.1 and to the code that has been distributed with the C math library for decades. We will investigate the accuracy of our algorithms by simulation.
Supplemental Material
Available for Download
Software for An Improved Algorithm for hypot(x,y)
- G. Bohlender. 1977. Floating-point computation of functions with maximum accuracy. IEEE Trans. Computers 26 (1977), 621--632.Google ScholarDigital Library
- J. E. Bresenham. 1965. Algorithm for computer control of a digital plotter. IBM Syst. J. 4, 1 (1965), 25--30.Google ScholarDigital Library
- N. Brisebarre, M. Joldes, É. Martin-Dorel, J.-M. Muller, and P. Kornerup. 2011. Augmented precision square roots, 2-d norms, and discussion on correctly rounding . In Computer Arithmetic (ARITH-20). Tübingen, Germany. DOI:10.1109/arith.2011.13Google ScholarDigital Library
- T. J. Dekker. 1971. A floating-point technique for extending the available precision. Numer. Math. 18, 3 (1971), 224--242.Google ScholarDigital Library
- J. Demmel and Y. Hida. 2003. Accurate and efficient floating-point summation. SIAM J. Scientific Computing 25 (2003), 1214--1248.Google ScholarDigital Library
- D. Goldberg. 1991. What every computer scientist should know about floating-point arithmetic. ACM Comput. Surv. 23, 1 (1991), 5--48.Google ScholarDigital Library
- S. Graillat, C. Lauter, P. Tang, N. Yamanaka, and S. Oishi. 2015. Efficient calculations of faithfully rounded l2-norms of n-vectors. ACM Trans. Math. Softw. 41 (2015), 1--20.Google ScholarDigital Library
- R. J. Hanson and T. Hopkins. 2017. Remark on algorithm 539: A modern Fortran reference implementation for carefully computing the Euclidean norm. ACM Trans. Math. Softw. 44, 3 (2017), Article 24.Google Scholar
- J. Harrison. 1999. A machine-checked theory of floating-point arithmetic. In Theorem Proving in the Higher Order Logics. Lecture Notes in Computer Science, Vol. 1690. Springer, 113--130.Google Scholar
- N. J. Higham. 1993. The accuracy of floating-point summation. SIAM J. Sci. Comput. 14 (1993), 783--799.Google ScholarDigital Library
- C.-P. Jeannerod, N. Louvet, J.-M. Muller, and A. Panhaleux. 2011. Midpoints and exact points of some algebraic functions in floating-point arithmetic. IEEE Trans. Comput. 60, 2 (2011), 228--241.Google ScholarDigital Library
- W. Kahan. 1965. Pracniques: Further remarks on reducing truncation errors. Commun. ACM 8, 1 (1965), 40.Google ScholarDigital Library
- J.-M. Muller, N. Brunie, F. de Dinechin, C.-P. Jeannerod, M. Joldes, V. Lefèvre, G. Melquiond, N. Revol, and S. Torres. 2018. Handbook of Floating-Point Arithmetic. Birkhauser.Google Scholar
- M. Pichat. 1972. Correction d’une somme en arithmetique a virgule flottante. Numer. Math. 19 (1972), 400--406.Google ScholarDigital Library
- A. Ziv. 1999. Sharp ULP rounding error bound for the hypotenuse function. Math. Comput. 68, 227 (1999), 1143--1148.Google ScholarDigital Library
Index Terms
- Algorithm 1014: An Improved Algorithm for hypot(x,y)
Recommendations
Design of a Quadruple Precision Floating-Point Fused Multiply-Add Unit Based on 4-Way SIMD Device
NAS '13: Proceedings of the 2013 IEEE Eighth International Conference on Networking, Architecture and StorageAiming to decrease the hardware cost of floating-point quadruple precision fused multiply-add (QPFMA) unit, a new QPFMA unit is designed and realized based on a 4-way SIMD device, which supports 64-bit 4 floating-point double precision fused multiply-...
Bridge floating-point fused multiply-add design
A new floating-point fused multiply-add (FMA) design for the execution of (A × B)+C as a single instruction is presented. The bridge fused multiply-add unit is a design intended to add FMA functionality to existing floating-point coprocessor units by ...
Applying Aeatures of IEEE 754 to Sign/Logarithm Arithmetic
Special issue on computer arithmeticVarious features found in standard floating point arithmetic (IEEE 754) are examined in light of their appropriateness for sign/logarithm arithmetic. The emphasis is on a 32-b word size comparable to IEEE 754 single precision, although other word sizes ...
Comments