      program sr
      implicit double precision (a-h,o-z)
      double complex xi
      double complex z,f,f2
      xi = (0.d0,1.d0)
      pi = 4.d0*datan(1.d0) 


c     Let's check where Fortran puts the branch line 
c      f = cdsqrt(-1 + 0.0001*xi)
c      write(*,*) f
c      f = cdsqrt(-1 - 0.0001*xi) 
c      write(*,*) f
c     so cdlog uses the principla branch [-pi,pi] 

     


      do i=1,101
      phi = dble(i-1)*(pi)/100. - pi 
      z = 1.*(dcos(phi) + xi*dsin(phi))
      f = cdsqrt(z)
      write(10,*) dble(z),dimag(z) 
      write(20,*) dble(f),dimag(f) 
      enddo

      do i=1,1001
      phi = dble(i-1)*(pi)/1000.+  0. 
      z = 1.*(dcos(phi) + xi*dsin(phi))
      f = cdsqrt(z)
      write(10,*) dble(z),dimag(z) 
      write(20,*) dble(f),dimag(f) 
      enddo



c     f2 on the second sheet

      do i=1,101
      phi = dble(i-1)*(pi)/100. - pi 
      z = 1.*(dcos(phi) + xi*dsin(phi))
      f2 = cdsqrt(z) - 2.*cdsqrt(z) 
      write(30,*) dble(z),dimag(z) 
      write(40,*) dble(f2),dimag(f2) 
      enddo


     
      stop
      end 
      

      
      
