Programming exercise (RPL/RPN) - Reciprocal Fibonacci Constant
02-19-2017, 01:13 AM
Post: #31
 Gerson W. Barbosa Senior Member Posts: 1,611 Joined: Dec 2013
RE: Programming exercise (RPL/RPN) - Reciprocal Fibonacci Constant
(02-17-2017 01:58 PM)Gerson W. Barbosa Wrote:  HP-50g (50 bytes)

« 0. 1. DUP2 5. ROLL

START SWAP OVER + ROT OVER INV + UNROT

NEXT DROP2

»

HP-48G (52.5 bytes)

« 0 1 DUP2 ROT 5 ROLL

START OVER + ROT
OVER INV + SWAP ROT

NEXT DROP2

»

HP-42S

00 { 28-Byte Prgm }
01>LBL "RFC"
02 0
03 0
04 1
05>LBL 00
06 +
07 LASTX
08 1/X
09 STO+ ST Z
10 X<> ST L
11 X<>Y
12 DSE ST T
13 GTO 00
14 RCL ST Z
15 .END.

HP-41

01>LBL 'RFC
02 0
03 0
04 1
05>LBL 00
06 +
07 LASTX
08 1/X
09 STO+ Z
10 X<> L
11 X<>Y
12 DSE T
13 GTO 00
14 RCL Z
15 .END.

A couple more HP 50g programs and another HP-42S RPN program (HP-41 compatible). No improvements here except perhaps for the lesser number of steps in the latter. The second HP 50g program is 2.5 bytes longer, but has one less instruction inside the loop. I think I've tried all possible stack-order combinations, but I can't break the 50-byte barrier (which doesn't mean it's not possible, of course).

HP-50g (50 bytes)

Code:
« 0. 1. DUP2 5. ROLL   START UNROT PICK3 +  DUP UNROT INV + UNROT   NEXT DROP2 »

HP-50g (52.5 bytes)
Code:
 « 0. 1. DUP2 ROT 5.  ROLL   START PICK3 + SWAP  OVER INV + ROT   NEXT ROT DROP2 »

HP-42S ( 28 bytes, excluding END )

Code:
 00 { 28-Byte Prgm } 01>LBL "RFC" 02 0 03 RCL ST X 04 1 05>LBL 00 06 1/X 07 STO+ ST Y 08 X<> ST L 09 STO+ ST Z 10 X<> ST Z 11 DSE ST T 12 GTO 00 13 X<>Y 14 .END.

HP-41 ( 29 bytes, including END )

Code:
 01>LBL "RFC" 02 0 03 RCL X 04 1 05>LBL 00 06 1/X 07 ST+ Y 08 X<> L 09 ST+ Z 10 X<> ST Z 11 DSE T 12 GTO 00 13 X<>Y 14 END
 « Next Oldest | Next Newest »

 Messages In This Thread Programming exercise (RPL/RPN) - Reciprocal Fibonacci Constant - Gerson W. Barbosa - 02-16-2017, 08:29 PM RE: Programming exercise (RPL/RPN) - Reciprocal Fibonacci Constant - Paul Dale - 02-16-2017, 10:24 PM RE: Programming exercise (RPL/RPN) - Reciprocal Fibonacci Constant - Gerson W. Barbosa - 02-16-2017, 11:44 PM RE: Programming exercise (RPL/RPN) - Reciprocal Fibonacci Constant - Ángel Martin - 02-17-2017, 06:44 AM RE: Programming exercise (RPL/RPN) - Reciprocal Fibonacci Constant - Paul Dale - 02-17-2017, 07:09 AM RE: Programming exercise (RPL/RPN) - Reciprocal Fibonacci Constant - Gerson W. Barbosa - 02-17-2017, 02:15 PM RE: Programming exercise (RPL/RPN) - Reciprocal Fibonacci Constant - Werner - 02-20-2017, 08:08 AM RE: Programming exercise (RPL/RPN) - Reciprocal Fibonacci Constant - Didier Lachieze - 02-18-2017, 07:36 AM RE: Programming exercise (RPL/RPN) - Reciprocal Fibonacci Constant - Gerson W. Barbosa - 02-19-2017, 01:21 AM RE: Programming exercise (RPL/RPN) - Reciprocal Fibonacci Constant - Paul Dale - 02-19-2017, 01:44 AM RE: Programming exercise (RPL/RPN) - Reciprocal Fibonacci Constant - Didier Lachieze - 02-19-2017, 10:08 AM RE: Programming exercise (RPL/RPN) - Reciprocal Fibonacci Constant - Paul Dale - 02-17-2017, 07:29 AM RE: Programming exercise (RPL/RPN) - Reciprocal Fibonacci Constant - Gerson W. Barbosa - 02-17-2017, 02:23 PM RE: Programming exercise (RPL/RPN) - Reciprocal Fibonacci Constant - Werner - 02-17-2017, 08:03 AM RE: Programming exercise (RPL/RPN) - Reciprocal Fibonacci Constant - Guenter Schink - 02-17-2017, 11:16 AM RE: Programming exercise (RPL/RPN) - Reciprocal Fibonacci Constant - Gerson W. Barbosa - 02-17-2017, 02:09 PM RE: Programming exercise (RPL/RPN) - Reciprocal Fibonacci Constant - Thomas Okken - 02-17-2017, 10:36 PM RE: Programming exercise (RPL/RPN) - Reciprocal Fibonacci Constant - Gerson W. Barbosa - 02-18-2017, 12:54 AM RE: Programming exercise (RPL/RPN) - Reciprocal Fibonacci Constant - Ángel Martin - 02-18-2017, 08:49 AM RE: Programming exercise (RPL/RPN) - Reciprocal Fibonacci Constant - Gerson W. Barbosa - 02-18-2017, 11:32 AM RE: Programming exercise (RPL/RPN) - Reciprocal Fibonacci Constant - Werner - 02-17-2017, 12:15 PM RE: Programming exercise (RPL/RPN) - Reciprocal Fibonacci Constant - Guenter Schink - 02-17-2017, 01:07 PM RE: Programming exercise (RPL/RPN) - Reciprocal Fibonacci Constant - Gerson W. Barbosa - 02-17-2017, 01:58 PM RE: Programming exercise (RPL/RPN) - Reciprocal Fibonacci Constant - Claudio L. - 02-17-2017, 09:50 PM RE: Programming exercise (RPL/RPN) - Reciprocal Fibonacci Constant - Gerson W. Barbosa - 02-17-2017, 11:54 PM RE: Programming exercise (RPL/RPN) - Reciprocal Fibonacci Constant - Gerson W. Barbosa - 02-19-2017 01:13 AM RE: Programming exercise (RPL/RPN) - Reciprocal Fibonacci Constant - Werner - 02-20-2017, 08:41 AM RE: Programming exercise (RPL/RPN) - Reciprocal Fibonacci Constant - Gerson W. Barbosa - 02-20-2017, 10:34 AM RE: Programming exercise (RPL/RPN) - Reciprocal Fibonacci Constant - Joe Horn - 02-18-2017, 12:53 AM RE: Programming exercise (RPL/RPN) - Reciprocal Fibonacci Constant - Gerson W. Barbosa - 02-18-2017, 01:26 AM RE: Programming exercise (RPL/RPN) - Reciprocal Fibonacci Constant - Paul Dale - 02-18-2017, 03:38 AM RE: Programming exercise (RPL/RPN) - Reciprocal Fibonacci Constant - Claudio L. - 02-18-2017, 04:12 AM RE: Programming exercise (RPL/RPN) - Reciprocal Fibonacci Constant - Paul Dale - 02-18-2017, 05:11 AM RE: Programming exercise (RPL/RPN) - Reciprocal Fibonacci Constant - John Keith - 02-19-2017, 02:27 PM RE: Programming exercise (RPL/RPN) - Reciprocal Fibonacci Constant - Didier Lachieze - 02-18-2017, 07:06 AM RE: Programming exercise (RPL/RPN) - Reciprocal Fibonacci Constant - Ángel Martin - 02-18-2017, 09:22 AM RE: Programming exercise (RPL/RPN) - Reciprocal Fibonacci Constant - Gerson W. Barbosa - 02-18-2017, 11:57 AM RE: Programming exercise (RPL/RPN) - Reciprocal Fibonacci Constant - Gene - 02-18-2017, 03:08 PM RE: Programming exercise (RPL/RPN) - Reciprocal Fibonacci Constant - Ángel Martin - 02-19-2017, 05:04 PM RE: Programming exercise (RPL/RPN) - Reciprocal Fibonacci Constant - Csaba Tizedes - 02-19-2017, 04:04 PM RE: Programming exercise (RPL/RPN) - Reciprocal Fibonacci Constant - Csaba Tizedes - 02-19-2017, 06:12 PM RE: Programming exercise (RPL/RPN) - Reciprocal Fibonacci Constant - Gerson W. Barbosa - 02-19-2017, 07:57 PM RE: Programming exercise (RPL/RPN) - Reciprocal Fibonacci Constant - BartDB - 02-19-2017, 10:25 PM RE: Programming exercise (RPL/RPN) - Reciprocal Fibonacci Constant - Gerson W. Barbosa - 02-20-2017, 12:40 AM RE: Programming exercise (RPL/RPN) - Reciprocal Fibonacci Constant - Werner - 02-20-2017, 10:59 AM RE: Programming exercise (RPL/RPN) - Reciprocal Fibonacci Constant - xerxes - 02-20-2017, 01:57 PM RE: Programming exercise (RPL/RPN) - Reciprocal Fibonacci Constant - Claudio L. - 02-20-2017, 04:41 PM RE: Programming exercise (RPL/RPN) - Reciprocal Fibonacci Constant - Werner - 02-21-2017, 12:33 PM RE: Programming exercise (RPL/RPN) - Reciprocal Fibonacci Constant - Gerson W. Barbosa - 02-23-2017, 09:01 PM RE: Programming exercise (RPL/RPN) - Reciprocal Fibonacci Constant - Gerson W. Barbosa - 02-23-2017, 09:15 PM RE: Programming exercise (RPL/RPN) - Reciprocal Fibonacci Constant - Gerson W. Barbosa - 02-25-2017, 02:49 PM RE: Programming exercise (RPL/RPN) - Reciprocal Fibonacci Constant - Gerald H - 02-25-2017, 03:01 PM RE: Programming exercise (RPL/RPN) - Reciprocal Fibonacci Constant - Gerson W. Barbosa - 02-25-2017, 09:55 PM

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