% esimate the rounding unit for single and double precision
%

% double precision
%
eta  = 1.0;
isdone = 0;
while( ~isdone )
  if( (1.0+eta)~=1.0 )
    eta = eta/2;
  else
    isdone=1;
  end
end
fprintf('double precision rounding error = %e\n',eta);

% double precision
%
eta  = single(1.0);
isdone = 0;
while( ~isdone )
  if( (1.0+eta)~=1.0 )
    eta = eta/2;
  else
    isdone=1;
  end
end
fprintf('single precision rounding error = %e\n',eta);
