0
0
mirror of https://github.com/vim/vim.git synced 2025-09-26 04:04:07 -04:00

updated for version 7.3.1159

Problem:    The round() function is not always available. (Christ van
            Willegen)
Solution:   Use the solution from f_round().
This commit is contained in:
Bram Moolenaar
2013-06-10 20:10:44 +02:00
parent 0bdda37fb4
commit a2e14fc764
4 changed files with 19 additions and 6 deletions

View File

@@ -15774,6 +15774,17 @@ theend:
}
#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 @@ f_round(argvars, rettv)
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;
}