Taylor approximation fixes high floating-point errors in numerical code

Taylor-Approximation-Based Repair of High Floating-Point Errors

Software Engineering

Summary

Some computer programs that do math with numbers can make big mistakes in certain tricky spots, like near zero or special values. The authors created a system called NPTaylor that finds these trouble areas and fixes them using a clever math trick called Taylor approximation. It carefully checks its fixes to make sure they actually improve accuracy without slowing things down too much. This method works well on many tested math functions and is faster and smaller than an earlier system. It can handle both simple and more complex math problems where errors happen.

What this means in practice

  • For software engineers: Repair localized floating-point inaccuracies in mathematical software libraries to improve reliability without full rewrites.
  • For scientific computing teams: Enhance numerical computations in scientific codes by automatically patching high-error inputs using Taylor-based evaluators.

Authors

Xin Yi, Liqian Chen, Hengbiao Yu, Shangwen Wang, Tao Tang, Chun Huang, Xiaoguang Mao, Ji Wang

Abstract

Numerical libraries can still lose many bits of accuracy on localized ill-conditioned inputs, such as roots, poles, cancellation points, and branch boundaries. This paper presents NPTaylor, a Taylor-approximation-based framework for repairing localized high floating-point errors in numerical C routines. Given a high-error input, a localized repair domain, a high-precision oracle, and an error threshold, NPTaylor searches over Taylor degree, expansion center, segmentation, and floating-point evaluation strategy. It emits guarded C patches that use a generated Taylor evaluator inside the repair domain and fall back to the original routine outside it. Candidate patches are accepted only after validating the emitted C code on recorded local samples, guard endpoints, and the pre-repair peak input. The generated evaluator uses coefficient splitting and compensated Horner evaluation to reduce rounding error introduced by the patch itself. We evaluate NPTaylor on GSL benchmark workloads. On 38 one-input functions, both NPTaylor and AutoRNP repair all 114 configurations across three accuracy thresholds. NPTaylor is 3.33x faster by geometric-mean offline repair time and emits 0.162x as many C bytes. In the strictest setting, its median repair time is 3.74s versus 81.97s for AutoRNP. NPTaylor also repairs localized multi-input benchmark cases beyond AutoRNP's implemented one-input workflow. These results show that Taylor-based guarded patches can provide compact, efficient local repairs, while the claims remain validation-relative rather than full-domain proofs.