LOG for HP 12C
08-30-2017, 01:47 AM
Post: #1
 Gamo Senior Member Posts: 713 Joined: Dec 2016
LOG for HP 12C
Here is a LOG program for HP 12C

Find the LOG in any base of any number: LOGь X: X > 0, b > 1

01 LN
02 R↓
03 LN
04 R↓
05 R↓
06 R↓
07 ÷
08 GTO 00

Example:
LOG₃ 9 = 2 9 ENTER 3 R/S 2
LOG₈₁ 3 = ⅟₄ 3 ENTER 81 R/S 0.25
LOG₁₀₀₀ 10 = ⅓ 10 ENTER 1000 R/S 0.33

Gamo
08-30-2017, 02:07 AM (This post was last modified: 08-30-2017 02:13 AM by Gerson W. Barbosa.)
Post: #2
 Gerson W. Barbosa Senior Member Posts: 1,487 Joined: Dec 2013
RE: LOG for HP 12C
Here is my version. Not exactly faster, better or more accurate, only three steps shorter:

01 LN
02 1/x
03 y^x
04 LN
05 GTO 00

Best regards,

Gerson.

--------

PS:

Or, in a more conventional way, but one step longer:

01 LN
02 x<>y
03 LN
04 /
05 1/x
06 GTO 00
08-30-2017, 02:07 AM (This post was last modified: 08-30-2017 02:09 AM by Gene.)
Post: #3
 Gene Moderator Posts: 1,293 Joined: Dec 2013
RE: LOG for HP 12C
EDIT: Rats, Gerson was faster and shorter. :-) Is either method more accurate?

Good idea!

LN
X<>Y
LN
X<>Y
/
GTO 00
08-30-2017, 02:20 AM
Post: #4
 Gerson W. Barbosa Senior Member Posts: 1,487 Joined: Dec 2013
RE: LOG for HP 12C
(08-30-2017 02:07 AM)Gene Wrote:  How about:

LN
X<>Y
LN
X<>Y
/
GTO 00

Better than my 6-step version above (register swap is faster than 1/x). Faster than the 5-step one too!

Gerson.
08-30-2017, 04:22 AM
Post: #5
 Gamo Senior Member Posts: 713 Joined: Dec 2016
RE: LOG for HP 12C
Thanks for more alternative ways of LOG program.

Just wondering about the compute functions like 1/x or y^x will take more time to calculate than just using Rv or X<>Y

Gamo
08-30-2017, 02:42 PM
Post: #6
 Gerson W. Barbosa Senior Member Posts: 1,487 Joined: Dec 2013
RE: LOG for HP 12C
(08-30-2017 04:22 AM)Gamo Wrote:  Just wondering about the compute functions like 1/x or y^x will take more time to calculate than just using Rv or X<>Y

Rv and x<>y are simple operations involving transfer of contents between internal registers. y^x alone requires a call to LN and another to e^x, both transcendental functions that take a lot a shift and add operations plus access to external tables in ROM. On slow calculators like the original HP-12C the difference in speed is quite noticeable, even without a stopwatch.
The choice of which solution to use depends on what amount of free memory you have. The five-step version would make sense if those were the last remaining free steps on you 12C.

Gerson.
 « Next Oldest | Next Newest »

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