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/Seed7/nth-root.seed7
Normal file
13
Task/Nth-root/Seed7/nth-root.seed7
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
const func float: nthRoot (in integer: n, in float: a) is func
|
||||
result
|
||||
var float: x1 is 0.0;
|
||||
local
|
||||
var float: x0 is 0.0;
|
||||
begin
|
||||
x0 := a;
|
||||
x1 := a / flt(n);
|
||||
while abs(x1 - x0) >= abs(x0 * 1.0E-9) do
|
||||
x0 := x1;
|
||||
x1 := (flt(pred(n)) * x0 + a / x0 ** pred(n)) / flt(n);
|
||||
end while;
|
||||
end func;
|
||||
Loading…
Add table
Add a link
Reference in a new issue