Correctness of native one-word finite addition #
Under Eligible, every accepted result of Add.Runtime agrees with the exact finite kernel.
addFinite_refines also covers subtraction by identifying the toggled right sign with neg y.
A declined input is handled by the dispatcher's generic fallback.
normalSpec? describes the normal branch of FiniteProductRound.round. The proof transfers
native rounding to this specification using the shared carry and packing theorem
NativeWordProduct.finish_eq, then treats signed magnitudes, exponent alignment, and decoding.
Natural-number specification of the normal rounding path #
The normal branch of FiniteProductRound.round, declining instead of producing a subnormal or an
infinite result.
For a nonzero magnitude, this rounds the value with sign sign and magnitude
magnitude * 2 ^ (scale - 2 * ieeeSubnormalAlignExp fmt), interpreting subtraction in Int.
normalSpec_refines identifies each accepted answer with the total product rounder.
Instances For
A some answer of the normal specification is the arbitrary-precision rounder's result.
Machine-word rounding #
The alignment offset is exact when expWidth ≤ 30 and fracWidth ≤ 61.
The alignment shift limit is exact when fracWidth ≤ 61.
The machine-word rounder computes the natural-number normal specification.
With a nonzero magnitude and a scale bounded by the exponent range, no intermediate position, shift or increment wraps around the word.
An accepted machine-word rounding is the unsigned-scale rounding of the exact kernel.
Signed magnitudes and alignment #
An accepted aligned combination is the exact kernel's signed-magnitude combination.
The machine-word finite scale is the compact finite scale of the exact kernel.
Sticky alignment for large scale gaps #
With a normal larger significand and a small enough lower operand, the exact aligned magnitude
has its leading bit at least at width + gap - 1.
With a normal larger significand, three guard positions and a sticky bit round like the exact sum:
the exact magnitude keeps at least fracWidth + 2 bits above the jammed positions.
An accepted sticky alignment is the exact signed-magnitude combination of the same fields.
An accepted field addition is the exact unsigned-scale sum of the same fields.
The exponent bounds keep every scale below 2 ^ 31 and the significand bounds keep the aligned
same-sign sum below 2 ^ 64, which is all the machine-word transfer needs.
Storage-word decoding #
The generic finite decoder sees the fields the one-word kernel extracts from a finite word.
Negating a finite word keeps its exponent and fraction fields and toggles its sign.
The exponent field of a one-word value is a stored exponent.
The finite significand of a one-word value has at most fracWidth + 1 bits.
An accepted one-word addition, or subtraction, is the exact compact finite kernel's answer.
With negateRight set the kernel toggles the right sign in machine words, and the theorem states
the claim for neg y. Declines fall outside the statement, and the dispatcher handles them with
the exact implementation. Only the capacity contract Eligible is assumed of the format.
Storage-word entry points #
On storage words below the radix, addFinite? is the ofWord image of addFiniteWord?.