function val = bssetolerance(tol)
% bssetolerance Set tolerance for binary search [PHYS210-bs]
   global Bs_low Bs_high Bs_tol Bs_progress;
   bs_minimum_tol = 5 * eps;
   if nargin < 1
      tol = bs_minimum_tol;
   end
   if isnan(tol)
      tol = bs_minimum_tol;
   end
   tol = abs(tol);
   if tol < bs_minimum_tol
      fprintf('bssettol: Warning -- Specified tolerance %22.16e is too small.\n', tol);
      fprintf('bssettol: Warning -- Setting to %22.16e\n', bs_minimum_tol);
      tol = bs_minimum_tol;
   end
   Bs_tol = tol;
   val = Bs_tol;
end
