aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/eval/executor.c
diff options
context:
space:
mode:
authorJan Edmund Lazo <jan.lazo@mail.utoronto.ca>2019-07-28 16:54:06 -0400
committerJan Edmund Lazo <jan.lazo@mail.utoronto.ca>2019-07-28 17:19:20 -0400
commitb457a58e34d43d49a01dd93ec356099d232bd713 (patch)
tree189bc85b983d299b256504ff84aa475ef0eec41f /src/nvim/eval/executor.c
parent98d389ce55f2436148ff3b2faed7fa0d4ab712af (diff)
downloadrneovim-b457a58e34d43d49a01dd93ec356099d232bd713.tar.gz
rneovim-b457a58e34d43d49a01dd93ec356099d232bd713.tar.bz2
rneovim-b457a58e34d43d49a01dd93ec356099d232bd713.zip
vim-patch:8.1.0990: floating point exception with "%= 0" and "/= 0"
Problem: Floating point exception with "%= 0" and "/= 0". Solution: Avoid dividing by zero. (Dominique Pelle, closes vim/vim#4058) https://github.com/vim/vim/commit/e21c1580b7acb598a6e3c38565434fe5d0e2ad7a
Diffstat (limited to 'src/nvim/eval/executor.c')
-rw-r--r--src/nvim/eval/executor.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/nvim/eval/executor.c b/src/nvim/eval/executor.c
index e972c506dd..8cd21f8d62 100644
--- a/src/nvim/eval/executor.c
+++ b/src/nvim/eval/executor.c
@@ -74,8 +74,8 @@ int eexe_mod_op(typval_T *const tv1, const typval_T *const tv2,
case '+': n += tv_get_number(tv2); break;
case '-': n -= tv_get_number(tv2); break;
case '*': n *= tv_get_number(tv2); break;
- case '/': n /= tv_get_number(tv2); break;
- case '%': n %= tv_get_number(tv2); break;
+ case '/': n = num_divide(n, tv_get_number(tv2)); break;
+ case '%': n = num_modulus(n, tv_get_number(tv2)); break;
}
tv_clear(tv1);
tv1->v_type = VAR_NUMBER;