Thanks, this does work for addition and subtraction. The problem I run into is when I try to divide and return a decimal.
For example:
!echo '(17/32)*1000' | bc #returns 0; The problem is that the scale variable in bc must be set to a number other than zero in order to display the calculation correctly.

I have figured out that I can use !bc or !python and when I exit the external program, return to the buffer. For now this works okay. I'm just always lookin' for a better/simpler way.

Thanks for all the suggestions!
Kevin


On Jun 4, 2006, at 12:48 AM, Yakov Lerner wrote:

On 6/4/06, stri ker <[EMAIL PROTECTED]> wrote:
I frequently need to do some basic calculations.  I have used the
following within Vim for Integer calculations:

:echo (4+7)*3-14
19

My question is this:
Is there a way to do calculations with doubles instead of integers
without piping to an external program like bc and then inserting into
a buffer?
:r!echo '491.41 - 29.74' | bc

I understand that you want to see the result, not
insert it into the buffer. How about this:

   :!echo '491.41 - 29.74' | bc

Yakov


Reply via email to