stri ker wrote:
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

<mathematian_hat>
When you have to do a series of multiplications and divisions, do the multiplications first to avoid losing precision, unless you can't do them for overflow reasons: (17*1000)/32 or even 17000/32 should give you the result you want. Even in Vim it should give you the integer approximate of the correct result; if you want decimals, add some zeros to the dividend and mentally move the decimal point up by the same number of places in the quotient.
</mathematician_hat>


Best regards,
Tony.

Reply via email to