Commit: patch 9.1.2123: using NOT with a float returns a float in legacy script

0 views
Skip to first unread message

Christian Brabandt

unread,
Jan 31, 2026, 5:46:28 AMJan 31
to vim...@googlegroups.com
patch 9.1.2123: using NOT with a float returns a float in legacy script

Commit: https://github.com/vim/vim/commit/ecc3faef61cb02f28028f27184ccd2aadcee7c24
Author: Yegappan Lakshmanan <yega...@yahoo.com>
Date: Sat Jan 31 10:29:01 2026 +0000

patch 9.1.2123: using NOT with a float returns a float in legacy script

Problem: using NOT with a float returns a float in legacy vim script
(kennypete)
Solution: Return a number instead of a float (Yegappan Lakshmanan)

fixes: #19282
closes: #19289

Signed-off-by: Yegappan Lakshmanan <yega...@yahoo.com>
Signed-off-by: Christian Brabandt <c...@256bit.org>

diff --git a/src/eval.c b/src/eval.c
index 71bd35370..488818a4b 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -5417,14 +5417,9 @@ eval9_leader(
}
if (rettv->v_type == VAR_FLOAT)
{
- if (vim9script)
- {
- rettv->v_type = VAR_BOOL;
- val = f == 0.0 ? VVAL_TRUE : VVAL_FALSE;
- type = VAR_BOOL;
- }
- else
- f = !f;
+ rettv->v_type = VAR_BOOL;
+ val = f == 0.0 ? VVAL_TRUE : VVAL_FALSE;
+ type = VAR_BOOL;
}
else
{
diff --git a/src/testdir/test_vimscript.vim b/src/testdir/test_vimscript.vim
index 0be53dc5a..a79c68279 100644
--- a/src/testdir/test_vimscript.vim
+++ b/src/testdir/test_vimscript.vim
@@ -7086,7 +7086,11 @@ func Test_compound_assignment_operators()
call assert_fails('let x %= 0.5', 'E734:')
call assert_fails('let x .= "f"', 'E734:')
let x = !3.14
- call assert_equal(0.0, x)
+ call assert_equal(0, x)
+ call assert_equal(1, !!1.0)
+ let x = !0.0
+ call assert_equal(1, x)
+ call assert_equal(0, !!0.0)

" integer and float operations
let x = 1
diff --git a/src/version.c b/src/version.c
index 78ae26eef..5dc95056b 100644
--- a/src/version.c
+++ b/src/version.c
@@ -734,6 +734,8 @@ static char *(features[]) =

static int included_patches[] =
{ /* Add new patch number below this line */
+/**/
+ 2123,
/**/
2122,
/**/
Reply all
Reply to author
Forward
0 new messages