%The following involves subtraction of two close numbers a and b. You can change b by adding more 0s to make it 
closer to a (e.g. b=100000/500001) and see what happen. Don't forget to change exact_c as well.

format long e
a=1/5;
b=1000/5001;
c=a-b;
fprintf('\n  a \t= \t%2.20f\n  b \t= \t%2.20f\n  c \t= \t%2.20f\n\n',a,b,c);
% the exact value of c is 1/25005
exact_c=1/25005;
fprintf('\n  OR IN FLOATING POINT FORM \n  c \t\t= \t%1.16e\n  exact_c \t= \t%1.16e\n\n',c,exact_c);
% relative error
rel_error=(c-exact_c)/exact_c;
fprintf('\n  rel_error  \t= \t%1.2e\n',rel_error);

