Skip to content

Commit

Permalink
Apprently new VS headers (or other Win .h) drop "#define NAN".
Browse files Browse the repository at this point in the history
This PR defines it when it«s not found (Windows only)
  • Loading branch information
joa-quim committed Nov 20, 2024
1 parent fa3eda0 commit 0428da1
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/gmt_common_math.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,17 @@ extern "C" {
# define int64_abs(x) ((int64_t)(((x) >= 0) ? (x) : -(x)))
#endif

/* Apparently NAN may not be defined anymore in new Visual Studio headers.
See https://github.com/conda-forge/gmt-feedstock/pull/302#issuecomment-2487473474
I found it in, and recopying it here:
"C:\Program Files (x86)\Windows Kits\10\Include\10.0.22000.0\ucrt\corecrt_math.h"
*/
#ifdef _WIN32
# ifndef NAN
# define NAN (-(float)(((float)(1e+300 * 1e+300)) * 0.0F))
# endif
#endif

#ifdef __CYGWIN__ /* See http://gmt.soest.hawaii.edu/boards/1/topics/5428 */
#ifdef __x86_64
#define lrint(x) ((long int)(int)lrint(x))
Expand Down

0 comments on commit 0428da1

Please sign in to comment.