Abstract: Finite-precision floating point arithmetic unavoidably introduces rounding errors which are traditionally bounded using a worst-case analysis. However, worst-case analysis might be overly conservative because worst-case errors can be extremely rare events in practice. Here we develop a probabilistic model of rounding errors with which it becomes possible to estimate the likelihood that the rounding error of an algorithm lies within a given interval. Given an input distribution, we show how to compute the distribution of rounding errors. We do this exactly for low precision arithmetic, for high precision arithmetic we derive a simple approximation. The model is then entirely compositional: given a numerical program written in a simple imperative programming language we can recursively compute the distribution of rounding errors at each step of the computation and propagate it through each program instruction. This is done by applying a formalism originally developed by Kozen to formalize the semantics of probabilistic programs. We then discuss an implementation of the model and use it to perform probabilistic range analyses on some benchmarks.
Introduction
Floating-point arithmetic is the bedrock of modern scientific computing, yet it is inherently imprecise. Every arithmetic operation introduces a rounding error due to the finite number of bits available to represent real numbers. Traditionally, these errors are managed using worst-case analysis, which assumes the error is an unknown constant within a fixed interval.
However, this deterministic approach is often overly pessimistic. In a long chain of calculations, the probability of every single operation hitting the absolute worst-case rounding error simultaneously is statistically negligible. Existing tools like FPTaylor or Daisy provide "safe" bounds that are often so wide they lose practical utility. This paper presents a probabilistic model that treats rounding errors as random variables, allowing for more realistic and significantly tighter error estimates by asking: "How likely is it that the error exceeds a certain threshold?"
Methodology
The proposed framework moves away from deterministic bounds toward a compositional, probabilistic model. The approach is built on three main pillars:
- The Exact and Typical Distributions: For low-precision arithmetic (like 16-bit half-precision), the authors derive exact analytical formulas for rounding error probability density functions (PDFs). For high-precision arithmetic (single and double precision), they identify a "typical distribution"—a piecewise polynomial that serves as a universal approximation. As shown in Figure 1, the rounding error distribution converges to this characteristic flat-topped shape regardless of the specific input distribution (e.g., Uniform or Normal).
- Probabilistic Semantics: The model treats numerical programs as probabilistic programs. Borrowing from the semantics developed by Dexter Kozen, every arithmetic operation is viewed as a transformation of random variables.
- Implementation: Using the Python library PaCAL, these distributions are represented as Chebyshev interpolating polynomials. This allows the system to "propagate" the error distribution through a program step-by-step, effectively performing implicit sampling for every arithmetic operation.
Experimental Evaluation
The model was evaluated using benchmarks from FPBench, including sequences of additions and multiplications. The analytical results were validated against million-sample Monte-Carlo simulations, showing near-perfect alignment between the predicted PDF curves and empirical histograms.
A key advantage of this probabilistic approach is the ability to trade absolute certainty for significantly tighter bounds. By defining a high-confidence interval (e.g., 99.99%), the model can provide error ranges that are orders of magnitude smaller than those produced by worst-case tools. For instance, in certain benchmarks, the probabilistic 99.99% confidence interval is five orders of magnitude (base 2) tighter than the worst-case bound provided by FPTaylor (see Figure 5).
Furthermore, the model accurately predicts the probability of rare events, such as overflows in division operations—a capability that binary "yes/no" worst-case tools lack.
Discussion and Future Work
The transition from "safe" worst-case bounds to "likely" probabilistic bounds offers a powerful tool for practical engineering. It allows for a nuanced understanding of error behavior and provides actionable data for systems where absolute certainty is less critical than precision efficiency.
However, challenges remain. The current implementation assumes variable independence; if a variable appears multiple times in an expression, the model treats them as independent random variables. Additionally, scaling this approach to large-scale programs with complex control flow and loops remains a subject for future research. Despite these limitations, the probabilistic framework provides a much-needed alternative to overly pessimistic traditional methods.
Summary updated