Saturating quantization #
clamp restricts an exact scalar to declared finite endpoints. spec requires a code denoting
that clamped scalar exactly; it does not round an interior input onto a representable grid.
The relation has no result when the clamped scalar is unrepresentable, even if both endpoints
are representable. A concrete family must establish representability to obtain a total kernel.
The definitions are independent of radix, storage width, and overflow encodings.
Clamp to [lower, upper] when lower ≤ upper; otherwise return lower.
Instances For
On a nonempty interval, clamping is Mathlib's interval projection with its bounds erased.
Clamping fixes values already inside the declared interval.
A clamped value is never below the lower endpoint.
When lower ≤ upper, a clamped value never exceeds upper.
Require exact representation of clamp lower upper input.
An unrepresentable clamped scalar has no permitted result. When lower > upper, the relation
requires representation of lower for every input, following clamp's endpoint convention.