fix infinity check so that Closure Compiler does not choke on it
Merge pull request #465 from atis--/master

Prevent Closure Compiler dying on divide by zero