Re:Testing for -0 (negative zero) in JavaScript
by leif on Wednesday February 16, 2011 @10:47PM
(#2229650)
I'm saying Javascript should've thought out its exposed number api a bit better. Either give me the bytes, or give me a number object that does infinite precision behind the scenes for me, don't make me do backflips to figure out whether I'm under/overflowing.
on the other hand, -0 and +0 are a pretty straightforward result of the normal floating point representation, are sometimes useful, and IEEE 754 defines +0==-0. Hiding them under a single 0 would have been more of a hack than having to deal with the difference very very occasionally.