Post Reply 
Small RPN exponential routine
01-02-2015, 10:25 PM
Post: #1
Small RPN exponential routine
This would make more sense on the HP-16C, which lacks exponentiation, but the equivalent program is 23 steps long.
I wrote a 42S version as an optimization exercise and managed to save five steps and two registers (but only two bytes), when compared to the first version. Perhaps more optimization is still possible, but I'll stop here.
I'll publish the HP-16C version, in case someone is interested (on the 16C this should be a first step towards a usable exponential function implementation).

Code:

00 { 29-Byte Prgm }
01>LBL "EX"
02 RCL ST Y
03 1
04>LBL 00
05 RCL× ST Z
06 STO+ ST Y
07 X<>Y
08 RCL× ST T
09 X<>Y
10 DSE ST Z
11 GTO 00
12 ÷
13 RCL÷ ST Z
14 .END.

Examples:

1 ENTER 14 XEQ EX --> 2.71828182846

3.14159265359 ENTER 22 --> 23.1406926328

1000 ENTER 1400 --> 1.97007111402e434 ( Free 42 only! )
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
Small RPN exponential routine - Gerson W. Barbosa - 01-02-2015 10:25 PM
RE: Small RPN exponential routine - Namir - 01-21-2015, 12:34 AM
RE: Small RPN exponential routine - Namir - 01-20-2015, 09:24 PM
RE: Small RPN exponential routine - Namir - 01-22-2015, 08:41 AM
RE: Small RPN exponential routine - Namir - 01-23-2015, 05:11 PM



User(s) browsing this thread: