Exact fixed-point representation and execution #
The code stores an unbounded integer coefficient with its radix and fractional precision in the type. Its exact rational decoder and coefficient operations are defined together here: addition, subtraction, and negation keep the scale; multiplication composes the two operand scales.
No operation rounds or overflows. Exact.Proof defines the rational numerical system and proves
these operations refine exact arithmetic. Bounded coefficient policies live in FixedPoint.Bounded.
Natural denominator of a fixed-point grid with the given radix and fractional precision.
Instances For
An integer coefficient interpreted with fractionalDigits radix digits after the point.
- coefficient : ℤ
Signed integer numerator before division by
radix.base ^ fractionalDigits.
Instances For
Instances For
Instances For
Executable operations #
Exact rational value of a fixed-point code.
Instances For
Encode an integer coefficient directly.
Instances For
Exact addition of fixed-point values with a common scale.
Instances For
Exact additive inverse at the same scale.
Instances For
Exact subtraction at a common scale.
Instances For
Exact multiplication. Multiplying scales p and q produces scale p + q; no hidden rescaling
or rounding occurs.