Packed Floating Point Numbers #
This is a test module description
Equations
Equations
- instReprPackedFloat = { reprPrec := reprPackedFloat✝ }
Equations
- One or more equations did not get rendered due to their size.
Equations
Equations
- One or more equations did not get rendered due to their size.
Equations
- One or more equations did not get rendered due to their size.
A fixed point number extended with infinity and NaN.
- state : State
- num : FixedPoint width exOffset
Instances For
Equations
Equations
- instReprEFixedPoint = { reprPrec := reprEFixedPoint✝ }
Returns the "canonical" NaN for the given floating point format. For example,
the canonical NaN for exWidth = 3
and sigWidth = 4
is 0.111.1000
.
Equations
- PackedFloat.getNaN exWidth sigWidth = { sign := decide False, ex := BitVec.allOnes exWidth, sig := BitVec.ofNat sigWidth (2 ^ (sigWidth - 1)) }
Instances For
Returns the infinity value of the specified sign for the given floating point format.
Equations
- PackedFloat.getInfinity exWidth sigWidth sign = { sign := sign, ex := BitVec.allOnes exWidth, sig := 0 }
Instances For
Returns the (positive) zero value for the given floating point format.
Instances For
Returns the maximum (magnitude) value for the given sign.
Equations
- PackedFloat.getMax exWidth sigWidth sign = { sign := sign, ex := BitVec.allOnes exWidth - 1, sig := BitVec.allOnes sigWidth }
Instances For
Equations
- pf.isInfinite = (pf.ex == BitVec.allOnes e && pf.sig == 0)
Instances For
Instances For
Equations
- pf.isNormOrSubnorm = (pf.ex != BitVec.allOnes e)
Instances For
Equations
- pf.isZeroOrSubnorm = (pf.ex == 0)
Instances For
Returns the PackedFloat
representation for the given BitVec
.
Equations
- PackedFloat.ofBits e s b = { sign := b.msb, ex := BitVec.truncate e (b >>> s), sig := BitVec.truncate s b }
Instances For
Returns the BitVec
representation for the given PackedFloat
.
Instances For
Convert from a packed float to a fixed point number.
Conversion function assumes IEEE compliance. For output FixedPoint
number to
have a non-degenerate exponent offset, we need two or more bits in the
exponent.
NOTE: Assuming IEEE compliance, you technically only need 2^e + s - 2 bits to cover the entire range of representable values.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
Instances For
Equations
- EFixedPoint.getInfinity sign hExOffset = { state := State.Infinity, num := { sign := sign, val := 0, hExOffset := hExOffset } }
Instances For
Equations
- EFixedPoint.zero hExOffset = { state := State.Number, num := { sign := decide False, val := 0, hExOffset := hExOffset } }
Instances For
Floating point equality test.
Recall that NaN ≠ Nan
under the floating point semantics.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Floating point equality test, where we check upto denotation. So, under this definition:
- NaN = Nan iff thestates are both Nan.
- +Infinity = +Infinity, -Infinity = -Infinity.
- Number equality is reflexive.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Instances For
E5M2 floating point representation of 1.0
Equations
- oneE5M2 = PackedFloat.ofBits 5 2 60#8
Instances For
E5M2 floating point representation of 2.0
Equations
- twoE5M2 = PackedFloat.ofBits 5 2 64#8
Instances For
Smallest (positive) normal number in E5M2 floating point.
Equations
- minNormE5M2 = PackedFloat.ofBits 5 2 4#8
Instances For
Smallest (positive) subnormal number in E5M2 floating point.
Equations
- minSubnormE5M2 = PackedFloat.ofBits 5 2 1#8