Documentation

Fp.Rounding

inductive RoundingMode :

Rounding modes used in floating-point calculations.

Available modes:

  • RNA: Round to nearest, tiebreak away from zero.
  • RNE: Round to nearest, tiebreak to even significand.
  • RTN: Round towards negative infinity.
  • RTP: Round towards positive infinity.
  • RTZ: Round towards zero.
Instances For
    Equations
    • One or more equations did not get rendered due to their size.
    def fls' {n : Nat} (m : Nat) (b : BitVec n) (hm : n m) :
    Equations
    Instances For
      @[irreducible]
      def fls_log {n : Nat} (m : Nat) (b : BitVec n) :
      Equations
      Instances For
        def fls {n : Nat} (b : BitVec n) :

        Find the position of the last (most significant) set bit in a BitVec.

        Returns zero if BitVec is zero. Otherwise, returns the index starting from 1.

        Implemented naively using a fold with $O(n)$ steps.

        Equations
        Instances For
          def flsLog {n : Nat} (b : BitVec n) :

          Find the position of the last (most significant) set bit in a BitVec.

          Returns zero if BitVec is zero. Otherwise, returns the index starting from 1.

          Equations
          Instances For
            theorem flsIter_eq_fls (b : BitVec 8) :

            flsLog and fls implement the same function.

            def truncateRight {n : Nat} (w : Nat) (v : BitVec n) :

            Gets the first w bits of the bitvector v.

            Equations
            Instances For
              def round {width exOffset : Nat} (exWidth sigWidth : Nat) (mode : RoundingMode) (x : EFixedPoint width exOffset) :
              PackedFloat exWidth sigWidth

              Round an extended fixed-point number to its nearest floating point number of the specified format, with the specified rounding mode.

              Equations
              • One or more equations did not get rendered due to their size.
              Instances For
                def isExactFloat {width exOffset : Nat} (exWidth sigWidth : Nat) (x : EFixedPoint width exOffset) :

                Determine if a fixed-point number has an exact representation in the specified floating-point format.

                Equations
                • One or more equations did not get rendered due to their size.
                Instances For
                  def roundToInt {e s : Nat} (mode : RoundingMode) (x : PackedFloat e s) :
                  Equations
                  • One or more equations did not get rendered due to their size.
                  Instances For
                    def PackedFloat.ofRat (e s : Nat) (mode : RoundingMode) (num : Int) (den : Nat) :
                    Equations
                    • One or more equations did not get rendered due to their size.
                    Instances For