Skip to main content
QUICK REVIEW

[Paper Review] Mathematical Execution: A Unified Approach for Testing Numerical Code

Zhoulai Fu, Zhendong Su|arXiv (Cornell University)|Oct 4, 2016
Software Testing and Debugging TechniquesComputer Science46 references4 citations
TL;DR

This paper introduces Mathematical Execution (ME), a unified approach for testing numerical code by formulating automated testing as a mathematical optimization problem. It uses a representing function to encode testing objectives and leverages mathematical optimization to minimize this function, enabling efficient, semantics-free input space exploration. Evaluated on Sun's C math library, ME-based tool CoverMe achieved near-optimal branch coverage (91%)—significantly outperforming random testing and Austin, with 6.9s average time vs. 6058.4s.

ABSTRACT

This paper presents Mathematical Execution (ME), a new, unified approach for testing numerical code. The key idea is to (1) capture the desired testing objective via a representing function and (2) transform the automated testing problem to the minimization problem of the representing function. The minimization problem is to be solved via mathematical optimization. The main feature of ME is that it directs input space exploration by only executing the representing function, thus avoiding static or symbolic reasoning about the program semantics, which is particularly challenging for numerical code. To illustrate this feature, we develop an ME-based algorithm for coverage-based testing of numerical code. We also show the potential of applying and adapting ME to other related problems, including path reachability testing, boundary value analysis, and satisfiability checking. To demonstrate ME's practical benefits, we have implemented CoverMe, a proof-of-concept realization for branch coverage based testing, and evaluated it on Sun's C math library (used in, for example, Android, Matlab, Java and JavaScript). We have compared CoverMe with random testing and Austin, a publicly available branch coverage based testing tool that supports numerical code (Austin combines symbolic execution and search-based heuristics). Our experimental results show that CoverMe achieves near-optimal and substantially higher coverage ratios than random testing on all tested programs, across all evaluated coverage metrics. Compared with Austin, CoverMe improves branch coverage from 43% to 91%, with significantly less time (6.9 vs. 6058.4 seconds on average).

Motivation & Objective

  • To address the challenges of testing numerical code, which is difficult for symbolic execution due to path explosion and numerical constraints, and for random testing due to poor coverage.
  • To develop a unified, semantics-free approach to automated testing that avoids complex static or symbolic analysis of program logic.
  • To demonstrate that mathematical optimization of a representing function can systematically and efficiently explore input spaces for numerical code.
  • To evaluate the approach on coverage-based testing, path reachability, boundary analysis, and satisfiability checking in numerical programs.
  • To build and validate a practical tool (CoverMe) for branch coverage testing using ME on real-world numerical libraries.

Proposed method

  • Define a representing function FOO_R that quantifies how close an input x is to a failing execution of the target program FOO, with FOO_R(x) = 0 iff FOO(x) ↓ wrong.
  • Transform the testing problem into minimizing FOO_R, leveraging established mathematical optimization techniques without analyzing FOO’s semantics.
  • Use off-the-shelf optimization solvers (e.g., simulated annealing, Monte Carlo Markov Chain) to explore input space guided solely by FOO_R evaluations.
  • Design FOO_R to encode testing objectives such as branch coverage, path reachability, or boundary value analysis via distance-like metrics.
  • Implement CoverMe as a proof-of-concept tool that uses ME to achieve high branch coverage in floating-point code.
  • Ensure theoretical soundness by proving that FOO(x) ↓ wrong if and only if x minimizes FOO_R, under the assumption that failing inputs exist.

Experimental results

Research questions

  • RQ1Can a unified approach to testing numerical code be built that avoids symbolic or static analysis of program semantics?
  • RQ2Can mathematical optimization of a representing function effectively guide input space exploration for numerical code?
  • RQ3How does ME compare to random testing and hybrid symbolic/search-based tools (e.g., Austin) in terms of coverage and efficiency?
  • RQ4Can ME be adapted to multiple testing objectives, including branch coverage, path reachability, and satisfiability checking?
  • RQ5Is the representing function formalism expressive enough to encode diverse numerical testing goals with strong theoretical guarantees?

Key findings

  • CoverMe achieved near-optimal branch coverage on all tested programs from Sun’s C math library, outperforming random testing in every metric.
  • CoverMe improved average branch coverage from 43% (Austin) to 91%, demonstrating a substantial and consistent improvement.
  • CoverMe reduced average test time from 6058.4 seconds (Austin) to 6.9 seconds, showing a 99.9% efficiency gain.
  • The approach is effective across diverse numerical code, including floating-point operations, non-linear relations, and external math functions (e.g., trigonometric, logarithmic).
  • The representing function formulation provides a strong theoretical foundation, with FOO(x) ↓ wrong if and only if x minimizes FOO_R.
  • ME’s reliance on function evaluation alone, without static analysis, enables scalability and adaptability to various testing problems.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.