Slightly simpler:
function main(nb)
S1 = 0.0
S2 = 1.0
k = 0
eps = 0.1^(nb+1)
while abs(S1-S2) >= eps
S2 = S1
S1 += 4 * ((-1)^k)/(2k + 1)
k += 1
end
println("Value of pi calculated with Madhava formula : ", S2)
println("Number of iterations : ", k)
println("π = ", BigFloat(pi))
println("error = ", abs(S2-π))
end