Post Reply 
Programming Exercise (HP-15C, 15C LE - and others)
04-05-2014, 01:46 AM (This post was last modified: 04-05-2014 02:43 AM by Gerson W. Barbosa.)
Post: #93
RE: Programming Exercise (HP-15C, 15C LE - and others)
(04-05-2014 01:36 AM)Gerson W. Barbosa Wrote:  
(04-04-2014 11:56 AM)Marcus von Cube Wrote:  To get this running on a 15CLe just add labels A, 0 and 1 in the appropriate places. It returns the same answer but takes 40 seconds instead of 32. Still not bad.

Halfway closer, 36 seconds:

Code:
01 LBL A
02 STO I
03 0
04 LBL 0
05 RCL I
06 DSE I
07 RCL* I
08 1/x
09 +
10 DSE I
11 GTO 0
12 RTN

Gerson.

P.S.: But that's exactly equivalent to Thomas Kemm's WP 34S version a few pages behind:

Code:

LBL A
0
RCL Y
DEC Z
RCL* Z
1/x
+
DSZ Y
BACK 006
END

Too bad the HP-15C lacks a DEC I instruction. This would've saved a second or two.

This takes 36.6 seconds:

Code:

01 LBL A
02 0
03 X<>Y
04 LBL 0
05 ENTER
06 x^2
07 LST x
08 -
09 1/x
10 R^
11 +
12 x<>y
13 2
14 -
15 TEST 0          ; (x!=0?)
16 GTO 0
17 x<>y
18 RTN

P.P.S: A little bit closer, 35.4 seconds:

Code:

01 LBL A
02 2
03 STO 0
04 CL x
05 X<>Y
06 LBL 0
07 ENTER
08 x^2
09 LST x
10 -
11 1/x
12 R^
13 +
14 x<>y
15 RCL- 0
16 TEST 0          ; (x!=0?)
17 GTO 0
18 x<>y
19 RTN
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread



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