updated for version 7.3.1159
Problem: The round() function is not always available. (Christ van
Willegen)
Solution: Use the solution from f_round().
diff --git a/src/eval.c b/src/eval.c
index 7250556..38893c7 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -15774,6 +15774,17 @@
}
#ifdef FEAT_FLOAT
+
+/*
+ * round() is not in C90, use ceil() or floor() instead.
+ */
+ float_T
+vim_round(f)
+ float_T f;
+{
+ return f > 0 ? floor(f + 0.5) : ceil(f - 0.5);
+}
+
/*
* "round({float})" function
*/
@@ -15786,8 +15797,7 @@
rettv->v_type = VAR_FLOAT;
if (get_float_arg(argvars, &f) == OK)
- /* round() is not in C90, use ceil() or floor() instead. */
- rettv->vval.v_float = f > 0 ? floor(f + 0.5) : ceil(f - 0.5);
+ rettv->vval.v_float = vim_round(f);
else
rettv->vval.v_float = 0.0;
}