-
git-svn-id: https://lxsd.femto-st.fr/svn/fvn@69 b657c933-2333-4658-acf2-d3c7c2708721
zatan2.f
649 Bytes
complex(kind(1.d0)) function zatan2 (csn, ccs)
implicit none
c april 1977 version. w. fullerton, c3, los alamos scientific lab.
complex(kind(1.d0)) csn, ccs, zatan
real(kind(1.d0)) 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 = cmplx (sign(0.5*pi,real(csn)), 0.0, kind(1.d0))
c
return
end