
errs  = [];
bumps = [];

figure(1);

for bump = 10.^linspace(-16,0,20)
  err   = (sin(1+bump) - sin(1)) / bump - cos(1);
  errs  = [errs err];
  bumps = [bumps bump];
end

loglog(bumps,abs(errs),'-x');
xlabel('bump'); ylabel('value')
title('double precision')

errs  = [];
bumps = [];

figure(2);

for bump = single(10.^linspace(-7,0,20))
  err   = (sin(single(1)+bump) - sin(single(1))) / bump - single(cos(1));
  errs  = [errs err];
  bumps = [bumps bump];
end

loglog(bumps,abs(errs),'-x');
xlabel('bump'); ylabel('value')
title('single precision')

%
% CVT error:
%

bump = 1e-10;

err = imag(sin(1+i*bump))/bump - cos(1)
