function [ab,dig]=dig_usrbinet_new(N,c,dig0,dd,nofdig)
%DIG_USRBINET_NEW Number of digits needed for the upper
%   subrange Binet polynomials.
%   [AB,DIG]=DIG_USRBINET_NRW(N,C,DIG0,DD,NOFDIG) determines 
%   the number DIG of digits needed to obtain the first N 
%   recurrence coefficients for the weight function 
%   w(x)=-log(1-exp(-x)) on [C,Inf] to an accuracy of
%   NOFDIG decimal digits using the classical Chebyshev
%   algorithm. The routine successively increments an initial
%   estimate DIG0 by DD units until the required accuracy is
%   achieved. The recurrence coefficients to NOFDIG digits
%   are placed into the Nx2 array AB.

i=dig0-dd; 
maxerr=1;
while maxerr>.5*10^(-nofdig)
  i=i+dd; dig=i
  mom=smom_usrbinet_alt(dig,N,c);
  if i==dig0
    ab0=schebyshev(dig,N,mom);
    ab0(:,1)=ab0(:,1)+vpa(c,dig);
  else
    ab1=schebyshev(dig,N,mom);
    ab1(:,1)=ab1(:,1)+vpa(c,dig);
    serr=abs((ab1(:,2)-ab0(:,2))./ab1(:,2));
    err=double(serr);
    maxerr=max(err); 
    ab0=ab1;
  end
end
ab=vpa(ab1,nofdig);
