3 ms·
Not quite neutral. You return -0.0 only when needed. >>> 0.0+0.0 0.0 >>> 0.0+(-0.0) 0.0 >>> (-0.0)+0.0 0.0 >>> (-0.0)+(-0.0) -0.0
by worc3131 6y ago
Not quite neutral. You return -0.0 only when needed.
>>> 0.0+0.0
0.0
>>> 0.0+(-0.0)
0.0
>>> (-0.0)+0.0
0.0
>>> (-0.0)+(-0.0)
-0.0
- thaumasiotes 6y ago> Not quite neutral. Hmm? Your examples show -0.0 being additively neutral in every case. +0.0 is the one that behaves weirdly.
- shultays 6y agoheh, looks like abs(-0.0) is slightly less than abs(+0.0)!