diff = 1e-16;
args = 0:0.0001:10;

tic
for x = args
    
    suma = 0;
    t = x;
    n = 1;
    z = 1;
    while abs(t) > diff
        t = z*x^n/factorial(n);
        suma = suma + t;
        n = n + 2;
        z = -z;
    end
  
    %suma - sin(x)
end
toc 

tic
for x = args
    
    suma = x;
    t = x;
    n = 2;
    x2 = -x*x;   
    while abs(t) > diff
        t = t*x2/n/(n+1);
        suma = suma + t;
        n = n + 2;
    end
  
    %suma - sin(x)
end
toc 