{"slug": "floatlib-verified-floating-point-arithmetic-in-lean", "title": "FloatLib: Verified Floating-Point Arithmetic in Lean", "summary": "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.", "body_md": "## Overview\n\nFloatLib 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.\n\n## Key contributions\n\n- **Custom formats and rounding rules.** Choose exponent and\n                    fraction widths, bias, and encoding policies, or define a new representation.\n                    IEEE binary and decimal, small ML formats, arbitrary-width posits, and P3109\n                    share interfaces for arithmetic and mixed-format operations.\n- **Numerical proofs connected to code.** Correct rounding,\n                    half-ulp error bounds, and Sterbenz's lemma describe the arithmetic a program\n                    executes. Posits also have exact quire accumulation within capacity and\n                    real-rounding proofs for roots, powers, exponentials, and logarithms.\n- **Signed zeros, NaNs, infinities, and exception flags.** The IEEE model makes their encodings and behavior explicit. Proofs about\n                    complete result words preserve distinctions that equality over the reals\n                    cannot express.\n- **Fast certified execution.** The planner chooses among\n                    lookup tables, machine-word kernels, and limb algorithms. Every certified\n                    choice proves agreement with the same specification; Lean erases proof\n                    terms during compilation.\n\n## Performance\n\nWe benchmarked six arithmetic operations from 2 to 4,096 bits. The\n                [guide](https://lean-dojo.github.io/FloatLib/#/chapter/performance)\n                gives all timings and the separate P3109 comparison.", "url": "https://wpnews.pro/news/floatlib-verified-floating-point-arithmetic-in-lean", "canonical_source": "https://leandojo.org/floatlib.html", "published_at": "2026-09-22 01:51:56+00:00", "updated_at": "2026-09-22 02:23:34.913823+00:00", "lang": "en", "topics": ["machine-learning", "ai-research", "developer-tools"], "entities": ["FloatLib", "Lean", "IEEE", "P3109"], "alternates": {"html": "https://wpnews.pro/news/floatlib-verified-floating-point-arithmetic-in-lean", "markdown": "https://wpnews.pro/news/floatlib-verified-floating-point-arithmetic-in-lean.md", "text": "https://wpnews.pro/news/floatlib-verified-floating-point-arithmetic-in-lean.txt", "jsonld": "https://wpnews.pro/news/floatlib-verified-floating-point-arithmetic-in-lean.jsonld"}}