Jump to content

Nth root: Difference between revisions

Added Arturo implementation
m (→‎{{header|Phix}}: syntax coloured)
(Added Arturo implementation)
Line 491:
 
</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}}==
1,532

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.