Small RPN exponential routine
01-04-2015, 01:14 AM (This post was last modified: 01-04-2015 02:06 AM by Gerson W. Barbosa.)
Post: #6
 Gerson W. Barbosa Senior Member Posts: 1,429 Joined: Dec 2013
RE: Small RPN exponential routine
(01-03-2015 08:33 PM)Thomas Klemm Wrote:
(01-03-2015 05:31 PM)Gerson W. Barbosa Wrote:  There surely is a more obvious method which I cannot see, so I won't bother optimizing it.

Using the same method but a little shorter:
Code:
00 { 24-Byte Prgm } 01>LBL "LX" 02 1 03 STO- ST Z 04 CLX 05>LBL 00 06 RCL Y 07 1/X 08 X<>Y 09 - 10 RCL× ST Z 11 DSE ST Y 12 GTO 00 13 END

Cheers
Thomas

A "little shorter"? I appreciate your sense of humor :-)

Definitely I should have made a second attempt in the first place. I've rewritten it looking at the expression with five terms of my example and obtained the same number of steps, but four bytes longer. Despite having one extra step inside the loop, yours appears to be a little faster (only one measurement before I got "Memory Clear" due to flat batteries).

Cheers,

Gerson.

ln(0.52) = -(0.48*(1 + 0.48*(1/2 + 0.48*(1/3 + 0.48*(1/4 + 0.48/5)))))

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

P.S.: One step less, but still one byte longer, using one of your ideas:

Code:
 00 { 25-Byte Prgm } 01>LBL "LX" 02 1 03 RCL- ST Z 04 0 05>LBL 00 06 RCL ST Z 07 1/X 08 - 09 RCL× ST Y 10 DSE ST Z 11 GTO 00 12 END
 « Next Oldest | Next Newest »

 Messages In This Thread Small RPN exponential routine - Gerson W. Barbosa - 01-02-2015, 10:25 PM RE: Small RPN exponential routine - Thomas Klemm - 01-03-2015, 08:42 AM RE: Small RPN exponential routine - Gerson W. Barbosa - 01-03-2015, 10:53 AM RE: Small RPN exponential routine - Gerson W. Barbosa - 01-03-2015, 05:31 PM RE: Small RPN exponential routine - Thomas Klemm - 01-03-2015, 08:33 PM RE: Small RPN exponential routine - Gerson W. Barbosa - 01-04-2015 01:14 AM RE: Small RPN exponential routine - James Dunn - 01-20-2015, 07:57 PM RE: Small RPN exponential routine - Gerson W. Barbosa - 01-20-2015, 11:48 PM RE: Small RPN exponential routine - Namir - 01-21-2015, 12:34 AM RE: Small RPN exponential routine - Gerson W. Barbosa - 01-21-2015, 12:46 AM RE: Small RPN exponential routine - Namir - 01-20-2015, 09:24 PM RE: Small RPN exponential routine - Gerson W. Barbosa - 01-21-2015, 04:03 AM RE: Small RPN exponential routine - Thomas Klemm - 01-21-2015, 02:36 AM RE: Small RPN exponential routine - Thomas Klemm - 01-21-2015, 03:18 AM RE: Small RPN exponential routine - Gerson W. Barbosa - 01-21-2015, 03:48 AM RE: Small RPN exponential routine - Namir - 01-22-2015, 08:41 AM RE: Small RPN exponential routine - Gerson W. Barbosa - 01-22-2015, 06:59 PM RE: Small RPN exponential routine - Namir - 01-23-2015, 05:11 PM RE: Small RPN exponential routine - Gerson W. Barbosa - 01-23-2015, 06:48 PM RE: Small RPN exponential routine - Eddie W. Shore - 01-27-2015, 12:56 PM RE: Small RPN exponential routine - Thomas Klemm - 01-27-2015, 08:52 PM RE: Small RPN exponential routine - Albert Chan - 01-30-2019, 07:21 PM

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