4 ms·
Haha, -0. After spending literal years of my life dealing with that little encoding nuisance, in everything from the V8 TurboFan JIT, to WebAssembly, to adding
by titzer 5y ago
Haha, -0. After spending literal years of my life dealing with that little encoding nuisance, in everything from the V8 TurboFan JIT, to WebAssembly, to adding floating point to Virgil, I just gotta say, that little turd is so not worth it. I've read a lot of different justifications for it (it's a limit, it represents approaching 0 from the negatives, some algorithms need it, etc), I have to admit, I just don't buy it. It's an encoding artifact that's produced so much accidental complexity that, in my book, has been far more trouble than it's been worth.
Change my mind.
- darig 5y ago-mind
- nimish 5y agoHow else would you represent a branch cut or even a jump at 0? https://people.freebsd.org/~das/kahan86branch.pdf https://people.freebsd.org/~das/kahan86branch.pdf from the father of ieee-754 is illuminating.
- croes 5y agoSo for programming convenience we ignore correct math?
- FabHK 5y agoWe cannot represent "correct math" on a computer, because the set of reals is uncountable, but in 64 bits we can only represent finitely many numbers, not infinitely many, let alone uncountably many. And given that we have to implement some sort of approximation to the usual math on a closed subset of the reals (rationals, even), why not extend it with some "numbers" (negative zero, plus/minus infinity, NaNs) that, yes, enable programming convenience?
- croes 5y agoThere is a difference between 2.4987665678 as 2.5 and undefined as ±infinity especially because 1.0/+0.0 is +infinity and 1/0 is just an exception in Java. Shouldn't it be the same result?
- FabHK 5y agoHaha, was just going to link that. Here's an ELI5, though not that illuminating: https://hackernoon.com/negative-zero-bbd5fd790af3 https://hackernoon.com/negative-zero-bbd5fd790af3 But, bottom line, Kahan (not only the father of IEEE 754, but also, with Golub, father of the SVD!) has thought about it a lot, and though he called the signed zero "a pain in the ass", he also said "There really wasn’t a way around that and you were stuck with it." http://history.siam.org/pdfs2/Kahan_final.pdf http://history.siam.org/pdfs2/Kahan_final.pdf
- edflsafoiewq 5y agoI don't really understand. Why is it important that there be two zeros so that 1/ (+0) = +∞ but 1/ (–0) = –∞ but not that there be two, say, 3s so that 1/ (3⁺ – 3) = +∞ but 1/ (3⁻ – 3) = –∞
- pests 5y agoBut we already have two threes: +3 and -3. It's not that it's important there be two, just every number already had 2 except for 0.