%TEST_PRECISION1 Precision required for Algorithm 2 in the
%   case of Example 1
%
f0='%8.0f %5.0f %14.4e %12.4e\n';
disp('      N     dig      erra         errb')
m=8; 
for N=[10 25 50:5:80]
  abp=zeros(N,2);
  k=0;
  dig1=8; dig2=80; nd=1+(dig2-dig1)/4;
  err=zeros(nd,3);
  for dig=dig1:4:dig2
    k=k+1;
    abp0=abp;
    digits(dig);
    bet=vpa(100);
    ab0=sr_jacobi01(dig,N,-1/2,0);
    z(1)=vpa(pi*i/bet); z(2)=conj(z(1));
    z(3)=vpa(3*pi*i/bet); z(4)=conj(z(3));
    z(5)=vpa(5*pi*i/bet); z(6)=conj(z(5));
    z(7)=vpa(7*pi*i/bet); z(8)=conj(z(7));
    ab=mod_md(N,m,z,ab0,@rho0); ab=real(ab);
    abp=subs(ab);
    err(k,2:3)=max(abs(abp-abp0));
    if max(err(k,2:3))<.5e-16, break, end
  end
  d=(dig1:4:dig2)';
  err(:,1)=d;
  for n=1:k
    fprintf(f0,N,err(n,1),err(n,2),err(n,3))
  end
  fprintf('\n')
end
