Use finite math.

- Fixes issue with gcc 4.9.0.
- std::numeric_limit<float>::infinity is non-finite.
Merge pull request #2290 from ktf/use-finite-math

gcc490 -- Use finite math.