Tuesday, November 29, 2011

Re: expression register as calculator with floats?

On Nov 29, 1:35 pm, pauli baadsager <pauli.baadsa...@gmail.com> wrote:
> I often use the expression register to make simple calculations in
> vim. Eg. in insert mode I  type "Ctrl-r = 59 + 38" to get the result
> 97 in my text, but this works fine for integers only.  Is there a way
> to use this feature with digital numbers as well? Like "Ctrl-r = 59.4
> + 37.5" to get the result 96.9 in the text.
>
> Kind regards
> Pauli

Starting at Vim 7.3, this also works with floating-point math. Just be
sure to specify floating point numbers even for any integers involved,
e.g. 59.0 instead of just 59. See :help floating-point-format.

Vim even provides a wide variety of functions for working with these
floating-point numbers. See :help float-functions.

--
You received this message from the "vim_use" 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

No comments:

Post a Comment