Alias for multiply
Alias for multiply
scala> import spire.implicits._ scala> import shapeless._ scala> import libra._, libra.si._ scala> 2.m * 3.m res0: Quantity[Int, Term[Length, Metre, Fraction[2, 1]] :: HNil] = Quantity(6)
Alias for add
Alias for add
scala> import spire.implicits._ scala> import shapeless._ scala> import libra._, libra.si._ scala> 3.m + 2.m res1: Quantity[Int, Term[Length, Metre, Fraction[1, 1]] :: HNil] = Quantity(5)
Alias for subtract
Alias for subtract
scala> import spire.implicits._ scala> import shapeless._ scala> import libra._, libra.si._ scala> 3.m - 2.m res1: Quantity[Int, Term[Length, Metre, Fraction[1, 1]] :: HNil] = Quantity(1)
Alias for divide
Alias for divide
scala> import spire.implicits._ scala> import shapeless._ scala> import libra._, libra.si._ scala> 4.0.m / 2.0.m res0: Quantity[Double, HNil] = Quantity(2.0)
Alias for quotient
Alias for quotient
scala> import spire.implicits._ scala> import shapeless._ scala> import libra._, libra.si._ scala> 5.m /~ 2.m res0: Quantity[Int, HNil] = Quantity(2)
Alias for power
Alias for power
scala> import spire.implicits._ scala> import shapeless._ scala> import libra._, libra.si._ scala> 2.0.m^(3) res0: Quantity[Double, Term[Length, Metre, Fraction[3, 1]] :: HNil] = Quantity(8.0)
Adds another quantity using the spire AdditiveSemigroup.
Adds another quantity using the spire AdditiveSemigroup.
the quantity to add. This must have the equivalient dimensions.
scala> import spire.implicits._ scala> import shapeless._ scala> import libra._, libra.si._ scala> 3.m add 2.m res1: Quantity[Int, Term[Length, Metre, Fraction[1, 1]] :: HNil] = Quantity(5)
Divides by a quantity
Divides by a quantity
the quantity to divide by
scala> import spire.implicits._ scala> import shapeless._ scala> import libra._, libra.si._ scala> 4.0.m divide 2.0.m res0: Quantity[Double, HNil] = Quantity(2.0)
Raises the quantity to the power of -1
Raises the quantity to the power of -1
scala> import spire.implicits._ scala> import shapeless._ scala> import libra._, libra.si._ scala> val x = 2.0.m x: Quantity[Double, Term[Length, Metre, Fraction[1, 1]] :: HNil] = Quantity(2.0) scala> x.invert res2: Quantity[Double, Term[Length, Metre, Fraction[-1, 1]] :: HNil] = Quantity(0.5)
Multiplies by a quantity
Multiplies by a quantity
the quantity to multiply by
scala> import spire.implicits._ scala> import shapeless._ scala> import libra._, libra.si._ scala> 2.m multiply 3.m res0: Quantity[Int, Term[Length, Metre, Fraction[2, 1]] :: HNil] = Quantity(6)
Negates the quantity
Negates the quantity
scala> import spire.implicits._ scala> import shapeless._ scala> import libra._, libra.si._ scala> val x = 2.m x: Quantity[Int, Term[Length, Metre, Fraction[1, 1]] :: HNil] = Quantity(2) scala> x.negate res2: Quantity[Int, Term[Length, Metre, Fraction[1, 1]] :: HNil] = Quantity(-2)
Raises to a power
Raises to a power
the Integer power to raise by
scala> import spire.implicits._ scala> import shapeless._ scala> import libra._, libra.si._ scala> 2.0.m.power[3] res0: Quantity[Double, Term[Length, Metre, Fraction[3, 1]] :: HNil] = Quantity(8.0)
Euclidean division by a quantity
Euclidean division by a quantity
the quantity to divide by
the quotient of Euclidean division
scala> import spire.implicits._ scala> import shapeless._ scala> import libra._, libra.si._ scala> 5.m quotient 2.m res0: Quantity[Int, HNil] = Quantity(2)
The standard index form String
The standard index form String
scala> import spire.implicits._ scala> import libra._, libra.si._ scala> 2.m.show res0: String = 2 m [L]
Subtracts another quantity using the spire AdditiveGroup
Subtracts another quantity using the spire AdditiveGroup
the quantity to subtract. This must have the equivalient dimensions.
scala> import spire.implicits._ scala> import shapeless._ scala> import libra._, libra.si._ scala> 3.m subtract 2.m res1: Quantity[Int, Term[Length, Metre, Fraction[1, 1]] :: HNil] = Quantity(1)
the coefficient
Represents a dimensional quantity
the Numeric type of the quantity e.g. Int, Float, Double
the dimensions
the coefficient