News for hackers. Stuff that matters.
Re:1/0 = 0 by madrox on Friday August 10, 2018 @06:04PM (#17737061)
You're absolutely right. Not only that, but it's impossible to distinguish a bad result like 1/0 vs a good result like 0/1.

Even Javascript is better with "NaN"

Re:1/0 = 0 by jwilk on Friday August 10, 2018 @06:15PM (#17737101)
To clarify, in Javascript 1/0 is Infinity, not NaN.
Re:1/0 = 0 by eggnet on Friday August 10, 2018 @06:48PM (#17737244)
You are correct. But it really should be NaN, since 1/ε is positive infinity, whereas 1/-ε is negative infinity.

Oh well :)

Re:1/0 = 0 by Jach on Friday August 10, 2018 @06:58PM (#17737300)
JS just assumes the limit direction for you, so 1/0 is Infinity, but -1/0 is -Infinity. 0/0 at least is correctly NaN. (Edit: And I just verified against my memory, Matlab (or at least Octave) does the same thing. While Matlab might get characterized as being for the ivory tower, at least it's had a long history of being used for practical math applications within the tower. Edit2: And anyway this is the defined behavior for IEEE floats. Men of industry use industrial standards. :))
Re:1/0 = 0 by lightgreen on Saturday August 11, 2018 @01:01AM (#17738431)
Moreover, 1/-0 is -Infinity. IEEE float has two zeros, positive and negative.
Re:1/0 = 0 by mehrdadn on Friday August 10, 2018 @07:25PM (#17737404)
Nope, I'd disagree. Zero isn't an approximation of some epsilon, it's really just zero. It makes sense for the output sign to match the input sign.
Re:1/0 = 0 by gowld on Saturday August 11, 2018 @01:21AM (#17738484)
What is the sign of 0?

It's 0.

Re:1/0 = 0 by dahart on Saturday August 11, 2018 @04:09AM (#17738851)
Parent was talking about the sign of the numerator. But... zero in IEEE 754 representation has a meaningful sign bit. 1/-0 = -inf.
Re:1/0 = 0 by GlitchMr on Saturday August 11, 2018 @06:45AM (#17739172)
Or as IEEE 754 sees it (you can try this in your JavaScript REPL).

  >> 1 / 0
  Infinity
  >> 1 / -0
  -Infinity
Re:1/0 = 0 by lightgreen on Saturday August 11, 2018 @01:03AM (#17738442)
e is nearly 0, -e is nearly -0.

So 1/0 is infinity, and 1/-0 is -infinity.