Skip to content

Instantly share code, notes, and snippets.

@ialhashim
Created July 27, 2014 21:10
Show Gist options
  • Save ialhashim/fb4d02dbf476557a3c71 to your computer and use it in GitHub Desktop.
Save ialhashim/fb4d02dbf476557a3c71 to your computer and use it in GitHub Desktop.
Fix Visual Studio Lack of isnan and isfinite (C++)
// Fix Visual Studio
#ifdef WIN32
namespace std{
template<typename T> bool isnan(T x){ return _isnan(x); }
template<typename T> bool isfinite(T arg){
return arg == arg &&
arg != std::numeric_limits<T>::infinity() &&
arg != -std::numeric_limits<T>::infinity();
}
}
#endif
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment