Bounded static storage #
Bounded UInt8, UInt16, UInt32, and UInt64 carriers store exact natural-number encodings.
Callers choose a carrier and prove that the encoding fits both the format bound and the word's
capacity.
The bounds are propositions erased from the runtime carrier. The packing functions and their round-trip laws are independent of the numerical format using them.
@[inline]
def
FloatLib.Numerics.StaticStorage.Word16Code.ofNat
{bound : ℕ}
(bits : ℕ)
(hbound : bits < bound)
(hcapacity : bits < 2 ^ 16)
:
Word16Code bound
Narrow an in-range encoding to a direct 16-bit carrier.
Instances For
@[inline]
def
FloatLib.Numerics.StaticStorage.Word32Code.ofNat
{bound : ℕ}
(bits : ℕ)
(hbound : bits < bound)
(hcapacity : bits < 2 ^ 32)
:
Word32Code bound
Narrow an in-range encoding to a direct 32-bit carrier.
Instances For
@[inline]
def
FloatLib.Numerics.StaticStorage.Word64Code.ofNat
{bound : ℕ}
(bits : ℕ)
(hbound : bits < bound)
(hcapacity : bits < 2 ^ 64)
:
Word64Code bound
Narrow an in-range encoding to a direct 64-bit carrier.