ericmj / decimal

Arbitrary precision decimal arithmetic

Home Page:https://hexdocs.pm/decimal/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Fix Decimal.reduce/2 for zeroes

IcyEagle opened this issue · comments

The next assertion fails:

negative_zero = %Decimal{coef: 0, exp: 0, sign: -1}
positive_zero = %Decimal{coef: 0, exp: 0, sign: 1}
assert Decimal.reduce(negative_zero) == Decimal.reduce(positive_zero)

I believe there should be a special case for "negative zero" to reduce it to its positive brother.

PR provided.

PR is not approved.