function y = expeval(x,tol)
% nummath I: Ch. 1, Ex. 1.2
% Evaluation of exponential series
s=1; term=1; k=1; % Initialization
while (abs(term)>tol*abs(min(s,1))) %Termination
  term = term*x/k;
  s = s + term; % Summation
  k = k+1;
end
y = s;