Values of encoded numerical systems #
An encoded numerical system may contain ordinary values, signed infinities, and exceptional bit
patterns. None of this is 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 is 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)
(negative signaling : Bool := false)
: ExceptionalValue
A NaN encoding, optionally carrying its diagnostic payload, together with its sign bit and whether it is a signaling NaN. The payload excludes encoding markers such as an IEEE quiet bit, which source decoders remove before constructing this representation-independent value. Encodings without these distinctions use the defaults: no payload, positive, and quiet.
- 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
Whether an exceptional observation is a signaling NaN.
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, belongs to the finite semantic type: FloatLib's exact Dyadic representation,
for example, 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.