Post Reply 
Natural logarithm of 2 [HP-15C/HP-42S/Free42 & others]
06-19-2022, 03:46 PM (This post was last modified: 06-19-2022 03:54 PM by C.Ret.)
Post: #36
RE: Natural logarithm of 2 [HP-15C/HP-42S/Free42 & others]
(06-19-2022 02:10 PM)Thomas Klemm Wrote:  This program for the HP-42S uses formula (19):

\(
\begin{align}
\ln 2= \sum_{k=1}^{\infty} \frac{1}{k \cdot 2^k}
\end{align}
\)

Code:
.. HP42S code ...

I have no idea how long it takes on a real HP-42S.

I like the way Thomas get rid of the \( 2^k \) factor by using a factorized division by 2 in his code. This spare several program steps and globally speed up all the process.

So, I immediately convert his program for my HP-15C:
Code:
001 - {    44,25 }    STO I
002 - {        0 }     0
003 - { 42,21, 0 }  f LBL 0
002 - {    45 25 }    RCL I
005 - {       33 }    1/x
006 - {       40 }     +
007 - {        2 }     2
008 - {       10 }     ÷
009 - { 42, 5,25 }  f DSE I
010 - {     22 0 }    GTO 0

The fastest and accurate result obtained with 27 as argument :
f FIX 9 f PRGM 27 R/S display 0.693147181 in least than 23"97.
The f PREFIX reveals digits 6931471805
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: Natural logarithm of 2 [HP-15C/HP-42S/Free42 & others] - C.Ret - 06-19-2022 03:46 PM



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