Exact rational arithmetic for P3109 #
The closed operations in Arithmetic evaluate finite operands in Rat, retaining infinities
and the report's single NaN. In particular, division by zero returns NaN, including infinity
divided by zero. FMA and fused add-add form the complete exact expression before projection.
Each ExecFloat.P3109 operation projects into (target := ...), by default the format of its
operands, with (mode := ...) and (saturation := ...) options that default to nearest-even
rounding and no saturation request. unary, binary, and ternary apply any exact closed
operation to operands of independent descriptors. No IEEE exception flags or floating-point
environment are used.
Exact rational intermediates can require large integers when the descriptor has a wide exponent range. This implementation does not promise a fixed workspace bound for arbitrary descriptors.
Reference #
IEEE Working Group P3109, Interim Report on Arithmetic Formats for Machine Learning,
version 4.0.3 (1 September 2026), §§4.10.1–4.10.8, revision 34f5964.
This is an unapproved working-group report, not an approved IEEE standard.
https://github.com/P3109/Public/tree/34f5964d9bb2382b2665d15467fc3517b990b308.
The report's single exceptional datum.
Instances For
Exact rational observation of a decoded binary datum.
Instances For
Negation in the report's closed extended domain.
Instances For
Absolute value in the report's closed extended domain.
Instances For
Copying a sign treats zero as nonnegative and propagates either NaN operand.
Instances For
Exact addition, with the indeterminate result NaN for opposite infinities.
Instances For
Exact subtraction, with no projection of the negated operand.
Instances For
Exact multiplication, with NaN for zero times infinity.
Instances For
Exact division, with NaN for every zero denominator and for infinity over infinity.
Instances For
Exact reciprocal, before the sole destination projection.
Instances For
Exact fused multiply-add, with no intermediate rounding or saturation.
Instances For
Exact fused add-add, with no intermediate rounding or saturation.
Instances For
Exact closed rational value of a P3109 operand.
Instances For
Apply an exact unary closed operation and project the result once into target, by default the
operand's format, rounding in mode before saturation applies.
Instances For
Apply an exact binary closed operation to both decoded operands, then project once into
target, by default the left operand's format.
Instances For
Evaluate a complete exact ternary closed expression, then project once into target, by default
the first operand's format.
Instances For
Negation followed by one projection, which also covers negative results in unsigned targets.
Instances For
Absolute value followed by one projection.
Instances For
Copy the sign of sign, propagating either NaN, and project once.
Instances For
Add the exact decoded operands and project once.
Instances For
Subtract the exact decoded operands and project once.
Instances For
Multiply the exact decoded operands and project once.
Instances For
Divide the exact decoded operands and project once. A zero denominator gives NaN.
Instances For
Take the exact reciprocal and project once. Zero gives NaN.
Instances For
Fused multiply-add: the exact left * right + addend, projected once.
Instances For
Fused add-add: the exact left + middle + right, projected once.