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
    Equations
    • Std.Time.Internal.instInhabitedUnitVal = { default := { val := default } }
    Equations
    • Std.Time.Internal.instBEqUnitVal = { beq := Std.Time.Internal.beqUnitVal✝ }
    Equations
    Equations
    @[inline]

    Creates a UnitVal from a Nat.

    Instances For
      @[inline]

      Converts a UnitVal to an Int.

      Instances For
        @[inline]
        def Std.Time.Internal.UnitVal.mul {a : Std.Internal.Rat} (unit : Std.Time.Internal.UnitVal a) (factor : Int) :
        Std.Time.Internal.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 : Std.Internal.Rat} (unit : Std.Time.Internal.UnitVal a) (divisor : Int) :
          Std.Time.Internal.UnitVal (a * { num := divisor, den := 1 })

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

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

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

            Instances For
              @[inline]

              Adds two UnitVal values of the same ratio.

              Equations
              • u1.add u2 = { val := u1.val + u2.val }
              Instances For
                @[inline]

                Subtracts one UnitVal value from another of the same ratio.

                Instances For
                  @[inline]

                  Returns the absolute value of a UnitVal.

                  Instances For
                    @[inline]

                    Converts an Offset to another unit type.

                    Instances For
                      Equations
                      Equations
                      Equations
                      • Std.Time.Internal.UnitVal.instAdd = { add := Std.Time.Internal.UnitVal.add }