%% Machine Epsilon
% Determine the machine epsilon.
% HH 10.4.2018
%
%% Close to 1
%

fprintf('%.16g\n', eps);
fprintf('%.16g\n', 2^(-52));

epsm = 1.0;
while 1.0 + 0.5 * epsm ~= 1.0
    epsm = 0.5 * epsm;
end

fprintf('%.16g\n', epsm);

%
%% Close to 10
%

fprintf('%.16g\n', eps(10));
fprintf('%.16g\n', log2(eps(10)));
fprintf('%.16g\n', 2^(-49));

epsm = 1.0;
while 10.0 + 0.5 * epsm ~= 10.0
    epsm = 0.5 * epsm;
end

fprintf('%.16g\n', epsm);
fprintf('%.16g\n', log2(10));