cd /news/machine-learning/floatlib-verified-floating-point-ari… · home topics machine-learning article
[ARTICLE · art-136543] src=leandojo.org ↗ pub= topic=machine-learning verified=true sentiment=↑ positive

FloatLib: Verified Floating-Point Arithmetic in Lean

FloatLib, a verified arbitrary-precision floating-point arithmetic library written in Lean, has been released with support for IEEE binary and decimal formats, arbitrary-width posits, P3109, small ML formats, and user-defined formats and rounding rules. Each certified software backend is proved equal to its encoded specification, including signed zeros and exceptional values, and the library's planner selects among lookup tables, machine-word kernels, and limb algorithms while Lean erases proof terms during compilation. The developers benchmarked six arithmetic operations from 2 to 4,096 bits, with full timings and a separate P3109 comparison published in the project's performance guide.

read1 min views1 publishedSep 22, 2026
FloatLib: Verified Floating-Point Arithmetic in Lean
Image: source

Overview #

FloatLib is a verified arbitrary-precision floating-point arithmetic library in Lean. It supports IEEE binary and decimal, arbitrary-width posits, P3109, small ML formats, and user-defined formats and rounding rules. Each certified software backend is proved equal to its encoded specification, including signed zeros and exceptional values. We built FloatLib to support verified machine learning and numerical software with efficient arithmetic.

Key contributions #

  • Custom formats and rounding rules. Choose exponent and fraction widths, bias, and encoding policies, or define a new representation. IEEE binary and decimal, small ML formats, arbitrary-width posits, and P3109 share interfaces for arithmetic and mixed-format operations.
  • Numerical proofs connected to code. Correct rounding, half-ulp error bounds, and Sterbenz's lemma describe the arithmetic a program executes. Posits also have exact quire accumulation within capacity and real-rounding proofs for roots, powers, exponentials, and logarithms.
  • Signed zeros, NaNs, infinities, and exception flags. The IEEE model makes their encodings and behavior explicit. Proofs about complete result words preserve distinctions that equality over the reals cannot express.
  • Fast certified execution. The planner chooses among lookup tables, machine-word kernels, and limb algorithms. Every certified
                    choice proves agreement with the same specification; Lean erases proof
                    terms during compilation.

Performance #

We benchmarked six arithmetic operations from 2 to 4,096 bits. The

                [guide](https://lean-dojo.github.io/FloatLib/#/chapter/performance)
                gives all timings and the separate P3109 comparison.
── more in #machine-learning 4 stories · sorted by recency
── more on @floatlib 3 stories trending now
sponsored brought to you by zahid.host 4,200+ EU-deployed projects
reading about agents? ship yours in a single git push.

Run your AI side-project on zahid.host

EU-based hosting, git-push deploys, automatic HTTPS, no cold starts. Free tier with a custom domain — perfect for shipping the agent you just read about.

$git push zahid main
Live at https://your-agent.zahid.host
Get free account → Pricing
from €0/mo · no card required
LIVE [news/floatlib-verified-fl…] indexed:0 read:1min 2026-09-22 ·