Anonymous user
Nth root: Difference between revisions
Updated to work with Nim 1.4: added missing parameter types. Replaced 10e-15 which is 10*10^(-15) with 1e-15 which is 10^(-15). Updated result.
(added Rust programming solution) |
(Updated to work with Nim 1.4: added missing parameter types. Replaced 10e-15 which is 10*10^(-15) with 1e-15 which is 10^(-15). Updated result.) |
||
Line 2,107:
<lang nim>import math
proc
var n = float(n)
result = a
var x = a / n
while abs(result-x) >
x = result
result = (1
echo
echo
echo
Output:
<pre>2.
1.453198460282268
2.
=={{header|Objeck}}==
|