]> granicus.if.org Git - vim/commitdiff
patch 7.4.1408 v7.4.1408
authorBram Moolenaar <Bram@vim.org>
Tue, 23 Feb 2016 21:07:32 +0000 (22:07 +0100)
committerBram Moolenaar <Bram@vim.org>
Tue, 23 Feb 2016 21:07:32 +0000 (22:07 +0100)
Problem:    MS-Windows doesn't have isnan() and isinf().
Solution:   Use _isnan() and _isinf().

src/eval.c
src/json.c
src/version.c

index cf908d1d5c444cb2edbb03013fa1f7b5a7074648..b04b6c2825a9510728cdbeeff7682b4ac2bce80f 100644 (file)
 # 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 */
index 6eadd2e83e17acfb8ed04618210dc6308c829b87..1a3dea1e5bbf330a75d3391d4528ce1d410736fa 100644 (file)
 
 #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);
@@ -745,7 +756,7 @@ json_decode_item(js_read_T *reader, typval_T *res, 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;
            }
@@ -755,7 +766,7 @@ json_decode_item(js_read_T *reader, typval_T *res, int options)
                if (res != NULL)
                {
                    res->v_type = VAR_FLOAT;
-                   res->vval.v_float = 1.0 / 0.0;
+                   res->vval.v_float = INFINITY;
                }
                return OK;
            }
index 8d858d10512540811f76411c32cb97d1f4114af8..927e0b2f34b98405dabf51c9c3c588f9f593841b 100644 (file)
@@ -748,6 +748,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    1408,
 /**/
     1407,
 /**/