Fixed usage of C++11 std::isnan.