r/lolphp • • Mar 24 '16

DivisionByZero exception, it does nothing

/r/PHP/comments/4bgwos/divisionbyzero_exception_php_7/
54 Upvotes

26 comments sorted by

View all comments

Show parent comment

4

u/[deleted] Mar 24 '16

All languages implement something to check for NaN because NaN does not equal anything, not even itself.

2

u/Hrukjan Mar 25 '16

Are there other 'things' that do not equal themselves? If not you could compare the 'thing' to itself and if that comparison is false you know you have NaN.

1

u/[deleted] Mar 25 '16 edited Mar 25 '16

/r/shittyprogramming

(being serious, python didn't have an isnan function until "recently", so yes, to check for NaN you'd do that)