Post Reply 
HP71B: lets come to speed
10-04-2021, 09:54 PM (This post was last modified: 10-05-2021 12:07 AM by Albert Chan.)
Post: #4
RE: HP71B: lets come to speed
Question 1, Except for arguments of function, variables are global.
This is similar to Awk programming language

Example, for perimeter of ellipse AGM code, updated with all local variables.
(Awk style, with spaces separating arguments from local variables)

Code:
10 DEF FNP(A,B) = FNQ(A,B,A*A+B*B,1,0)
20 DEF FNQ(A,B,   S,T,K)
30 REPEAT @ K=(A-B)/2 @ B=SQRT(A*B) @ A=A-K @ T=T+T @ K=T*K*K @ S=S-K @ UNTIL S=S+K
40 FNQ = S/B*PI @ END DEF

>RUN
>FNP(20,10)
96.8844822058
>FNP(20,5)
85.7842177517
>FNP(20,1)
80.3885123826
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
HP71B: lets come to speed - floppy - 10-04-2021, 03:47 PM
RE: HP71B: lets come to speed - floppy - 10-06-2021, 10:15 AM
RE: HP71B: lets come to speed - floppy - 10-04-2021, 07:57 PM
RE: HP71B: lets come to speed - Albert Chan - 10-04-2021 09:54 PM
RE: HP71B: lets come to speed - floppy - 10-08-2021, 10:43 AM



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