2 ms·
I think you're right that they're indistinguishable, in that -0.0 == 0.0 The division by 0 in that article gives the same ArithmeticError in each case, notice
by mcintyre1994 6y ago
I think you're right that they're indistinguishable, in that -0.0 == 0.0
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)
It's also ignored when rounding:
iex(10)> Float.round(-0.01, 1)
0.0
iex(11)> Float.round(0.01, 1)
0.0