Linux: fixed compilation errors in Ubuntu 14.04

Fix for issue #317 by removing references to std::isnan and std::isinf and instead using direct from the <cmath> header.
It compiles OK on both Ubuntu 13 and 14.
As this change affects the MacOS build, someone will want to check this patch doesn't break it.