# include <time.h> /* for time_t */
#endif
-#if defined(FEAT_FLOAT) && defined(HAVE_MATH_H)
-# include <math.h>
+#if defined(FEAT_FLOAT)
+# include <float.h>
+# if defined(HAVE_MATH_H)
+# include <math.h>
+# endif
+# if defined(WIN32) && !defined(isnan)
+# define isnan(x) _isnan(x)
+# endif
#endif
#define DICT_MAXNEST 100 /* maximum nesting of lists and dicts */
#if defined(FEAT_EVAL) || defined(PROTO)
-#if defined(FEAT_FLOAT) && defined(HAVE_MATH_H)
- /* for isnan() and isinf() */
-# include <math.h>
+#if defined(FEAT_FLOAT)
+# include <float.h>
+# if defined(HAVE_MATH_H)
+ /* for isnan() and isinf() */
+# include <math.h>
+# endif
+# if defined(WIN32) && !defined(isnan)
+# define isnan(x) _isnan(x)
+# define isinf(x) (!_finite(x) && !_isnan(x))
+# endif
+# if defined(_MSC_VER) && !defined(INFINITY)
+# define INFINITY (DBL_MAX+DBL_MAX)
+# define NAN (INFINITY-INFINITY)
+# endif
#endif
static int json_encode_item(garray_T *gap, typval_T *val, int copyID, int options);
if (res != NULL)
{
res->v_type = VAR_FLOAT;
- res->vval.v_float = 0.0 / 0.0;
+ res->vval.v_float = NAN;
}
return OK;
}
if (res != NULL)
{
res->v_type = VAR_FLOAT;
- res->vval.v_float = 1.0 / 0.0;
+ res->vval.v_float = INFINITY;
}
return OK;
}