c0lgmc.f
625 Bytes
complex function c0lgmc (z)
c august 1980 edition. w. fullerton c3, los alamos scientific lab.
c
c evaluate (z+0.5)*clog((z+1.0)/z) - 1.0 with relative error accuracy.
c let q = 1.0/z so that
c (z+0.5)*clog(1+1/z) - 1 = (z+0.5)*(clog(1+q) - q + q*q/2) - q*q/4
c = (z+0.5)*q**3*c9ln2r(q) - q**2/4,
c where c9ln2r is (clog(1+q) - q + 0.5*q**2) / q**3.
c
complex z, q, c9ln2r, clog
external c9ln2r
c
cabsz = cabs(z)
c
q = 1.0/z
if (cabsz.le.1.23) c0lgmc = (z+0.5)*clog(1.0+q) - 1.0
if (cabsz.gt.1.23) c0lgmc = ((1.+.5*q)*c9ln2r(q) - .25) * q**2
c
return
end