WIP model of floats for the standard library
Find a file
2026-06-25 11:30:39 +00:00
.github/workflows Initial commit 2026-06-08 11:19:11 +00:00
FloatModel A state that can be compiled for posterity 2026-06-25 11:30:39 +00:00
FloatModelTests A state that can be compiled for posterity 2026-06-25 11:30:39 +00:00
test-vectors A state that can be compiled for posterity 2026-06-25 11:30:39 +00:00
.gitignore Initial commit 2026-06-08 11:19:11 +00:00
FloatModel.lean Fix 2026-06-16 11:40:38 +00:00
FloatModelTests.lean Implement subtraction with some very basic tests 2026-06-10 09:28:38 +00:00
lake-manifest.json Initial commit 2026-06-08 11:19:11 +00:00
lakefile.toml Refactor tests to use pregenerated vectors 2026-06-16 09:33:14 +00:00
lean-toolchain A state that can be compiled for posterity 2026-06-25 11:30:39 +00:00
LICENSE Initial commit 2026-06-08 11:19:11 +00:00
README.md A state that can be compiled for posterity 2026-06-25 11:30:39 +00:00

float-model

Minimal float model for the Lean standard library.

This has been upstreamed into Lean core to be included in Lean 4.33, see #14079, #14091 and #14110 and the blog post.

Testing

All test vectors are committed (gzip-compressed, in Berkeley TestFloat format) under test-vectors/, so the checks run with no external tooling:

lake exe testfloat-check

discovers every vector file, decompresses it, and checks the model's binary32 and binary64 operations (add sub mul div sqrt eq le lt) against it, printing failures and a per-file summary. Pass substring filters to restrict the run (e.g. lake exe testfloat-check f64_mul) and --all to show every failure.

Three suites are checked, one per subdirectory of test-vectors/: the Berkeley TestFloat level-1 vectors, the UCBTEST library vectors (converted to TestFloat format), and the number-theoretically hard halfway/nearly-halfway cases generated from the UCBTEST mul/div/sqrt programs. See test-vectors/README.md for how each suite is produced and FloatModelTests/TestFloatCheck.lean for the checker.