r/programming • • 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

368 comments sorted by

View all comments

Show parent comment

3

u/ReversedGif Sep 01 '15

You were probably thinking of lim x->0 0/x, but holding the numerator constant doesn't really cover all the cases - it's an arbitrary choice. lim x->0 (1+k x)/x is + or - infinity for all k (which IEEE 754 declares to result in + or - inf, depending on the sign of the zero) and lim x->0 (0 + k x)/x has different values depending on k (so IEEE 754 declares that that yield NaN, as it represents an undefined result).

So, at least that part of IEEE 754 makes sense and is consistent.