function s = newSin(x)

x = x - 2*pi * round(x / (2*pi));  % This normalizes x to lie in (-pi, pi)
s = 0; sgn = 1; 

for n=1:2:999    % Step-size is two, so we loop over odd "n" only
    an = x^n / factorial(n);
    s = s + sgn * an;
    sgn = -sgn;
    
    if ( abs(an) < 1e-16 ) 
        return;
    elseif ( abs(an) == Inf || isnan(an) ) 
        fprintf('Term #%d is too large: terminating\n', fix(n/2));
        return;
    end
    
end
        