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
- Std.Time.Internal.instLEUnitVal = { le := fun (x_1 y : Std.Time.Internal.UnitVal x) => x_1.val ≤ y.val }
instance
Std.Time.Internal.instDecidableLeUnitVal
{z : Std.Internal.Rat}
{x y : Std.Time.Internal.UnitVal z}
:
Equations
- Std.Time.Internal.instDecidableLeUnitVal = inferInstanceAs (Decidable (x.val ≤ y.val))
@[inline]
Equations
- Std.Time.Internal.UnitVal.ofNat value = { val := ↑value }
Instances For
@[inline]
Equations
- unit.toInt = unit.val
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.
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.
Equations
- unit.ediv divisor = { val := unit.val.ediv divisor }
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.
Equations
- unit.div divisor = { val := unit.val.tdiv divisor }
Instances For
@[inline]
Adds two UnitVal
values of the same ratio.
Instances For
@[inline]
Subtracts one UnitVal
value from another of the same ratio.
Instances For
@[inline]
Returns the absolute value of a UnitVal
.
Equations
- u.abs = { val := ↑u.val.natAbs }
Instances For
@[inline]
def
Std.Time.Internal.UnitVal.convert
{a b : Std.Internal.Rat}
(val : Std.Time.Internal.UnitVal a)
:
Converts an Offset
to another unit type.
Instances For
Equations
- Std.Time.Internal.UnitVal.instRepr = { reprPrec := fun (x : Std.Time.Internal.UnitVal α) (p : Nat) => reprPrec x.val p }
Equations
- Std.Time.Internal.UnitVal.instLE = { le := fun (x y : Std.Time.Internal.UnitVal α) => x.val ≤ y.val }
Equations
- Std.Time.Internal.UnitVal.instLT = { lt := fun (x y : Std.Time.Internal.UnitVal α) => x.val < y.val }
Equations
- Std.Time.Internal.UnitVal.instAdd = { add := Std.Time.Internal.UnitVal.add }
Equations
- Std.Time.Internal.UnitVal.instSub = { sub := Std.Time.Internal.UnitVal.sub }
Equations
- Std.Time.Internal.UnitVal.instNeg = { neg := fun (x : Std.Time.Internal.UnitVal α) => { val := -x.val } }
Equations
- Std.Time.Internal.UnitVal.instToString = { toString := fun (n_1 : Std.Time.Internal.UnitVal n) => toString n_1.val }