ComparableDecimal
Comparable (Ord) protocol implementation for Decimal type.
Installation
The package can be installed
by adding comparable_decimal
to your list of dependencies in mix.exs
:
def deps do
[
{:comparable_decimal, "~> 0.1"}
]
end
Example
iex(1)> use Comp
Comp
iex(2)> x = Decimal.new("1")
#Decimal<1>
iex(3)> y = Decimal.new("1.0")
#Decimal<1.0>
iex(4)> x == y
false
iex(5)> x <~> y
true