Calculation Issue

This forum is for eXpress++ general support.
Post Reply
Message
Author
omni
Posts: 540
Joined: Thu Jan 28, 2010 9:34 am

Calculation Issue

#1 Post 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

User avatar
rdonnay
Site Admin
Posts: 4745
Joined: Wed Jan 27, 2010 6:58 pm
Location: Boise, Idaho USA
Contact:

Re: Calculation Issue

#2 Post 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  
The eXpress train is coming - and it has more cars.

User avatar
RDalzell
Posts: 205
Joined: Thu Jan 28, 2010 6:57 am
Location: Alsip, Illinois USA

Re: Calculation Issue

#3 Post 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.

omni
Posts: 540
Joined: Thu Jan 28, 2010 9:34 am

Re: Calculation Issue

#4 Post 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

Cliff Wiernik
Posts: 605
Joined: Thu Jan 28, 2010 9:11 pm
Location: Steven Point, Wisconsin USA
Contact:

Re: Calculation Issue

#5 Post by Cliff Wiernik »

12000-150000+11000 = -127000

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

Agree with Richard.

omni
Posts: 540
Joined: Thu Jan 28, 2010 9:34 am

Re: Calculation Issue

#6 Post by omni »

Yes, that was a typo. The issue is the 149,000 it comes up with as if the paren is there.

Cliff Wiernik
Posts: 605
Joined: Thu Jan 28, 2010 9:11 pm
Location: Steven Point, Wisconsin USA
Contact:

Re: Calculation Issue

#7 Post by Cliff Wiernik »

How can you get a positive 149000 with a -150000 in the equation. Or did you mean -149000

omni
Posts: 540
Joined: Thu Jan 28, 2010 9:34 am

Re: Calculation Issue

#8 Post by omni »

yes, negative.

Post Reply