Bounded fixed-point execution #
A bounded fixed-point code stores its coefficient in FixedInt width and interprets that signed
integer at a fixed radix scale. Arithmetic names state their overflow policy explicitly:
- wrapping addition and subtraction use direct
BitVecarithmetic; - wrapping multiplication sign-extends or truncates both inputs to the destination width before multiplying;
- checked operations return
nonewhen the exact coefficient is out of range; - saturating operations clamp the exact coefficient to the destination range.
Multiplication composes scales: operands with p and q fractional digits produce p + q
fractional digits. The destination width is independent of the two input widths.
A signed width-bit coefficient interpreted with a fixed radix scale.
This is a transparent type definition rather than an abbreviation. It has exactly the
FixedInt width runtime representation, while retaining the radix and scale in elaborated type
expressions so proof-aware tooling can identify the numerical format.
Instances For
Natural scaling denominator of a fixed-point format.
Instances For
Signed integer coefficient stored by a bounded fixed-point code.
Instances For
Exact rational value of a bounded fixed-point code.
Instances For
Encode an integer coefficient modulo 2 ^ width.
Instances For
Addition modulo 2 ^ width.
Instances For
Subtraction modulo 2 ^ width.
Instances For
Multiplication modulo 2^outWidth.
Both coefficients are resized in two's-complement form before the native BitVec product. This
implements exact multiplication followed by centered reduction at the destination width.
Instances For
Return the exact same-scale sum when it fits the signed coefficient width.
Instances For
Return the exact same-scale difference when it fits the signed coefficient width.
Instances For
Return the exact product when its coefficient fits outWidth signed bits.
Instances For
Same-scale addition with saturation at the signed coefficient bounds.
Instances For
Same-scale subtraction with saturation at the signed coefficient bounds.
Instances For
Product with its exact coefficient saturated to outWidth signed bits.