Abstract
Floating-point programs form the foundation of modern science and engineering, providing the essential computational framework for a wide range of applications, such as safety-critical systems, aerospace engineering, and financial analysis. Floating-point errors can lead to severe consequences. Although floating-point errors widely exist, only a subset of inputs may trigger significant errors in floating-point programs. Therefore, it is crucial to determine whether a given input could produce such errors. Researchers tend to take the results of high-precision floating-point programs as oracles for detecting floating-point errors, which introduces two main limitations: (1) difficulty of implementation and (2) prolonged execution time. To address these two challenges, we propose a novel approach named PI-detector to computing floating-point errors effectively and efficiently. Our approach is based on the observation that floating-point errors stem from large condition numbers in atomic operations, which then propagate and accumulate. PI-detector injects small perturbations into the operands of individual atomic operations and compares the outcomes of the original program with the perturbed version. Experimental results demonstrate that PI-detector can perform efficient and accurate floating-point error computation.
Introduction
Floating-point arithmetic is the silent engine of modern engineering, from aerospace simulations to financial modeling. Yet, floating-point numbers are mere approximations of real numbers. Small discrepancies—like $1.2 - 1.1$ not quite equaling $0.1$—can propagate and amplify into catastrophic failures. To detect these errors, researchers traditionally use "high-precision" versions of the same program (e.g., using 128-bit instead of 64-bit floats) as an oracle. However, this approach suffers from significant implementation difficulty and extreme execution overhead, often running 100x to 1000x slower than standard precision.
Methodology
PI-detector identifies significant floating-point errors by intentionally "poking" the program to see how it reacts. The core insight is that floating-point errors stem from large condition numbers in atomic operations (like addition or subtraction of nearly equal numbers).
As shown in the table above, specific mathematical operations have "dangerous regions" where the condition number ($C_{op}$) becomes extremely large, indicating high sensitivity to input errors. PI-detector follows a three-step workflow to exploit this:
- LLVM IR Generation: The source code is converted into LLVM Intermediate Representation, ensuring language-agnostic analysis.
- Perturbation Injection (PI): The tool scans the IR for atomic operations where the condition number exceeds a predefined threshold (e.g., $10^5$). For these operations, it injects a tiny change—subtracting one Unit in the Last Place (ULP) from the operand.
- Error Computation: It executes both the original and the perturbed version. By comparing final outputs, it determines if a local error was amplified into a significant discrepancy.
This dynamic tracking allows PI-detector to identify "Error Cancellation," where a large intermediate error is neutralized later in the program, thereby avoiding the false positives common in static analysis tools.
Evaluation and Results
The researchers evaluated PI-detector using standard benchmarks (ATOMU and HSED) and a complex 3,000-dimensional linear system solver from the GNU Scientific Library (GSL).
- Efficiency: On standard benchmarks, PI-detector achieved an average runtime of 3.35 ms, compared to 1,366.23 ms for high-precision oracles—a roughly 407x speedup. In the complex linear solver test, it remained 44x faster than high-precision approaches.
- Accuracy: The tool detected 173 out of 174 significant errors in the benchmark datasets. The calculated errors showed a strong correlation (up to 0.92 Spearman coefficient) with ground-truth errors.
- Scalability: Unlike previous tools like FPCC, PI-detector successfully processed large-scale numerical software that involves multiple inputs and complex logic.
Conclusion
PI-detector represents a major step forward in numerical software reliability. By focusing on perturbation injection at critical, poorly conditioned operations, it provides a practical alternative to slow high-precision oracles. Future work will focus on automating threshold sensitivity and extending the tool's application to larger, professional-grade scientific simulations.
Summary updated