zatan2.f 611 Bytes
complex(8) function zatan2 (csn, ccs)
      implicit none
c april 1977 version.  w. fullerton, c3, los alamos scientific lab.
      complex(8) csn, ccs, zatan
      real(8) pi
      external zatan
      data pi / 3.1415926535 8979323846d0 /
c
      if (abs(ccs).eq.0.) go to 10
c
      zatan2 = zatan (csn/ccs)
      if (real(ccs).lt.0.) zatan2 = zatan2 + pi
      if (real(zatan2).gt.pi) zatan2 = zatan2 - 2.0*pi
      return
c
 10   if (abs(csn).eq.0.) call seteru (
     1  34hzatan2  called with both args zero, 34, 1, 2)
c
      zatan2 = dcmplx (sign(0.5*pi,real(csn)), 0.0)
c
      return
      end