Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
19
Task/Nth-root/Oz/nth-root.oz
Normal file
19
Task/Nth-root/Oz/nth-root.oz
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
declare
|
||||
fun {NthRoot NInt A}
|
||||
N = {Int.toFloat NInt}
|
||||
|
||||
fun {Next X}
|
||||
( (N-1.0)*X + A / {Pow X N-1.0} ) / N
|
||||
end
|
||||
in
|
||||
{Until Value.'==' Next A/N}
|
||||
end
|
||||
|
||||
fun {Until P F X}
|
||||
case {F X}
|
||||
of NX andthen {P NX X} then X
|
||||
[] NX then {Until P F NX}
|
||||
end
|
||||
end
|
||||
in
|
||||
{Show {NthRoot 2 2.0}}
|
||||
Loading…
Add table
Add a link
Reference in a new issue