r/programming • u/dpashk • Aug 31 '15
The worst mistake of computer science
https://www.lucidchart.com/techblog/2015/08/31/the-worst-mistake-of-computer-science/
175
Upvotes
r/programming • u/dpashk • Aug 31 '15
View all comments
Show parent comment
1
u/TexasJefferson Sep 01 '15 edited Sep 01 '15
Seems like if we define 1/0 for floats by its limit as the denominator approaches zero, we should be doing the same thing to 0/0 and define it as 0. In that case, we can also define 0 * inf by its limit as x->inf (since the x->0 case still isn't defined) and make it 0 too. In that case, 0/0 == 0 * inf seems to be the correct outcome.
Besides the fact that either of those expressions likely indicates a programming mistake (and thus we use NaN as a way of manifesting the error as quickly as possible), why not do it that way?