Executable standard posit quire operations #
Quire arithmetic implements the operations of Posit Standard (2022), ยง5.11. Every accumulation
kernel works on the signed fixed-point coefficient. Posit operands decode to the shared exact
dyadic carrier and are shifted directly to the quire's fixed scale. No operation normalizes
through Rat.
The standard reserves the most-negative quire word for NaR. Consequently every checked result
uses Model.ofCoefficient: NaR propagates, and either signed overflow or a result equal to the
reserved word produces quire NaR.
The exact coefficient, dyadic, and rational refinement theorems live in Arithmetic.Proof.
References #
- Posit Working Group, Standard for Posit Arithmetic (2022), March 2, 2022, Section 5.11, https://posithub.org/docs/posit_standard-2.pdf.
Add an exact dyadic increment to an ordinary quire.
This shared integer kernel underlies posit addition and fused product accumulation. The function is total and produces quire NaR in three cases: the accumulator is NaR, the increment's stored exponent is below the quire scale, or the exact coefficient sum is not an ordinary quire coefficient. The exponent check is sufficient for alignment; it can reject an otherwise aligned dyadic with trailing zeros in its significand. Decoded ordinary posits and their exact products always pass this check, so it only restricts direct callers of this kernel.
Instances For
Convert a posit into the exact quire associated with the same descriptor.
Instances For
Negate an ordinary quire; quire NaR remains quire NaR.
Instances For
Absolute value of an ordinary quire; quire NaR remains quire NaR.
Instances For
Add one posit exactly to a quire, producing NaR on exceptional input or quire overflow.
Instances For
Subtract one posit exactly from a quire, producing NaR on exceptional input or quire overflow.
Instances For
Add two quires exactly, returning quire NaR on NaR input or signed overflow.
Instances For
Subtract two quires exactly, returning quire NaR on NaR input or signed overflow.
Instances For
Accumulate one exact posit product with no intermediate rounding.
Both posit operands must use the same format as the quire, enforced by the type.
Instances For
Subtract one exact posit product from a quire with no intermediate rounding.
Instances For
Round a quire once to its associated posit.
The ordinary path turns the fixed-point coefficient into a shared dyadic and applies the
Posit Standard (2022) rounder, without constructing a Rat.