Decimal.negate(0) should return #Decimal<0> rather than #Decimal<-0>
agrits opened this issue · comments
Artur Kasza commented
Like in the title:
iex> Decimal.negate(0)
#Decimal<-0>
Wojtek Mach commented
Is this behaviour specified anywhere, e.g. IEEE 754/854?
Artur Kasza commented
It specifies two signed zeros in existence.
Then, I guess this is also correct:
iex> Decimal.to_string(Decimal.negate(0))
"-0"
and the issue is not needed.
Eric Meadows-Jönsson commented
Treating the integer 0
as decimal +0
makes sense to me and then it follows that Decimal.negate(+0) => -0
.
If you see it differently please elaborate on why.
Eric Meadows-Jönsson commented
It specifies two signed zeros in existence.
Yes, that exists in IEEE 754.