Ziv: A Language for Correctly Rounded Math Libraries
Lucas Yunkyu Lee, Sungjin Hwang, Wonyeol Lee
Key points
From the paper's conclusion- We present Ziv, a programming system for developing correctly rounded math libraries.
Abstract
Developing performant, correctly rounded math libraries is challenging. Such implementations often rely on extended-precision arithmetic for correct rounding and precomputed constants for performance. Existing implementation languages, however, provide limited support for (i) high-level abstractions for such arithmetic and (ii) staged computation to combine precomputation and runtime computation in one program. As a result, existing implementations often miss abstraction opportunities and hard-code constants precomputed using separate programs. These practices make it difficult to write, understand, and modify these libraries. We present Ziv, a programming system for developing correctly rounded math libraries. It consists of a small language, a rich standard library, and a provably sound compiler targeting C. Ziv supports (i) high-level numerical abstractions via types and operations for extended-precision numbers, and (ii) staged computation via compile-time evaluation of expressions known to be input-independent. These features enable high-level code that unifies precomputation and runtime computation. We embed Ziv in Julia and evaluate it by reimplementing 19 functions from two state-of-the-art libraries targeting correct rounding; we achieve competitive performance with 2.63$\times$ reductions in lines of code. We also implement three new functions and automatically explore 824,256 variants, achieving 96.5$\times$ average speedup over an arbitrary-precision library.
Read the paper
Discussion
Science Skim's AI key points, plus readers' public thoughts
Readers' thoughts
No reader thoughts yet.
Related papers
- Computing $ab+cd$ and other expressions with correct rounding in binary floating-point arithmeticarXiv · 2026
- Portable Extended-Precision Floating-Point Arithmetic for Scientific Computing KernelsarXiv · 2026
- A CPU Inside an LLM: Zero-Gradient Compilation of Exact Circuits into Pretrained WeightsarXiv · 2026
- Vectorizing Recurrences over SemiringsarXiv · 2026
- When Double Rounding is CorrectarXiv · 2026
- Floating-Point Usage on GitHub: A Large-Scale Study of Statically Typed LanguagesProceedings of the ACM on Programming Languages · 2026