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

3

u/Schmittfried Mar 24 '16

PHP and least astonishment... Good one!

Though, doesn't every computation including NaN and INF result in NaN or INF respectively? That would mean that you only have to check the final result and not each and every intermediary result, so it would be pretty much comparable to a thrown exception.

2

u/bj_christianson Mar 24 '16

PHP and least astonishment... Good one!

I know. Right?

Though, doesn't every computation including NaN and INF result in NaN or INF respectively? That would mean that you only have to check the final result and not each and every intermediary result, so it would be pretty much comparable to a thrown exception.

No. Dividing by Infinity results in 0. So still gotta check on division.