Fix NaN test

As [reported by](https://github.com/openlayers/ol3/commit/fcc079a5f2d67b30eee02d744be093b446b44aec#commitcomment-3169054) @ahocevar.