Page 1 of 1

Calculation Issue

Posted: Tue Feb 14, 2017 7:29 am
by omni
Roger,

This ones got me..

We have a bankrcn program

The bankbal is 12,000
openar is 0
opencks is 150,000
other is 11,000

(other is rare, in this case unrecorded deposits at bank)

store BANKBAL+openar to nettot
store nettot-opencks+vother to nettot2

This calculates to 149,000 (nope, it does not)

The system is adding the other to the open checks negative instead of taking it as a stream of numbers.
Did not try (nettot-opencks)+vother but why would that be necessary??

Changed to below and it calculated properly

store BANKBAL+openar to nettot
store nettot-opencks to nettot3
store nettot3+vother to nettot2

Thanks

Fred
Omni

Re: Calculation Issue

Posted: Tue Feb 14, 2017 8:29 am
by rdonnay
Would you believe that the below equations are equivalent and should give the same answer?

Code: Select all

? 2 + 4 - 5 + 1      // answer 2

? 2 + 4 - (5 + 1)   // answer 0  

Re: Calculation Issue

Posted: Tue Feb 14, 2017 6:44 pm
by RDalzell
I would not...

Order of Operations:

Rule 1: First perform any calculations inside parentheses.
Rule 2: Next perform all multiplications and divisions, working from left to right.
Rule 3: Lastly, perform all additions and subtractions, working from left to right.

Re: Calculation Issue

Posted: Wed Feb 15, 2017 11:39 am
by omni
Roger,

No, i do not. It acts as if there is a paren there, which is just weird to me

12,000-150000+11000=149,000 in the program. Its 125,000.

I had to add the 11000 (var) on the next line separately to calculate properly.

Fred

Re: Calculation Issue

Posted: Wed Feb 15, 2017 12:39 pm
by Cliff Wiernik
12000-150000+11000 = -127000

That is what I get in my calculator and in xdot.

Agree with Richard.

Re: Calculation Issue

Posted: Wed Feb 15, 2017 2:48 pm
by omni
Yes, that was a typo. The issue is the 149,000 it comes up with as if the paren is there.

Re: Calculation Issue

Posted: Wed Feb 15, 2017 4:44 pm
by Cliff Wiernik
How can you get a positive 149000 with a -150000 in the equation. Or did you mean -149000

Re: Calculation Issue

Posted: Thu Feb 16, 2017 12:19 pm
by omni
yes, negative.