TorchLean API

FloatLib.Floats.Formats.Posit.Quire.Model.Core

Executable standard posit quire model #

The Posit Standard (2022) associates an n-bit posit with one 16n-bit quire. The quire stores a signed two's-complement coefficient whose least-significant bit has value 2^(16 - 8n). Its most-negative word is reserved for quire NaR.

This module contains only the representation, executable constructors, classifiers, and integer/dyadic conversion kernels. Their range and denotational theorems live in Model.Proof.

References #

@[inline]

The standard quire width associated with an n-bit posit.

Instances For
    @[inline]

    Binary scale of the quire's least-significant bit.

    Instances For

      Exact standard quire word for one posit descriptor.

      Instances For
        @[instance_reducible]
        def FloatLib.Floats.Formats.Posit.Quire.instDecidableEqModel.decEq {format✝ : Format} (x✝ x✝¹ : Model format✝) :
        Decidable (x✝ = x✝¹)
        Instances For
          @[instance_reducible]
          @[inline]

          Construct a standard quire from its complete unsigned word.

          Instances For
            @[inline]

            Read the standard quire's complete word as an unsigned natural number.

            Instances For
              @[inline]

              Read the signed two's-complement coefficient stored by a quire.

              Instances For
                @[inline]

                The all-zero standard quire.

                Instances For
                  @[inline]

                  Quire NaR, encoded as the most-negative 16n-bit two's-complement word.

                  Instances For
                    @[inline]

                    Whether a quire contains the standard's reserved NaR word.

                    Instances For

                      Signed coefficients available to ordinary quire values.

                      The lower inequality is strict because FixedInt.minValue is the reserved NaR encoding. The greatest two's-complement integer remains an ordinary quire coefficient.

                      Instances For
                        @[inline]

                        Encode an exact quire coefficient, returning quire NaR on overflow or collision with the reserved most-negative word.

                        This is the common overflow boundary used by every standard quire operation.

                        Instances For
                          @[inline]

                          Integer coefficient of a dyadic value at the quire's fixed binary scale.

                          When scaleExponent format ≤ value.exponent, as holds for every ordinary posit and every exact product of two ordinary posits, this is an exact left shift of the signed significand and Model.coefficientOfDyadic_denotes recovers value.toRat. When the stored exponent is below the quire scale, the shift count clamps to zero and the result need not denote value. Model.addDyadic rejects that case, and decoded posit inputs to Model.pToQ satisfy the bound.

                          Instances For