Money.normalize
You're seeing just the function
normalize
, go back to Money module for more information.
Specs
Normalizes the underlying decimal amount in a
given Money.t()
This will normalize the coefficient and exponent of the
decimal amount in a standard way that may aid in
native comparison of %Money.t()
items.
Example
iex> x = %Money{currency: :USD, amount: %Decimal{sign: 1, coef: 42, exp: 0}}
#Money<:USD, 42>
iex> y = %Money{currency: :USD, amount: %Decimal{sign: 1, coef: 4200000000, exp: -8}}
#Money<:USD, 42.00000000>
iex> x == y
false
iex> y = Money.normalize(x)
#Money<:USD, 42>
iex> x == y
true