Loading ...
Sorry, an error occurred while loading the content.

Re: vim7: limits of values of vim variables?

Expand Messages
  • Bram Moolenaar
    ... It s just that the size of an int is 32 bits, thus the result doesn t fit. On a system where int is 64 bits it should work. I ll add a remark to the help
    Message 1 of 3 , Jan 2, 2006
    • 0 Attachment
      Mikolaj Machowski wrote:

      > After question on comp.editors about power function in Vim I wrote
      > function::
      >
      > function! Power(number, power)
      > if a:power < 0
      > return 0
      > elseif a:power == 0
      > let eval = 1
      > else
      > exe 'let eval = '.repeat(a:number.'*', a:power-1).a:number
      > endif
      > return eval
      > endfunction
      >
      > After calling::
      >
      > echo Power(2,31)
      >
      > And higher values there are some strange results. :help limits mention
      > nothing about that.

      It's just that the size of an int is 32 bits, thus the result doesn't
      fit. On a system where int is 64 bits it should work.

      I'll add a remark to the help on limits. Although it's already
      mentioned at ":help variables".

      --
      hundred-and-one symptoms of being an internet addict:
      2. You kiss your girlfriend's home page.

      /// Bram Moolenaar -- Bram@... -- http://www.Moolenaar.net \\\
      /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
      \\\ download, build and distribute -- http://www.A-A-P.org ///
      \\\ help me help AIDS victims -- http://www.ICCF.nl ///
    Your message has been successfully submitted and would be delivered to recipients shortly.