View Single Post
Old 5th Jul 2021, 7:50 pm   #13
Slothie
Octode
 
Join Date: Apr 2018
Location: Newbury, Berkshire, UK.
Posts: 1,287
Default Re: Karen's PICL - PCB available

Here's a program to calculate 'e' (the base of natural logarithms) to arbitrary numbers of significant digits (set by the variable N in line 100).
Code:
100N=20:X=TOP:Y=TOP+N
110FORI=0TON-1:@(X+I)=0:@(Y+I)=0:NEXTI
120@Y=1:D=1:DO
130 U=0
131FORI=N-1TO0STEP-1
132U=U+@(X+I)+@(Y+I)
133@(X+I)=MOD(U,10)
134U=U/10
135NEXTI
140PR@X,".";:FORI=1TON-1:PR@(X+I);:NEXTI:PR""
150U=0:V=0
160FORI=0TON-1:U=U*10+@(Y+I):@(Y+I)=U/D:U=MOD(U,D):V=V+@(Y+I):NEXTI
170IFU>D/2@(Y+N-1)=@(Y+N-1)+1
180D=D+1:UNTILV=0
I modified this from the version on the page https://www.quinapalus.com/psb.html which shows a LPC811 version based on the PICL.
Slothie is offline