% using Taylor series to compute exp(x):
% bad results for large negative x (subtraction cancellation)
for x=30:-3:-30
    s=1;i=1;a=1;
    while(s+a*x/i ~=s)
        a=a*x/i; s=s+a;i=i+1;
    end
    fprintf('%4i    %16.10e     %16.10e   %7i\n',x,s,exp(x),i)
end