Fix bug in Debug Mode

std::isnan behaves weirdly when -ffast-math is not set