Abstract
The Euclidean norm is widely used in scientific and engineering calculations. However, a straightforward implementation may cause overflow/underflow and loss of accuracy. The Blue algorithm selects a scaling value from three conditional branches according to the absolute value to reduce overflow and underflow. We improve this algorithm and propose the Two-Accumulator method, which is expected to be faster by selecting it from two conditional branches. The input range of our method is slightly smaller than the Blue algorithm. However, we mitigate this problem by dynamically setting the scaling value depending on the vector size. Moreover, we combine it with double-double arithmetic to prevent rounding errors. An evaluation shows that our method combined with double-double arithmetic can be approximately 15% faster than the Blue algorithm while maintaining the same error level, but it can be approximately 46% slower, depending on the input range.
Access this chapter
Tax calculation will be finalised at checkout
Purchases are for personal use only
Similar content being viewed by others
References
GMP: The GNU Multiple Precision Arithmetic Library. https://gmplib.org
Bailey, D.H.: QD: A double-double and quad-double package for Fortran and C++. https://www.davidhbailey.com/dhbsoftware/
Blanchard, P., Higham, N.J., Mary, T.: A class of fast and accurate summation algorithms. SIAM J. Sci. Comput. 42, 1541–1557 (2020)
Blue, J.L.: A portable Fortran program to find the Euclidean norm of a vector. ACM Trans. Math. Softw. 4(1), 15–23 (1978)
Dekker, T.J.: A floating-point technique for extending the available precision. Numer. Math. 18(3), 224–242 (1971)
Hanrot, G., Lefèvre, V., Pélissier, P., Théveny, P., Zimmermann, P.: The GNU MPFR Library. https://www.mpfr.org/
Hanson, R.J., Hopkins, T.: Remark on algorithm 539: a modern Fortran reference implementation for carefully computing the Euclidean norm. ACM Trans. Math. Softw. 44(3), Article 24 (2017)
Hida, Y., Li, X.S., Bailey, D.H.: Algorithms for quad-double precision floating point arithmetic. In: Proceedings of the 15th IEEE Symposium on Computer Arithmetic, pp. 155–162 (2001)
Karp, A.H., Markstein, P.: High-precision division and square root. ACM Trans. Math. Softw. 23(4), 561–589 (1997)
Knuth, D.E.: The Art of Computer Programming, Volume 2: Seminumerical Algorithms, 3rd edn. Addison-Wesley, Boston (1997)
Lange, M., Rump, S.M.: Faithfully rounded floating-point computations. ACM Trans. Math. Softw. 46(3), Article 21 (2020)
Li, X.S., et al.: Design, implementation and testing of extended and mixed precision BLAS. ACM Trans. Math. Softw. 28(2), 152–205 (2002)
Nakata, M.: The MPACK (MBLAS/MLAPACK); a multiple precision arithmetic version of BLAS and LAPACK (2010). http://mplapack.sourceforge.net/
Rump, S.M.: Error bounds for computer arithmetics. In: 2019 IEEE 26th Symposium on Computer Arithmetic (ARITH), pp. 1–14 (2019)
Xianyi, Z., Qian, W., Chothia, Z.: OpenBLAS. http://www.openblas.net
Acknowledgment
This research was supported in part by the Multidisciplinary Cooperative Research Program (Cygnus) in the Center for Computational Sciences (CCS), University of Tsukuba.
Author information
Authors and Affiliations
Corresponding author
Editor information
Editors and Affiliations
Rights and permissions
Copyright information
© 2021 Springer Nature Switzerland AG
About this paper
Cite this paper
Harayama, T., Kudo, S., Mukunoki, D., Imamura, T., Takahashi, D. (2021). A Rapid Euclidean Norm Calculation Algorithm that Reduces Overflow and Underflow. In: Gervasi, O., et al. Computational Science and Its Applications – ICCSA 2021. ICCSA 2021. Lecture Notes in Computer Science(), vol 12949. Springer, Cham. https://doi.org/10.1007/978-3-030-86653-2_7
Download citation
DOI: https://doi.org/10.1007/978-3-030-86653-2_7
Published:
Publisher Name: Springer, Cham
Print ISBN: 978-3-030-86652-5
Online ISBN: 978-3-030-86653-2
eBook Packages: Computer ScienceComputer Science (R0)