The logical model for the Float type.
This is defined as the type of UInt64 with the additional restriction that bit patterns encoding
a NaN must be exactly a chosen canonical NaN.
Most functions on Float.Model work by unpacking the Float.Model into the inductive type
UnpackedFloat, performing the operation there, and then repacking the result into a Float.Model.
It is not a goal of this development to serve as the basis for a general-purpose floating-point
library or to have any direct lemmas written about it at all. Rather, users interested in a library
about floating-point numbers should develop such a library completely separately, and users
interested in proving properties of their programs involving Float should prove that the
operations defined here are equivalent to the operations defined in the separate library and then
transfer lemmas from the library to the Float and Float32 types.
- toBits : UInt64
The underlying bit pattern of the
Float.Model. - valid : Format.binary64.Valid self.toBits.toBitVec
The underlying bit pattern is valid according to the IEEE
binary64format.
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
Unpack a Float.Model into the corresponding UnpackedFloat.
Instances For
Pack an UnpackedFloat into the corresponding Float.Model.
This operation only gives a meaningful result if the float is
already correctly rounded for the Format.binary64 format.
Equations
- Float.Model.pack f = { toBits := { toBitVec := Float.Model.UnpackedFloat.pack Float.Model.Format.binary64 f }, valid := ⋯ }
Instances For
Equations
- Float.Model.instAdd = { add := fun (a b : Float.Model) => a.add b }
Equations
- Float.Model.instSub = { sub := fun (a b : Float.Model) => a.sub b }
Equations
- Float.Model.instMul = { mul := fun (a b : Float.Model) => a.mul b }
Equations
- Float.Model.instDiv = { div := fun (a b : Float.Model) => a.div b }
Equations
- Float.Model.instNeg = { neg := fun (a : Float.Model) => a.neg }
Compute the ordering between two Float.Model as specified by IEEE. Returns an
Option Ordering to account for the fact that NaN is incomparable with everything.
Also, positive and negative zero are equal.
Instances For
Equations
- Float.Model.instLE = { le := fun (a b : Float.Model) => a.le b = true }
Equations
- a.instDecidableLE b = instDecidableEqBool (a.le b) true
Equations
- Float.Model.instLT = { lt := fun (a b : Float.Model) => a.lt b = true }
Equations
- a.instDecidableLT b = instDecidableEqBool (a.lt b) true
Equations
- Float.Model.instBEq = { beq := fun (a b : Float.Model) => a.beq b }
Construct a Float.Model from its bit representation. This operation canonicalizes
all NaN inputs into the canonical NaN.
Equations
Instances For
Converts a Float.Model to a UInt8, truncating after the decimal point, sending NaN to
0 and clamping out-of-range values and infinities.
Instances For
Converts a Float.Model to a UInt16, truncating after the decimal point, sending NaN to
0 and clamping out-of-range values and infinities.
Instances For
Converts a Float.Model to a UInt32, truncating after the decimal point, sending NaN to
0 and clamping out-of-range values and infinities.
Instances For
Converts a Float.Model to a UInt64, truncating after the decimal point, sending NaN to
0 and clamping out-of-range values and infinities.
Instances For
Converts a Float.Model to a USize, truncating after the decimal point, sending NaN to
0 and clamping out-of-range values and infinities.
Instances For
Converts a Float.Model to an Int8, truncating after the decimal point, sending NaN to
0 and clamping out-of-range values and infinities.
Instances For
Converts a Float.Model to an Int16, truncating after the decimal point, sending NaN to
0 and clamping out-of-range values and infinities.
Instances For
Converts a Float.Model to an Int32, truncating after the decimal point, sending NaN to
0 and clamping out-of-range values and infinities.
Instances For
Converts a Float.Model to an Int64, truncating after the decimal point, sending NaN to
0 and clamping out-of-range values and infinities.
Instances For
Converts a Float.Model to an ISize, truncating after the decimal point, sending NaN to
0 and clamping out-of-range values and infinities.
Instances For
Computes m * 10^e.
Equations
Instances For
Equations
- Float.Model.instInhabited = { default := Float.Model.ofNat 0 }