Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 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