Lune

POPL2024Top-tier venue

Implementation and Synthesis of Math Library Functions

Ian Briggs, Yash Lad, Pavel Panchekha

Abstract

Achieving speed and accuracy for math library functions like exp , sin , and log is difficult. This is because low-level implementation languages like C do not help math library developers catch mathematical errors, build implementations incrementally, or separate high-level and low-level decision making. This ultimately puts development of such functions out of reach for all but the most experienced experts. To address this, we introduce MegaLibm, a domain-specific language for implementing, testing, and tuning math library implementations. MegaLibm is safe, modular, and tunable. Implementations in MegaLibm can automatically detect mathematical mistakes like sign flips via semantic wellformedness checks, and components like range reductions can be implemented in a modular, composable way, simplifying implementations. Once the high-level algorithm is done, tuning parameters like working precisions and evaluation schemes can be adjusted through orthogonal tuning parameters to achieve the desired speed and accuracy. MegaLibm also enables math library developers to work interactively, compiling, testing, and tuning their implementations and invoking tools like Sollya and type-directed synthesis to complete components and synthesize entire implementations. MegaLibm can express 8 state-of-the-art math library implementations with comparable speed and accuracy to the original C code, and can synthesize 5 variations and 3 from-scratch implementations with minimal guidance.

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.

5 top-tier papers have cited it since. Know what they found before your reviewers do.

Questions to start from

Lune can draw on

the full paper · the top-tier papers that cite it · related work

Get the answer

Free to start. No credit card required.

Lineage

  • Efficient Extraction for Effectful E-graphs cites Target-Aware Implementation of Real Expressions
  • Efficient Extraction for Effectful E-graphs cites egg: Fast and extensible equality saturation
  • Target-Aware Implementation of Real Expressions cites Scalable yet rigorous floating-point error analysis
  • Target-Aware Implementation of Real Expressions cites egg: Fast and extensible equality saturation
  • Target-Aware Implementation of Real Expressions cites Debugging and detecting numerical errors in computation with posits
  • An approach to generate correctly rounded math libraries for new floating point variants cites Debugging and detecting numerical errors in computation with posits
  • Correctly Rounded Math Libraries without Worrying about the Application's Rounding Mode cites An approach to generate correctly rounded math libraries for new floating point variants
Builds onCited byLeft to right by year; the more cited, the higher.

Cited by top-tier papers5

  1. Sharpen the Spec, Cut the Code: A Case for Generative File System with SYSSPECQingyuan Liu, Mo Zou, Hengbin Zhang, Dong Du et al.FAST 2026 · 9 citations
  2. Efficient Extraction for Effectful E-graphsOliver Flatt, Anjali Pal, Yihong Zhang, Ryan Tjoa et al.OOPSLA 2026 · 1 citation
  3. Target-Aware Implementation of Real ExpressionsBrett Saiki, Jackson Brough, Jonas Regehr, Jesús Ponce et al.ASPLOS 2025 · 1 citation
  4. Correctly Rounded Math Libraries without Worrying about the Application's Rounding ModeSehyeok Park, Justin Kim, Santosh NagarakattePLDI 2025 · 1 citation
  5. Random Variate Generation with Formal GuaranteesFeras A. Saad, Wonyeol LeePLDI 2025

Builds on9

  1. egg: Fast and extensible equality saturationMax Willsey, Chandrakana Nandi, Yisu Remy Wang, Oliver Flatt et al.POPL 2021 · 170 citations
  2. Scalable yet rigorous floating-point error analysisArnab Das, Ian Briggs, Ganesh Gopalakrishnan, Sriram Krishnamoorthy et al.SC 2020 · 36 citations
  3. Efficient generation of error-inducing floating-point inputs via symbolic executionHui Guo, Cindy Rubio-GonzálezICSE 2020 · 27 citations
  4. Debugging and detecting numerical errors in computation with positsSangeeta Chowdhary, Jay P. Lim, Santosh NagarakattePLDI 2020 · 26 citations
  5. 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

Related papers

  1. Choosing mathematical function implementations for speed and accuracyIan Briggs, Pavel PanchekhaPLDI 2022 · 4 citations
  2. High performance correctly rounded math libraries for 32-bit floating point representationsJay P. Lim, Santosh NagarakattePLDI 2021 · 19 citations
  3. SpEQ: Translation of Sparse Codes using EquivalencesAvery Laird, Bangtian Liu, Nikolaj S. Bjørner, Maryam Mehri DehnaviPLDI 2024 · 6 citations
  4. Progressive polynomial approximations for fast correctly rounded math librariesMridul Aanjaneya, Jay P. Lim, Santosh NagarakattePLDI 2022 · 9 citations
  5. 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
Dusk over the sea between two cliffs drawn in fine vertical lines