Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
11
Task/Nth-root/Zkl/nth-root.zkl
Normal file
11
Task/Nth-root/Zkl/nth-root.zkl
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
fcn nthroot(nth,a,precision=1.0e-5){
|
||||
x:=prev:=a=a.toFloat(); n1:=nth-1;
|
||||
do{
|
||||
prev=x;
|
||||
x=( prev*n1 + a/prev.pow(n1) ) / nth;
|
||||
}
|
||||
while( not prev.closeTo(x,precision) );
|
||||
x
|
||||
}
|
||||
|
||||
nthroot(5,34) : "%.20f".fmt(_).println() # => 2.02439745849988828041
|
||||
Loading…
Add table
Add a link
Reference in a new issue