Arithmetic for nested quotient rules #
Checked operations retain range-loss information until the complete quotient has been evaluated.
The cold path evaluates the original finite coefficient trees over Rat, then rounds each
coefficient through FloatLib to the requested format. This is scoped to one quotient: it cannot
recover information lost before its inputs were formed.
Coefficients in the algebra generated by n commuting square-zero variables.
- scalar : ℚ → QuotientCoefficients 0
- dual {n : ℕ} : QuotientCoefficients n → QuotientCoefficients n → QuotientCoefficients (n + 1)
Instances For
Instances For
Instances For
Instances For
Instances For
The caller checks that the denominator's primal is nonzero before entering this recursion.
Instances For
Operations used inside one complete quotient, together with finite coefficient conversion.
Internal byte flags record nonfinite or subnormal results, including a nonzero product or quotient rounded to zero. Zero means no range loss; recursive carriers combine flags with bitwise OR. The checked-operation entrypoints expose the same Boolean result without converting at each internal node. Unsupported carriers use the ordinary operations and do not supply a conversion.
- supported : Bool
- depth : ℕ
- encode : α → Option (QuotientCoefficients (depth α))
- decode : QuotientCoefficients (depth α) → Option α
- copyPrimal : α → α → α
Copy the scalar primal's native sign of zero after replaying derivative coefficients.
Instances
Instances For
Instances For
Instances For
Instances For
Replay only finite input trees with an invertible denominator.
Only coefficient conversion crosses this cold boundary, leaving the checked arithmetic operations available for specialization in the caller.
Instances For
Instances For
Instances For
Range flags for the actual native product z = x * y, using native zero equality.
The open subnormal interval includes zero; nonzero inputs detect a product rounded to zero.
This formula requires the actual product, not an independently supplied third value.
Instances For
Range flags for the actual native quotient z = x / y, using native zero equality.
A zero denominator already makes the result nonfinite. A zero or subnormal result with a
nonzero numerator requires replay. This formula assumes z is the actual division result.
Instances For
Instances For
Instances For
Instances For
Range flags for the actual native product z = x * y, using native zero equality.
The open subnormal interval includes zero; nonzero inputs detect a product rounded to zero.
This formula requires the actual product, not an independently supplied third value.
Instances For
Range flags for the actual native quotient z = x / y, using native zero equality.
A zero denominator already makes the result nonfinite. A zero or subnormal result with a
nonzero numerator requires replay. This formula assumes z is the actual division result.
Instances For
FloatLib exception status plus the stricter range predicate needed by a nested quotient.
IEEE underflow requires inexactness. An exact subnormal intermediate must also trigger replay, since subsequent multiplication or division can lose coefficients. Ordinary inexact rounding alone does not trigger replay.
Instances For
Configured IEEE values use FloatLib's nearest-even operations and exact finite decoder.
The complete derivative tree is replayed by the recursive Dual instance. Every coefficient is
rounded independently to the original descriptor and storage plan, including formats wider than
binary64. Finite-only encodings are not enabled: their saturation policy would require a separate
derivative contract. True coefficients outside the IEEE range may still round to zero or infinity.