TorchLean API

FloatLib.Floats.Formats.P3109

P3109 formats #

Signed and unsigned P3109 descriptors, exact arithmetic, round-then-saturate projection, and ExecFloat.P3109 conversions. ofDyadic and ofRat project exact values directly; convert, cast, and mixed-expression operations use the same projection rules. Named constructors provide zero, NaN, and supported infinities. ofFiniteFields? checks field widths and reserved encodings; ofNatBits accepts serialized codes.

Core arithmetic evaluates exact rational intermediates and performs one destination projection. Square root uses exact integer comparisons with a proof against Real.sqrt. The common ExecFloat capabilities provide add, subtract, multiply, divide, square root, and FMA; ExecFloat.P3109.*To also permits independent P3109 source and destination descriptors. The mixed-operation interface covers fused addition, scaled arithmetic, and external binary16, binary32, and BFloat16 destinations. Extrema, classification, format queries, and neighbor operations follow the same descriptor's datum set.

The implementation follows Interim Report v4.0.3. This is a working-group report, not an approved IEEE standard. Conversion indicators are defined by FloatLib.

Finite values use binary scientific notation with P - 1 stored trailing bits and an implicit leading bit for normal values. A separate descriptor is needed because:

The family shares exact dyadics, comparison, and deterministic rounding with the other formats. Field classification and saturation use the P3109 rules.

Reference #

Projection #

This is the public entry point for exact P3109 round-then-saturate projection, direct encoding, their correctness theorems, and the rounding-direction theorems for the deterministic modes.