diff runtime/doc/eval.txt @ 28964:8973f2f00872 v8.2.5004

patch 8.2.5004: right shift on negative number does not work as documented Commit: https://github.com/vim/vim/commit/338bf58eba758585ffef3fdfdba7d48477aacb7c Author: Bram Moolenaar <Bram@vim.org> Date: Sun May 22 20:16:32 2022 +0100 patch 8.2.5004: right shift on negative number does not work as documented Problem: Right shift on negative number does not work as documented. Solution: Use a uvarnumber_T type cast.
author Bram Moolenaar <Bram@vim.org>
date Sun, 22 May 2022 21:30:02 +0200
parents abdea69d21b6
children f8e9d5023bf6
line wrap: on
line diff
--- a/runtime/doc/eval.txt
+++ b/runtime/doc/eval.txt
@@ -1138,9 +1138,10 @@ expr6 >> expr6	bitwise right shift				*e
 							*E1282* *E1283*
 The "<<" and ">>" operators can be used to perform bitwise left or right shift
 of the left operand by the number of bits specified by the right operand.  The
-operands must be positive numbers.  The topmost bit (sign bit) is always
-cleared for ">>".  If the right operand (shift amount) is more than the
-maximum number of bits in a number (|v:numbersize|) the result is zero.
+operands are used as positive numbers.  When shifting right with ">>" the
+topmost bit (somtimes called the sign bit) is cleared.  If the right operand
+(shift amount) is more than the maximum number of bits in a number
+(|v:numbersize|) the result is zero.
 
 
 expr6 and expr7				*expr6* *expr7* *E1036* *E1051*
@@ -1417,6 +1418,10 @@ number			number constant			*expr-number*
 Decimal, Hexadecimal (starting with 0x or 0X), Binary (starting with 0b or 0B)
 and Octal (starting with 0, 0o or 0O).
 
+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.
+
 						*floating-point-format*
 Floating point numbers can be written in two forms: