Skip to content

Instantly share code, notes, and snippets.

@mloskot
Created May 16, 2012 14:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mloskot/2710802 to your computer and use it in GitHub Desktop.
Save mloskot/2710802 to your computer and use it in GitHub Desktop.
/* For NAN */
#ifdef __GNUC__
#define _GNU_SOURCE
#endif
#include <math.h>
@springmeyer
Copy link

any idea how to get access to NAN with visual studio (2010) such that _isnan works with it? Reason I ask is that I'm currently hacking and slashing around with osm2pgsql, trying to get it compiled on windows. I ran into some NAN issues that I've not given much thought to (past getting it to compile): https://github.com/springmeyer/osm2pgsql/commit/a6c3496c8692ad2ff99c52e28cefd3a52eed114e

@mloskot
Copy link
Author

mloskot commented May 16, 2012

Here is the IEEE-compatible way: https://gist.github.com/2711003

In fact, if you look at GCC code of NAN you can see similar NAN trick, but with slightly different pattern.

@springmeyer
Copy link

awesome, thanks!!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment