Skip to main content

A Rapid Euclidean Norm Calculation Algorithm that Reduces Overflow and Underflow

  • Conference paper
  • First Online:
Computational Science and Its Applications – ICCSA 2021 (ICCSA 2021)

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.

This is a preview of subscription content, log in via an institution to check access.

Access this chapter

Chapter
USD 29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD 84.99
Price excludes VAT (USA)
  • Available as EPUB and PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD 109.99
Price excludes VAT (USA)
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info

Tax calculation will be finalised at checkout

Purchases are for personal use only

Institutional subscriptions

References

  1. GMP: The GNU Multiple Precision Arithmetic Library. https://gmplib.org

  2. Bailey, D.H.: QD: A double-double and quad-double package for Fortran and C++. https://www.davidhbailey.com/dhbsoftware/

  3. Blanchard, P., Higham, N.J., Mary, T.: A class of fast and accurate summation algorithms. SIAM J. Sci. Comput. 42, 1541–1557 (2020)

    Article  MathSciNet  Google Scholar 

  4. Blue, J.L.: A portable Fortran program to find the Euclidean norm of a vector. ACM Trans. Math. Softw. 4(1), 15–23 (1978)

    Article  MathSciNet  Google Scholar 

  5. Dekker, T.J.: A floating-point technique for extending the available precision. Numer. Math. 18(3), 224–242 (1971)

    Article  MathSciNet  Google Scholar 

  6. Hanrot, G., Lefèvre, V., Pélissier, P., Théveny, P., Zimmermann, P.: The GNU MPFR Library. https://www.mpfr.org/

  7. 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)

    Google Scholar 

  8. 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)

    Google Scholar 

  9. Karp, A.H., Markstein, P.: High-precision division and square root. ACM Trans. Math. Softw. 23(4), 561–589 (1997)

    Article  MathSciNet  Google Scholar 

  10. Knuth, D.E.: The Art of Computer Programming, Volume 2: Seminumerical Algorithms, 3rd edn. Addison-Wesley, Boston (1997)

    Google Scholar 

  11. Lange, M., Rump, S.M.: Faithfully rounded floating-point computations. ACM Trans. Math. Softw. 46(3), Article 21 (2020)

    Google Scholar 

  12. Li, X.S., et al.: Design, implementation and testing of extended and mixed precision BLAS. ACM Trans. Math. Softw. 28(2), 152–205 (2002)

    Article  MathSciNet  Google Scholar 

  13. Nakata, M.: The MPACK (MBLAS/MLAPACK); a multiple precision arithmetic version of BLAS and LAPACK (2010). http://mplapack.sourceforge.net/

  14. Rump, S.M.: Error bounds for computer arithmetics. In: 2019 IEEE 26th Symposium on Computer Arithmetic (ARITH), pp. 1–14 (2019)

    Google Scholar 

  15. Xianyi, Z., Qian, W., Chothia, Z.: OpenBLAS. http://www.openblas.net

Download references

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

Authors

Corresponding author

Correspondence to Daisuke Takahashi .

Editor information

Editors and Affiliations

Rights and permissions

Reprints and permissions

Copyright information

© 2021 Springer Nature Switzerland AG

About this paper

Check for updates. Verify currency and authenticity via CrossMark

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)

Publish with us

Policies and ethics