% Evaluate square root of 8 with a precision of 10^(-9).
n = 10;
s = 3;
for k = 1:n
    p = (-1)^k/factorial(k)*3^(1-2*k);
    for j = 0:(k-1)
        p = p*(1/2-j);
    end
    s = s + p;
end
s