tasks a-s
This commit is contained in:
parent
47bf37c096
commit
b83f433714
12433 changed files with 156208 additions and 123 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