Native binary32 storage and rounding primitives #
Model FloatFormat.binary32 remains the theorem-facing representation. Narrow-word kernels share
a UInt32 view, direct field operations, exact finite decoding, and rounding primitives
defined here.
Operation-specific kernels and their refinements live in sibling modules. Keeping this base small prevents representation-only clients from importing the much larger addition and fused-operation proof developments.
References #
- IEEE Standard for Floating-Point Arithmetic, IEEE 754-2019, Clauses 3.4, 4.3.1, 5.4.1, and 6.2, https://doi.org/10.1109/IEEESTD.2019.8766229.
- Lean,
Init.Data.Float.Model, for the kernel-visible logical floating-point model used by the surrounding agreement development.
The generic binary32 carrier.
Instances For
View generic binary32 storage as a native word.
Instances For
Rewrap a native binary32 word in the generic carrier.
Instances For
Native storage operations
Toggle the binary32 sign bit without passing through generic BitVec arithmetic.
Instances For
Extract the binary32 sign from a native word.
Instances For
Extract the binary32 biased exponent from a native word.
Instances For
Extract the binary32 fraction from a native word.
Instances For
Decode a finite binary32 native word to the generic exact dyadic representation.
Instances For
Convert natural-number fields to native words, then mask and pack the binary32 fields.
Instances For
Round an exact dyadic to a native binary32 word, using nearest-even rounding.
Instances For
Round the signed magnitude (num / den) * 2^exponent to a native binary32 word; a zero
denominator produces canonical NaN.
The exact quotient calculations remain format-independent natural-number arithmetic. Only the binary32 thresholds and final field packing are specialized.