Cldr.Unit.Math.mult

You're seeing just the function mult, go back to Cldr.Unit.Math module for more information.

Specs

mult(Cldr.Unit.t(), Cldr.Unit.t()) ::
  Cldr.Unit.t() | {:error, {module(), String.t()}}

Multiplies two compatible %Unit{} types

Options

Returns

  • A %Unit{} of the same type as unit_1 with a value that is the product of unit_1 and the potentially converted unit_2

  • {:error, {IncompatibleUnitError, message}}

Examples

iex> Cldr.Unit.mult Cldr.Unit.new!(:kilogram, 5), Cldr.Unit.new!(:pound, 1)
#Cldr.Unit<:kilogram, 40855968570202005 <|> 18014398509481984>

iex> Cldr.Unit.mult Cldr.Unit.new!(:pint, 5), Cldr.Unit.new!(:liter, 1)
#Cldr.Unit<:pint, 134691990896416015745491897791939562497958760939520 <|> 12746616238742849396626455585282990375683527307233>

iex> Cldr.Unit.mult Cldr.Unit.new!(:pint, 5), Cldr.Unit.new!(:pint, 1)
#Cldr.Unit<:pint, 5>