Post Reply 
HP 15C conditional does not behave as expected
05-07-2021, 06:45 PM (This post was last modified: 05-07-2021 08:13 PM by Siegfried.)
Post: #5
RE: HP 15C conditional does not behave as expected
I think you got the loop label wrong which is .0 (corresponding to the GTO .0 at the end) which you have listed as
Code:
42 21 0

May I ask what your result is on program termination? I get the 894.xxx but that's wrong as the comparison should result in a few more loops and end up around 994.

I get the same result on a real HP-15C and nonpareil-15c.

I also tried this on a HP-41CX and get the same behaviour.

I have added an R/S to check the stack before the conditional test and have verified X=894.5956 and Y=1. So when Testing X>Y? the result is TRUE and either calculator should continue on the line after the conditional test (that is the GTO .0 instruction) but it stops on the R/S one line further.

(05-07-2021 04:22 PM)Gene Wrote:  Works fine for me as you have written it out on a 15c emulator. Don't have the physical unit with me at the moment.

Key codes to check:

Code:
42 21 11
44 1
48
0
0
1
9
8
1
2
44 0
2
8
8
48
1
5
44.0
43 35
42 21 0
36
1
40
34
45 40 1
45 20 0
45 3
[b]45 20 0[/b]
45 40 .0
10
1
40
43 12
45 2
16
45 10 0
20
31
43 30 7
22 .0
31
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: HP 15C conditional does not behave as expected - Siegfried - 05-07-2021 06:45 PM



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