Commit: runtime(doc): Improve :help expr-number

Christian Brabandt <[email protected]> Sat, 8 Aug 2026 20:15:04 +0200
Newsgroups gmane.editors.vim.devel
Message-ID <[email protected]>
runtime(doc): Improve :help expr-number

Commit: https://github.com/vim/vim/commit/a33e5da9f55a00fbfaef1ec2476fe0dd0758ac1d
Author: Doug Kearns <[email protected]>
Date:   Sat Aug 8 17:59:27 2026 +0000

    runtime(doc): Improve :help expr-number
    
    closes: https://github.com/vim/vim/issues/20956
    
    Signed-off-by: Doug Kearns <[email protected]>
    Signed-off-by: Christian Brabandt <[email protected]>

diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt
index dffeb3859..222dbcc2a 100644
--- a/runtime/doc/eval.txt
+++ b/runtime/doc/eval.txt
@@ -1,4 +1,4 @@
-*eval.txt*	For Vim version 9.2.  Last change: 2026 May 31
+*eval.txt*	For Vim version 9.2.  Last change: 2026 Aug 08
 
 
 		  VIM REFERENCE MANUAL	  by Bram Moolenaar
@@ -1704,35 +1704,64 @@ number
 number			number constant			*expr-number*
 
 			*0x* *hex-number* *0o* *octal-number* *binary-number*
-Decimal, Hexadecimal (starting with 0x or 0X), Binary (starting with 0b or 0B)
-and Octal (starting with 0, 0o or 0O).
+Integer numbers can be written in multiple forms:
+
+	{N}		decimal
+	0x{N} or 0X{N}	hexadecimal
+	0o{N} or 0O{N}	octal
+	0{N}		octal (decimal in |scriptversion-4| and |Vim9|)
+	0b{N} or 0B{N}	binary
+
+{N} is a sequence of decimal digits (0-9), hexadecimal digits (0-9, a-f and
+A-F), octal digits (0-7) or binary digits (0 or 1).
+
+Note: A leading "-" or "+" is not part of the number, it is the unary operator
+|expr9| applied to it.
 
 Assuming 64 bit numbers are used (see |v:numbersize|) an unsigned number is
 truncated to 0x7fffffffffffffff or 9223372036854775807.  You can use -1 to get
 0xffffffffffffffff.
 
+In |scriptversion-4| and in |Vim9| script, single quotes may appear between digits
+to improve readability; these are ignored.
+
+Examples:
+	0xDEAD
+	57005
+	0b1101111010101101
+	0o157255
+	0xBE'EF			|scriptversion-4| and |Vim9|
+	48'879			|scriptversion-4| and |Vim9|
+	0o137'357		|scriptversion-4| and |Vim9|
+	0b1011'1110'1110'1111	|scriptversion-4| and |Vim9|
+
 						*floating-point-format*
 Floating point numbers can be written in two forms:
 
-	[-+]{N}.{M}
-	[-+]{N}.{M}[eE][-+]{exp}
+	{N}.{M}
+	{N}.{M}[eE][-+]{exp}
 
-{N} and {M} are numbers.  Both {N} and {M} must be present and can only
-contain digits, except that in |Vim9| script in {N} single quotes between
-digits are ignored.
-[-+] means there is an optional plus or minus sign.
+{N} and {M} are sequences of decimal digits.  In |scriptversion-1| (the default)
+{N} and {M} must be present.  In |scriptversion-2| or higher and in |Vim9| script
+{N} is optional.
 {exp} is the exponent, power of 10.
 Only a decimal point is accepted, not a comma.  No matter what the current
 locale is.
 
+In |scriptversion-4| and in |Vim9| script, single quotes may appear between the
+digits in {N} to improve readability; these are ignored.
+
 Examples:
 	123.456
-	+0.0001
+	0.0001
 	55.0
-	-0.123
+	0.123
 	1.234e03
 	1.0E-6
-	-3.1416e+88
+	3.1416e+88
+
+	.123		|scriptversion-2| and |Vim9|
+	123'456.0	|scriptversion-4| and |Vim9|
 
 These are INVALID:
 	3.		empty {M}

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups "vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To view this discussion visit https://groups.google.com/d/msgid/vim_dev/E1wslZY-002KS7-Kb%40256bit.org.