Lune

PLDI2025Top-tier venue

Correctly Rounded Math Libraries without Worrying about the Application's Rounding Mode

Sehyeok Park, Justin Kim, Santosh Nagarakatte

Abstract

Our RLibm project has recently proposed methods to generate a single implementation for an elementary function that produces correctly rounded results for multiple rounding modes and representations with up to 32-bits. They are appealing for developing fast reference libraries without double rounding issues.

The key insight is to build polynomial approximations that produce the correctly rounded result for a representation with two additional bits when compared to the largest target representation and with the "non-standard" round-to-odd rounding mode, which makes double rounding the RLibm math library result to any smaller target representation innocuous. The resulting approximations generated by the RLibm approach are implemented with machine supported floating-point operations with the round-to-nearest rounding mode. When an application uses a rounding mode other than the round-to-nearest mode, the RLibm math library saves the application's rounding mode, changes the system's rounding mode to round-to-nearest, computes the correctly rounded result, and restores the application's rounding mode. This frequent change of rounding modes has a performance cost.

This paper proposes two new methods, which we call rounding-invariant outputs and rounding-invariant input bounds, to avoid the frequent changes to the rounding mode and the dependence on the round-to-nearest mode. First, our new rounding-invariant outputs method proposes using the round-to-zero rounding mode to implement RLibm's polynomial approximations. We propose fast, error-free transformations to emulate a round-to-zero result from any standard rounding mode without changing the rounding mode. Second, our rounding-invariant input bounds method factors any rounding error due to different rounding modes using interval bounds in the RLibm pipeline. Both methods make a different set of trade-offs and improve the performance of resulting libraries by more than 2×.

Ask Lune

Know this paper in minutes, not an afternoon.

Lune can read every page of it and the top-tier papers that cite it, and gives you its claims, its evidence and its limits, each one cited to the paper it comes from. No skimming, no AI slop.

Questions to start from

Lune can draw on

the full paper · related work

Get the answer

Free to start. No credit card required.

Lineage

  • High performance correctly rounded math libraries for 32-bit floating point representations cites An approach to generate correctly rounded math libraries for new floating point variants
  • High performance correctly rounded math libraries for 32-bit floating point representations cites Detecting floating-point errors via atomic conditions
  • One polynomial approximation to produce correctly rounded results of an elementary function for multiple representations and rounding modes cites High performance correctly rounded math libraries for 32-bit floating point representations
  • One polynomial approximation to produce correctly rounded results of an elementary function for multiple representations and rounding modes cites An approach to generate correctly rounded math libraries for new floating point variants
  • One polynomial approximation to produce correctly rounded results of an elementary function for multiple representations and rounding modes cites Detecting floating-point errors via atomic conditions
  • An approach to generate correctly rounded math libraries for new floating point variants cites Detecting floating-point errors via atomic conditions
  • Fast shadow execution for debugging numerical errors using error free transformations cites High performance correctly rounded math libraries for 32-bit floating point representations
  • Fast shadow execution for debugging numerical errors using error free transformations cites One polynomial approximation to produce correctly rounded results of an elementary function for multiple representations and rounding modes
  • Fast shadow execution for debugging numerical errors using error free transformations cites An approach to generate correctly rounded math libraries for new floating point variants
  • Fast shadow execution for debugging numerical errors using error free transformations cites Detecting floating-point errors via atomic conditions
Builds onCited byLeft to right by year; the more cited, the higher.

Builds on8

  1. Detecting floating-point errors via atomic conditionsDaming Zou, Muhan Zeng, Yingfei Xiong, Zhoulai Fu et al.POPL 2020 · 45 citations
  2. An approach to generate correctly rounded math libraries for new floating point variantsJay P. Lim, Mridul Aanjaneya, John L. Gustafson, Santosh NagarakattePOPL 2021 · 21 citations
  3. High performance correctly rounded math libraries for 32-bit floating point representationsJay P. Lim, Santosh NagarakattePLDI 2021 · 19 citations
  4. One polynomial approximation to produce correctly rounded results of an elementary function for multiple representations and rounding modesJay P. Lim, Santosh NagarakattePOPL 2022 · 15 citations
  5. Fast shadow execution for debugging numerical errors using error free transformationsSangeeta Chowdhary, Santosh NagarakatteOOPSLA 2022 · 13 citations

Related papers

  1. Progressive polynomial approximations for fast correctly rounded math librariesMridul Aanjaneya, Jay P. Lim, Santosh NagarakattePLDI 2022 · 9 citations
  2. Maximum Consensus Floating Point Solutions for Infeasible Low-Dimensional Linear Programs with Convex Hull as the Intermediate RepresentationMridul Aanjaneya, Santosh NagarakattePLDI 2024 · 1 citation
  3. High-Performance Branch-Free Algorithms for Extended-Precision Floating-Point ArithmeticDavid Kai Zhang, Alex AikenSC 2025 · 3 citations
  4. Implementation and Synthesis of Math Library FunctionsIan Briggs, Yash Lad, Pavel PanchekhaPOPL 2024 · 7 citations
  5. Choosing mathematical function implementations for speed and accuracyIan Briggs, Pavel PanchekhaPLDI 2022 · 4 citations
Dusk over the sea between two cliffs drawn in fine vertical lines