Blame view
fvn_fnlib/zlnrel.f
1.03 KB
0c3098aed ChW 02/2010 for t... |
1 |
complex(kind(1.d0)) function zlnrel (z) |
38581db0c git-svn-id: https... |
2 3 4 5 6 7 8 9 10 11 12 |
implicit none 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 |
0c3098aed ChW 02/2010 for t... |
13 14 |
complex(kind(1.d0)) z real(kind(1.d0)) dlnrel,d1mach,zarg,sqeps,x,rho |
38581db0c git-svn-id: https... |
15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
external dlnrel, zarg, d1mach data sqeps /0.0/ c if (sqeps.eq.0.) sqeps = sqrt (d1mach(4)) c if ( abs(1.+z).lt.sqeps) call seteru ( 1 54hzlnrel answer lt half precision because z too near -1, 54, 2 1, 1) c rho = abs(z) if (rho.gt.0.375) zlnrel = log (1.0+z) if (rho.gt.0.375) return c x = real(z) |
0c3098aed ChW 02/2010 for t... |
29 |
zlnrel = cmplx (0.5*dlnrel(2.*x+rho**2), zarg(1.0+z), kind(1.d0)) |
38581db0c git-svn-id: https... |
30 31 32 |
c return end |