[not sure if this got through, ignore if you already have seen it]
Marvin Renich wrote: > * Bram Moolenaar <[email protected]> [230304 15:47]: > > > > > ### Steps to reproduce > > > > > > Create a buffer with the number `18446744073709551616`. > > > Press `Ctrl-x` with the cursor on the number. > > > Number is changed to `18446744073709551614`. > > > > > > ### Expected behaviour > > > > > > Number is changed to `18446744073709551615` > > > > The problem is that 2 ** 64 does not fit in the variable being used. > > Getting the number from the text results in the maximum number that can > > be represented, which is 18446744073709551615. Then one is subtracted. > > > > I think the best we can do is keep a flag for the "overflow" and then > > not subtract one. That makes this corner case work, although it won't > > be fixed in the general case. Still better than doing nothing. > > I don't think this is the right fix. I think you should either document > that 64-bit arithmetic is being used, and load the original number as 0 > (the correct modulo-64 representation) and decrement gives -1 and > increment gives 1, or decide to use arbitrary-precision arithmetic and > give the correct answer for numbers larger than 2^64. > > Either of these two approaches give consistent results for numbers > larger than 2^64-1, whereas the fix you suggest only makes one > 'out-of-bounds' value work. I would prefer the current behavior to > applying the fix you are suggesting. > > I would be willing to write the arbitrary-precision code so that no > external library need be used, but I might not get to it right away. Interpreting a large number as zero is a terrible solution. I don't see how this can ever do what the user wants. Using arbitrary precision can work, but it would require a lot of changes in the code. Currently CTRL-A and CTRL-X use functions common to other commands, it would have to be split and quite a bit of code needs to be duplicated. Including handling of hex and octal numbers. I doubt this is used often enough to justify the work. -- A computer without Windows is like a fish without a bicycle. /// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net \\\ /// \\\ \\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ /// \\\ help me help AIDS victims -- http://ICCF-Holland.org /// -- -- 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 on the web visit https://groups.google.com/d/msgid/vim_dev/20230307155658.8B0781C0354%40moolenaar.net.
