Values of encoded numerical systems #
An encoded numerical system may contain ordinary values, signed infinities, and exceptional bit
patterns. These possibilities are not specific to IEEE floating point: posits have NaR, some
low-precision formats reserve individual words, and fixed-point systems may have no exceptional
values at all.
NumericalValue records this common semantic shape without prescribing a storage layout. The
finite value type remains a parameter, so a system may denote real numbers, rational numbers,
integers, complex numbers, or another exact mathematical domain.
Why an encoded word has no ordinary numerical value.
- nan
(payload : Option Nat := none)
: ExceptionalValue
A NaN encoding, optionally carrying its representation-defined payload bits.
- notAReal : ExceptionalValue
The single not-a-real value used by posit systems.
- reserved
(payload : Option Nat := none)
: ExceptionalValue
A representation-specific reserved word, optionally retaining its encoded payload.
- undefined : ExceptionalValue
An operation whose result is intentionally outside the scalar semantics.
Instances For
Instances For
Instances For
The mathematical meaning of one encoded value.
The sign on infinity is true for negative infinity. Signed finite zero, when a format
distinguishes it, should be retained by the finite semantic type. For example, FloatLib's
exact Dyadic representation stores the sign of a zero mantissa.
- finite {α : Type u} (value : α) : NumericalValue α
- infinity {α : Type u} (negative : Bool) : NumericalValue α
- exceptional {α : Type u} (value : ExceptionalValue) : NumericalValue α
Instances For
Instances For
Instances For
Apply a function to an ordinary value while preserving infinities and exceptional values.
Instances For
Mapping preserves an exceptional value because it has no ordinary payload to transform.
Extract the ordinary value, returning none for infinity or an exceptional encoding.
Instances For
Whether this semantic value is ordinary and finite.
Instances For
An exceptional observation has no finite payload.
An exceptional observation is not finite.
Mapping the identity function leaves every numerical value unchanged.
Extracting a finite payload commutes with mapping its scalar value.