Documentation

Std.Time.Internal.UnitVal

A structure representing a unit of a given ratio type α.

  • ofInt :: (
    • val : Int

      Value inside the UnitVal Value.

  • )
Instances For
    @[inline]

    Creates a UnitVal from a Nat.

    Equations
    Instances For
      @[inline]

      Converts a UnitVal to an Int.

      Equations
      Instances For
        @[inline]
        def Std.Time.Internal.UnitVal.mul {a : Internal.Rat} (unit : UnitVal a) (factor : Int) :
        UnitVal (a / { num := factor, den := 1 })

        Multiplies the UnitVal by an Int, resulting in a new UnitVal with an adjusted ratio.

        Equations
        • unit.mul factor = { val := unit.val * factor }
        Instances For
          @[inline]
          def Std.Time.Internal.UnitVal.ediv {a : Internal.Rat} (unit : UnitVal a) (divisor : Int) :
          UnitVal (a * { num := divisor, den := 1 })

          Divides the UnitVal by an Int, resulting in a new UnitVal with an adjusted ratio. Using the E-rounding convention (euclidean division)

          Equations
          Instances For
            @[inline]
            def Std.Time.Internal.UnitVal.tdiv {a : Internal.Rat} (unit : UnitVal a) (divisor : Int) :
            UnitVal (a * { num := divisor, den := 1 })

            Divides the UnitVal by an Int, resulting in a new UnitVal with an adjusted ratio. Using the "T-rounding" (Truncation-rounding) convention

            Equations
            Instances For
              @[inline]
              def Std.Time.Internal.UnitVal.div {a : Internal.Rat} (unit : UnitVal a) (divisor : Int) :
              UnitVal (a * { num := divisor, den := 1 })

              Divides the UnitVal by an Int, resulting in a new UnitVal with an adjusted ratio.

              Equations
              Instances For
                @[inline]

                Adds two UnitVal values of the same ratio.

                Equations
                Instances For
                  @[inline]

                  Subtracts one UnitVal value from another of the same ratio.

                  Equations
                  Instances For
                    @[inline]

                    Returns the absolute value of a UnitVal.

                    Equations
                    Instances For
                      @[inline]

                      Converts an Offset to another unit type.

                      Equations
                      Instances For