Blame view

fvn_fnlib/clnrel.f 958 Bytes
38581db0c   daniau   git-svn-id: https...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
        complex function clnrel (z)
  c april 1977 version.  w. fullerton, c3, los alamos scientific lab.
  c
  c clnrel(z) = clog(1+z) with relative error accuracy near z = 0.
  c let   rho = cabs(z)  and
  c       r**2 = cabs(1+z)**2 = (1+x)**2 + y**2 = 1 + 2*x + rho**2 .
  c now if rho is small we may evaluate clnrel(z) accurately by
  c       clog(1+z) = cmplx (alog(r), carg(1+z))
  c                 = cmplx (0.5*alog(r**2), carg(1+z))
  c                 = cmplx (0.5*alnrel(2*x+rho**2), carg(1+z))
  c
        complex z, clog
        external alnrel, carg,  r1mach
        data sqeps /0.0/
  c
        if (sqeps.eq.0.) sqeps = sqrt (r1mach(4))
  c
        if (cabs(1.+z).lt.sqeps) call seteru (
       1  54hclnrel  answer lt half precision because z too near -1, 54,
       2  1, 1)
  c
        rho = cabs(z)
        if (rho.gt.0.375) clnrel = clog (1.0+z)
        if (rho.gt.0.375) return
  c
        x = real(z)
        clnrel = cmplx (0.5*alnrel(2.*x+rho**2), carg(1.0+z))
  c
        return
        end