tc39/proposal-math-sum

Empty list sums to 0 or -0?

Closed this issue · 2 comments

-0 is in some sense more correct, at least if you're thinking about floats: -0 is the additive identity for floats. On the other hand, this is supposed to be approximating real-number arithmetic as closely as possible, and reals do not have -0.

As a datapoint, in Python fsum([]) gives 0, not -0.

I prefer -0.

-0 it is.