Abstract

Floating-point error is one of the important factors that limit the accuracy of calculation. Programs using floating-point numbers are prone to accuracy problems by rounding and catastrophic cancelation. Mathematical library is an essential part of computer system. Its implementation is a common genre of floating-point calculation. Implementing these functions through polynomial expansion has algorithmic error in addition to rounding and catastrophic cancelation. Furthermore, ‘concise’ mathematical functions are frequently developed for applications with high-performance requirements. These ‘concise’ functions pay more attention to performance rather than accuracy. As a result, serious accuracy problems might occur, which will further affect the execution of programs. In this paper, a heuristic approach is designed to detect the maximum error of mathematical functions. It is theoretically proved in Sect. 2 that the maximum error of the mathematical functions generally occurs in small intervals. This finding is further proved by several experiments. The heuristic approach is designed based on it. Firstly, the large-scale test is used to gain the error distribution of functions. After that, the intervals, where the maximum error may occur (called ‘tingle intervals’ in this paper), are derived from the error distribution. At last, the high coverage test over tingle intervals is used to detect the maximum error. We evaluate the algorithm by analyzing mainstream math libraries (MKL, Glibc and Sunway TaihuLight). Our experiments show the approach can correctly deal with over 96.2% of mathematical functions. The approach designed in this paper has been used in the analysis and optimization of Sunway TaihuLight Math Library.

Full Text
Published version (Free)

Talk to us

Join us for a 30 min session where you can share your feedback and ask us any queries you have

Schedule a call