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✝¹)
    Equations
    • One or more equations did not get rendered due to their size.
    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.

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

        Negate a Float32.Model.

        Equations
        Instances For
          @[instance_reducible]
          Equations

          Return a Float32.Model with positive sign.

          Equations
          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.

            Equations
            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.

              Equations
              Instances For

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

                This is not a total ordering.

                Equations
                Instances For

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

                  This is not a reflexive relation.

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

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

                    Equations
                    Instances For

                      Returns true if the float is positive or negative infinity.

                      Equations
                      Instances For

                        Returns true if the float is NaN.

                        Equations
                        Instances For

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

                          Equations
                          Instances For

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

                            Equations
                            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.

                              Equations
                              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.

                                Equations
                                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.

                                  Equations
                                  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.

                                    Equations
                                    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.

                                      Equations
                                      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.

                                        Equations
                                        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.

                                          Equations
                                          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.

                                            Equations
                                            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.

                                              Equations
                                              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.

                                                Equations
                                                Instances For