Skip to content

Commit 1217064

Browse files
committed
fix: work around buggy NAN in some MSVC versions
See igraph/igraph#2701
1 parent f60e8d8 commit 1217064

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

src/hzeta.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,18 @@
5151
#include "hzeta.h"
5252
#include "plfit_error.h"
5353

54+
/* Work around bug in some Windows SDK / MSVC versions where NAN is not a
55+
* constant expression, triggering an error in the definition of
56+
* hsl_sf_hzeta_eulermaclaurin_series_coeffs[] and
57+
* hsl_sf_hzeta_eulermaclaurin_series_majorantratios[] below.
58+
* We re-define NAN to the value it had in earlier MSVC versions.
59+
* See https://github.com/igraph/igraph/issues/2701
60+
*/
61+
#ifdef _MSC_VER
62+
#undef NAN
63+
#define NAN (-(float)(((float)(1e+300 * 1e+300)) * 0.0F))
64+
#endif
65+
5466
/* imported from gsl_machine.h */
5567

5668
#define GSL_LOG_DBL_MIN (-7.0839641853226408e+02)

0 commit comments

Comments
 (0)