Nth root: Difference between revisions

Content added Content deleted
m (→‎{{header|Phix}}: syntax coloured)
(Added Arturo implementation)
Line 491: Line 491:


</lang>
</lang>

=={{header|Arturo}}==
{{trans|Nim}}
<lang rebol>nthRoot: function [a,n][
N: to :floating n
result: a
x: a / N
while [0.000000000000001 < abs result-x][
x: result
result: (1//n) * add (n-1)*x a/pow x n-1
]
return result
]

print nthRoot 34.0 5
print nthRoot 42.0 10
print nthRoot 5.0 2</lang>

{{out}}

<pre>2.024397458499885
1.453198460282268
2.23606797749979</pre>


=={{header|AutoHotkey}}==
=={{header|AutoHotkey}}==