Cldr.Unit.Math.div

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

Specs

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

Divides one compatible %Unit{} type by another

Options

Returns

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

  • {:error, {IncompatibleUnitError, message}}

Examples

iex> Cldr.Unit.div Cldr.Unit.new!(:kilogram, 5), Cldr.Unit.new!(:pound, 1)
#Cldr.Unit<:kilogram, 8171193714040401 <|> 90071992547409920>

iex> Cldr.Unit.div Cldr.Unit.new!(:pint, 5), Cldr.Unit.new!(:liter, 1)
#Cldr.Unit<:pint, 26938398179283203149098379558387912499591752187904 <|> 63733081193714246983132277926414951878417636536165>

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