Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
13
Task/Nth-root/PL-I/nth-root.pli
Normal file
13
Task/Nth-root/PL-I/nth-root.pli
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
/* Finds the N-th root of the number A */
|
||||
root: procedure (A, N) returns (float);
|
||||
declare A float, N fixed binary;
|
||||
declare (xi, xip1) float;
|
||||
|
||||
xi = 1; /* An initial guess */
|
||||
do forever;
|
||||
xip1 = ((n-1)*xi + A/xi**(n-1) ) / n;
|
||||
if abs(xip1-xi) < 1e-5 then leave;
|
||||
xi = xip1;
|
||||
end;
|
||||
return (xi);
|
||||
end root;
|
||||
Loading…
Add table
Add a link
Reference in a new issue