I came across the goog.math.isFiniteNumber
function in the Google Closure Library. What it does is checking whether a given number is both finite and not NaN<
Probably for the same reason that I have implemented (isfinite(num) && isfinite(-num))
- I was getting errors from mysql complaining about putting "-nan" into the database even though I had a check for isfinite(field)
...
A useful article on this subject is http://jacksondunstan.com/articles/983 which provides an optimization ((d*0.0)==0.0)