New guy and programming problem

08282017, 02:20 PM
Post: #22




RE: New guy and programming problem
So for completeness' sake, I'll add the response I left to you when you asked this question on my 42s programming video.
Sure, so what's happening is that if you enter a new value for R1 or R2 the stack is lifting and the old value is now in the Y portion of the stack, so ultimately your program is calculating the old R2 + 1/(new R2) and then 1/x. A couple of solutions: the most straightforward is probably to store the intermediate value, so after the first 1/X, STO 00 and then after the second 1/X, RCL 00. Or, perhaps a better practice is to create the variables first, then perform the operations: Code: LABEL "PAR2" Lastly, if you wanted to be really streamlined, you could do away with INPUT altogether and just enter your values into the stack before executing the program Code: LABEL "PAR2" 

« Next Oldest  Next Newest »

User(s) browsing this thread: 1 Guest(s)