HP42S making value comparisons
|
07-13-2020, 10:57 PM
Post: #2
|
|||
|
|||
RE: HP42S making value comparisons
(07-13-2020 08:39 PM)Davidy Wrote: What's the easiest way to compare the x value with a constant during a running calculation without upsetting the stack? You can easily compare to y or to 0 but how about to a stored value? I don't have a 42S at hand but something like this might work: Let's assume that the stored value is in R13 and if the value in the X stack register equals that value then execution should branch to LBL 07. To achieve what you want, do this: RCL- 13 X=0? GTO 07 X<> ST L This leaves the stack as it was before the comparison, except for the LastX register (ST L). If you don't need the value of X after the comparison, omit the X<> ST L step. If you need the value of X (and Y,Z,T) at the LBL 07 destination, put the X<> ST L there as well, like this: LBL 07 X<>ST L This won't work for alpha data, of course. V. All My Articles & other Materials here: Valentin Albillo's HP Collection |
|||
« Next Oldest | Next Newest »
|
Messages In This Thread |
HP42S making value comparisons - Davidy - 07-13-2020, 08:39 PM
RE: HP42S making value comparisons - Valentin Albillo - 07-13-2020 10:57 PM
RE: HP42S making value comparisons - ijabbott - 07-14-2020, 08:19 AM
|
User(s) browsing this thread: 1 Guest(s)