Therefore; -0.0 + 2.0 = 2.0 and 0.0 + 2.0 = 2.0
>>> 0.0+0.0 0.0 >>> 0.0+(-0.0) 0.0 >>> (-0.0)+0.0 0.0 >>> (-0.0)+(-0.0) -0.0
Hmm? Your examples show -0.0 being additively neutral in every case. +0.0 is the one that behaves weirdly.
The division by 0 in that article gives the same ArithmeticError in each case, notice the 0.0 in both errors:
iex(8)> 1.0 / -0.0 ** (ArithmeticError) bad argument in arithmetic expression: 1.0 / 0.0 :erlang./(1.0, 0.0) iex(8)> 1.0/0.0 ** (ArithmeticError) bad argument in arithmetic expression: 1.0 / 0.0 :erlang./(1.0, 0.0)
iex(10)> Float.round(-0.01, 1) 0.0 iex(11)> Float.round(0.01, 1) 0.0
Therefore; -0.0 + 2.0 = 2.0 and 0.0 + 2.0 = 2.0