WinBatch® Technical Support Forum

All Things WinBatch => WinBatch => Topic started by: si20596 on July 30, 2013, 01:32:09 AM

Poll
Question: how can i calculate the following line?
Option 1: ??? votes: 1
Option 2: ??? votes: 0
Title: Mathematical Problem
Post by: si20596 on July 30, 2013, 01:32:09 AM
Hello all,

how can i calculate the following line?

tmp = 1234567.12345 + 34567.45678 * 12 + 0.00123 * 12 * 12 + 0.00333 * 12 ^ 3 - 0.0022

Many thanks for your help!
Title: Re: Mathematical Problem
Post by: stanl on July 30, 2013, 06:50:29 AM
Not sure about the grouping, but you can practice by putting the formula into Excel. See attached
Title: Re: Mathematical Problem
Post by: td on July 30, 2013, 07:31:11 AM
First, you need to use the WinBatch Exponentiation operator

Code (winbatch) Select

tmp = 1234567.12345 + 34567.45678 * 12 + 0.00123 * 12 * 12 + 0.00333 * 12 ** 3 - 0.0022


and as Stan mentioned you may need to add parenthesizes to change the operator evaluation order.  It all depends on the purpose of  the expression.