Skip to main content
Log in

Hierarchical search algorithm for error detection in floating-point arithmetic expressions

  • Published:
The Journal of Supercomputing Aims and scope Submit manuscript

Abstract

Scientific and engineering applications rely on floating-point arithmetic to approximate real numbers. Due to the inherent rounding errors in floating-point numbers, error propagation during calculations can accumulate and lead to serious errors that may compromise the safety and reliability of the program. In theory, the most accurate method of error detection is to exhaustively search all possible floating-point inputs, but this is not feasible in practice due to the huge search space involved. Effectively and efficiently detecting maximum floating-point errors has been a challenge. To address this challenge, we design and implement an error detection tool for floating-point arithmetic expressions called HSED. It leverages modified mantissas under double precision floating-point types to simulate hierarchical searches from either half or single precision to double precision. Experimental results show that for 32 single-parameter arithmetic expressions in the FPBench benchmark test set, the error detection effects and performance of HSED are significantly better than the state-of-the-art error detection tools Herbie, S3FP and ATOMU. HSED outperforms Herbie, Herbie+, S3FP and ATOMU in 24, 19, 27 and 25 cases, respectively. The average time taken by Herbie, Herbie+, and S3FP is 1.82, 11.20, and 129.15 times longer than HSED, respectively.

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

Access this article

Price excludes VAT (USA)
Tax calculation will be finalised during checkout.

Instant access to the full article PDF.

Fig. 1
Fig. 2
Fig. 3
Fig. 4
Fig. 5
Fig. 6
Fig. 7
Fig. 8
Fig. 9
Fig. 10

Similar content being viewed by others

Data availability

The datasets used for the experiments are benchmark datasets. The experimental data can be reproduced in the github open source address.

Code availability

The github open source address will be included here when the paper is accepted.

References

  1. Kevin Q (1983) Ever had problems rounding off figures. This stock exchange has. The Wall Street J 1983:37

    Google Scholar 

  2. Jacques-Louis L, Lennart L, Jean-Luc F et al (1996) Ariane 5 flight 501 failure report by the inquiry board. European space agency Paris

  3. Robert S (1992) Roundoff error and the Patriot missile. SIAM News 25(4):11

    Google Scholar 

  4. Xia Y, Guo S, Hao J, Liu D, Xu J (2020) Error detection of arithmetic expressions. J Supercomput 77:5492–5509. https://doi.org/10.1007/s11227-020-03469-7

    Article  Google Scholar 

  5. Daming Z, MuHan Z, Yingfei X, Zhoulai F, Lu Z, Zhendong S (2019) Detecting floating-point errors via atomic conditions. In: Proceeding of the 47th ACM on Programming Languages (POPL 2020). Association for Computing Machinery, New York, NY, USA, vol 4, pp 1–27. https://doi.org/10.1145/3371128

  6. Wei-fan C, Ganesh G, Zvonimir R, Alexey S (2014) Efficient search for inputs causing high floating-point errors. In: Proceeding of the 19th ACM SIGPLAN Symposium on Principles and Practice of Parallel Programming (PPoPP 2014). Association for Computing Machinery, New York, NY, USA, vol 49, pp 43–52. https://doi.org/10.1145/2692916.2555265

  7. Qi H, Xu J, Guo S (2018) Detection of the maximum error of mathematical functions. J Supercomput 74:6275–6290. https://doi.org/10.1007/s11227-018-2552-x

    Article  Google Scholar 

  8. What GD, Arithmetic ECSSKAF (1991) ACM Comput Surv 23:5–48. https://doi.org/10.1145/103162.103163

    Article  Google Scholar 

  9. Xin Y, Liqian C, Xiaoguang M, Tao J (2019). In: Proceeding of the 46th ACM on Programming Languages (POPL 2019). Association for Computing Machinery, New York, NY, USA, vol 3, pp 1–29. https://doi.org/10.1145/3290369

  10. Nicholas N, Julian S (2007) Valgrind: a framework for heavyweight dynamic binary instrumentation. Sigplan Not SIGPLAN 42:89–100. https://doi.org/10.1145/1273442.1250746

    Article  Google Scholar 

  11. Daming Z, Ran W, Yingfei X, Lu Z, Zhendong S, Hong M (2015) A genetic algorithm for detecting significant floating-point inaccuracies. In: Proceeding of the 37th International Conference on Software Engineering (ICSE 2015). IEEE Press, vol 1, pp 529–539

  12. Earl T. B, Thanh V, Vu L, Zhendong S (2013) Automatic detection of floating-point exceptions. In: Proceeding of the 40th ACM on programming languages (POPL 2013). Association for Computing Machinery, New York, NY, USA, vol 48, pp 549–560. https://doi.org/10.1145/2429069.2429133

  13. Florian B, Andreas H, Sebastian H (2012) A dynamic program analysis to find floating-point accuracy problems. In: Proceeding of the 23th ACM SIGPLAN Conference on Programming Language Design and Implementation (PLDI 2012). Association for Computing Machinery, New York, NY, USA, vol 47, pp 453–462. https://doi.org/10.1145/2254064.2254118

  14. Al B, Ken B, Ben C, Andy C, Bryan F, Seth H, Charles H, Asya K, Scott M, Dawson E (2010) A few billion lines of code later: using static analysis to find bugs in the real world. In: Communications of the ACM. Association for Computing Machinery, New York, NY, USA, vol 53, pp 66–75. https://doi.org/10.1145/1646353.1646374

  15. Francois F, Bruno L (2016) VERROU: a CESTAC evaluation without recompilation. In: 17th International Symposium on Scientific Computing, Computer Arithmetic and Verified Numerics (SCAN 2016)

  16. Alex S, Pavel P, Sorin L, Zachary T (2018) Finding root causes of floating point error. In: Proceedings of the 39th ACM SIGPLAN Conference on Programming Language Design and Implementation (PLDI 2018). Association for Computing Machinery, New York, NY, USA, vol 53, pp 256–269. https://doi.org/10.1145/3192366.3192411

  17. Eric G, Sylvie P (2011) Static Analysis of Finite Precision Computations. In: Proceeding of the 12th International Conference on Verification, Model Checking, and Abstract Interpretation (VMCAI 2011). Lecture Notes in Computer Science, Springer, Berlin, Heidelberg, vol 6538, pp 232–247. https://doi.org/10.1007/978-3-642-18275-4_17

  18. Hui G, Cindy R (2020) Efficient generation of error-inducing floating-point inputs via symbolic execution. In: Proceedings of the ACM/IEEE 42th International Conference on Software Engineering (ICSE 2020). Association for Computing Machinery, New York, NY, USA. pp 1261–1272. https://doi.org/10.1145/3377811.3380359

  19. Pavel P, Alex S, James R, Zachary T (2015) Automatically improving accuracy for floating point expressions. In: Proceeding of the 36th ACM SIGPLAN Conference on Programming Language Design and Implementation (PLDI 2015). Association for Computing Machinery, New York, NY, USA, vol 50, pp 1–11. https://doi.org/10.1145/2737924.2737959

  20. Daming Z, Yuchen G, Yuanfeng S, Mingzhe W, Yingfei X, Zhendong S (2023) Oracle-free repair synthesis for floating-point programs. In: Proceeding of the ACM on Programming Languages, vol 6, Issue OOPSLA2, Article No.: 159, pp 957–985. https://doi.org/10.1145/3563322

  21. Anastasiia I, Eva D (2017) On sound relative error bounds for floating-point arithmetic. In: Proceeding of the 17th Conference on Formal Methods in computer-Aided Design (FMCAD 2017). FMCAD Inc, Austin, Texas. pp 15–22. https://doi.org/10.23919/FMCAD.2017.8102236

  22. Patrick C, Radhia C (2014) Abstract interpretation: past, present and future. In: Proceeding of the Joint Meeting of the Twenty-third EACSL Annual Conference on Computer Science Logic and the Twenty-ninth Annual ACM/IEEE Symposium on Logic in Computer Science (CSL-LICS 2014). Association for Computing Machinery, New York, NY, USA. pp 1–10. https://doi.org/10.1145/2603088.2603165

  23. Hickey T, Ju Q, Van EMH (2001) Interval arithmetic: from principles to implementation. J ACM 48:1038–1068. https://doi.org/10.1145/502102.502106

    Article  MathSciNet  Google Scholar 

  24. Luiz H, Jorge S (2004) Affine arithmetic: concepts and applications. Numer Algorithms 37:147–158. https://doi.org/10.1023/B:NUMA.0000049462.70970.b6

    Article  MathSciNet  Google Scholar 

  25. Wonyeol L, Rahul S, Alex A (2016) Verifying bit-manipulations of floating-point. In: Proceeding of the 37th ACM SIGPLAN Conference on Programming Language Design and Implementation (PLDI 2016). Association for Computing Machinery, New York, NY, USA, vol 51, pp 70–84. https://doi.org/10.1145/2908080.2908107

  26. Roberto B, Emilio C, Daniele C, Camil D, Irene F (2018) A survey of symbolic execution techniques. ACM Comput Surv 51:1–39. https://doi.org/10.1145/3182657

    Article  Google Scholar 

  27. Stella S, Alberto B, Omar I, Mirco T (2022) Tight error analysis in fixed-point arithmetic. Form Asp Comput 34:1–32. https://doi.org/10.1145/3524051

    Article  MathSciNet  Google Scholar 

  28. Alexey S, Marek S, Ian B, Charles J, Zvonimir R, Ganesh G (2018) Rigorous estimation of floating-point round-off errors with symbolic taylor expansions. In: ACM Transactions on Programming Languages and Systems. Association for Computing Machinery, New York, NY, USA, vol 41, pp 1–39. https://doi.org/10.1145/3230733

  29. Hao J, Xu J, Guo S (2022) Design of variable precision transcendental function automatic generator. J Supercomput 78:2196–2218. https://doi.org/10.1007/s11227-021-03937-8

    Article  Google Scholar 

  30. Zhou B, YongZhong H, Jinchen X, ShaoZhong G, Hongyuan Q (2019) Memory latency optimizations for the elementary functions on the Sunway architecture. J Supercomput 75:3917–3944. https://doi.org/10.1007/s11227-018-02741-1

    Article  Google Scholar 

  31. Laurent F, Guillaume H, Vincent L, Patrick P, Paul Z (2007) MPFR: a multiple-precision binary floating-point library with correct rounding. ACM Trans Math Softw 33:13. https://doi.org/10.1145/1236463.1236468

    Article  MathSciNet  Google Scholar 

  32. Yuhao Z, Luyao R, Liqian C, Yingfei X, Shing-chi C, Tan X (2020) Detecting numerical bugs in neural network architectures. In: Proceeding of the 28th ACM Joint Meeting on European Software Engineering Conference and Symposium on the Foundations of Software Engineering (ESEC/FSE 2020). Association for Computing Machinery, New York, NY, USA. pp 826–837. https://doi.org/10.1145/3368089.3409720

Download references

Funding

Supported by the Open Project Program of the State Key Laboratory of Mathematical Engineering and Advanced Computing. Fund No. 2023B02.

Author information

Authors and Affiliations

Authors

Contributions

ZZ and JX were responsible for the methodology, implementation and writing; YQ and HH were responsible for some of the experiments; JH was involved in the review and supervision; and BZ was involved in the editing, review and supervision.

Corresponding author

Correspondence to Bei Zhou.

Ethics declarations

Conflict of interest

The authors declare no competing interests.

Ethics approval

Not applicable.

Additional information

Publisher's Note

Springer Nature remains neutral with regard to jurisdictional claims in published maps and institutional affiliations.

Rights and permissions

Springer Nature or its licensor (e.g. a society or other partner) holds exclusive rights to this article under a publishing agreement with the author(s) or other rightsholder(s); author self-archiving of the accepted manuscript version of this article is solely governed by the terms of such publishing agreement and applicable law.

Reprints and permissions

About this article

Check for updates. Verify currency and authenticity via CrossMark

Cite this article

Zhang, Z., Xu, J., Hao, J. et al. Hierarchical search algorithm for error detection in floating-point arithmetic expressions. J Supercomput 80, 1183–1205 (2024). https://doi.org/10.1007/s11227-023-05523-6

Download citation

  • Accepted:

  • Published:

  • Issue Date:

  • DOI: https://doi.org/10.1007/s11227-023-05523-6

Keywords

Navigation