4 ms·
I remember when negative zero was labelled a hoax. (-: * https://en.wikipedia.org/w/index.php?title=-0&diff=25603603&oldid=25529350 https://en.wikipedia.org/w
by JdeBP 8y ago
I remember when negative zero was labelled a hoax. (-:
* https://en.wikipedia.org/w/index.php?title=-0&diff=25603603&oldid=25529350 https://en.wikipedia.org/w/index.php?title=-0&diff=25603603&...
* https://en.wikipedia.org/wiki/Wikipedia:Articles_for_deletion/-0 https://en.wikipedia.org/wiki/Wikipedia:Articles_for_deletio...
- pmarreck 8y agoBest way to represent nil, in my opinion ;) Although it smells like a design flaw (which negabinary conveniently doesn't have)
- pphysch 8y agoAre there common languages where -0 != +0? Or are you implying that this would be a good decision when creating a new language?
- foxhill 8y agobasically every language with IEEE-754[1] compliance..! [1] - https://en.m.wikipedia.org/wiki/IEEE_754 https://en.m.wikipedia.org/wiki/IEEE_754
- saagarjha 8y agoBut only when imposing a total ordering.
- bzbarsky 8y agoI'd think that in all those languages, -0 == +0 tests true, though. In JavaScript even -0 === +0 tests true. The only way to tell them apart in general is to divide by them. In some languages you might be able to type-pun and examine the bit pattern, or do things like Object.is() or whatnot.
- kybernetikos 8y agojavascript: > 1/(-0) -Infinity > 1/0 Infinity > Object.is(0, -0) false Of course = doesn't actually test equality in javascript. == reports -0 as being equal to +0, but Object.is reports them as different.
- earenndil 8y agoSee now, I contest this particular defense because it groups together 'javascript' and 'good decision'.