In [12]:
function pi_sum(n)
sum = 0
for k = 1:n
sum += 1.0/(k*k)
end
return sum
end
Out[12]:
In [15]:
# The first time you run it for a given argument type, the function is compiled
pi_sum(1000000)
Out[15]:
In [9]:
# show native machine code...
# (about the same thing you'd get if you compiled C code)
code_native(pi_sum, (Int32,))