tasks a-s
This commit is contained in:
parent
47bf37c096
commit
b83f433714
12433 changed files with 156208 additions and 123 deletions
11
Task/Nth-root/PHP/nth-root.php
Normal file
11
Task/Nth-root/PHP/nth-root.php
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
function nthroot($number, $root, $p = P)
|
||||
{
|
||||
$x[0] = $number;
|
||||
$x[1] = $number/$root;
|
||||
while(abs($x[1]-$x[0]) > $p)
|
||||
{
|
||||
$x[0] = $x[1];
|
||||
$x[1] = (($root-1)*$x[1] + $number/pow($x[1], $root-1))/$root;
|
||||
}
|
||||
return $x[1];
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue