Documentation

Init.Data.Float.Model.Float32

structure Float32.Model :

The logical model for the Float32 type.

This is defined as the type of UInt32 with the additional restriction that bit patterns encoding a NaN must be exactly a chosen canonical NaN.

Most functions on Float32.Model work by unpacking the Float32.Model into the inductive type UnpackedFloat, performing the operation there, and then repacking the result into a Float32.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 Float32 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.

Instances For
    def Float32.instDecidableEqModel.decEq (x✝ x✝¹ : Model) :
    Decidable (x✝ = x✝¹)
    Instances For

      Unpack a Float32.Model into the corresponding UnpackedFloat.

      Instances For

        Pack an UnpackedFloat into the corresponding Float32.Model. This operation only gives a meaningful result if the float is already correctly rounded for the Format.binary32 format.

        Instances For

          The special NaN value.

          Instances For

            The special Inf value.

            Instances For

              Compute the sum of two Float32.Model.

              Instances For

                Compute the difference of two Float32.Model.

                Instances For

                  Compute the product of two Float32.Model.

                  Instances For

                    Compute the quotient of two Float32.Model.

                    Instances For
                      @[instance_reducible]
                      @[instance_reducible]
                      @[instance_reducible]
                      @[instance_reducible]

                      Compute the square root of a Float32.Model.

                      Instances For

                        Compute the fused multiply-add a * b + c of three Float32.Model, with a single rounding.

                        Instances For

                          Negate a Float32.Model.

                          Instances For
                            @[instance_reducible]

                            Return a Float32.Model with positive sign.

                            Instances For

                              Compute the ordering between two Float32.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

                                Determine whether a is less than or equal to b according to IEEE rules.

                                This is not a total ordering, and ≤ is not reflexive.

                                Instances For

                                  Determine whether a is less than b according to IEEE rules.

                                  This is not a total ordering.

                                  Instances For

                                    Determine whether a is equal to b according to IEEE rules.

                                    This is not a reflexive relation.

                                    Instances For
                                      @[instance_reducible]
                                      @[instance_reducible]
                                      @[instance_reducible]

                                      Compute the IEEE-754-2019 minimum of two Float32.Model, which is NaN if either operand is NaN and considers -0 to be smaller than +0.

                                      Instances For

                                        Compute the IEEE-754-2019 minimumNumber of two Float32.Model, which ignores a NaN operand if the other operand is a number and considers -0 to be smaller than +0.

                                        Instances For

                                          Compute the IEEE-754-2019 maximum of two Float32.Model, which is NaN if either operand is NaN and considers -0 to be smaller than +0.

                                          Instances For

                                            Compute the IEEE-754-2019 maximumNumber of two Float32.Model, which ignores a NaN operand if the other operand is a number and considers -0 to be smaller than +0.

                                            Instances For
                                              @[instance_reducible]
                                              @[instance_reducible]

                                              Returns true if the float represents a real number, i.e., it is neither infinite nor NaN.

                                              Instances For

                                                Returns true if the float is positive or negative infinity.

                                                Instances For

                                                  Returns true if the float is NaN.

                                                  Instances For

                                                    Construct a Float32.Model from its bit representation. This operation canonicalizes all NaN inputs into the canonical NaN.

                                                    Instances For

                                                      Converts an Int to a Float32.Model, returning positive zero on zero.

                                                      Instances For

                                                        Converts a Nat to a Float32.Model, returning positive zero on zero.

                                                        Instances For

                                                          Converts a UInt8 to a Float32.Model, returning positive zero on zero.

                                                          Instances For

                                                            Converts a UInt16 to a Float32.Model, returning positive zero on zero.

                                                            Instances For

                                                              Converts a UInt32 to a Float32.Model, returning positive zero on zero.

                                                              Instances For

                                                                Converts a UInt64 to a Float32.Model, returning positive zero on zero.

                                                                Instances For

                                                                  Converts a USize to a Float32.Model, returning positive zero on zero.

                                                                  Instances For

                                                                    Converts an Int8 to a Float32.Model, returning positive zero on zero.

                                                                    Instances For

                                                                      Converts an Int16 to a Float32.Model, returning positive zero on zero.

                                                                      Instances For

                                                                        Converts an Int32 to a Float32.Model, returning positive zero on zero.

                                                                        Instances For

                                                                          Converts an Int64 to a Float32.Model, returning positive zero on zero.

                                                                          Instances For

                                                                            Converts an ISize to a Float32.Model, returning positive zero on zero.

                                                                            Instances For

                                                                              Converts a Float32.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 Float32.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 Float32.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 Float32.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 Float32.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 Float32.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 Float32.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 Float32.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 Float32.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 Float32.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.

                                                                                                  Instances For
                                                                                                    @[instance_reducible]