SoftBank.Cldr.Money.div

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

Specs

div(Money.t(), Cldr.Math.number_or_decimal()) ::
  {:ok, Money.t()} | {:error, {module(), String.t()}}

Divide a Money value by a number.

Arguments

  • money is any valid Money.t types returned by Money.new/2

  • number is an integer, float or Decimal.t

Note that dividing one %:'Elixir.Money'{} by another is not supported.

Returns

  • {:ok, money} or

  • {:error, reason}

Example

iex> SoftBank.Cldr.Money.div Money.new(:USD, 200), 2
{:ok, Money.new(:USD, 100)}

iex> SoftBank.Cldr.Money.div(Money.new(:USD, 200), "xx")
{:error, {ArgumentError, "Cannot divide money by \"xx\""}}