Blame view

fvn_fnlib/exprel.f 1.01 KB
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
31
32
33
34
35
36
37
        function exprel (x)
  c august 1977 edition.  w. fullerton, c3, los alamos scientific lab.
  c
  c evaluate  exprel(x) = (exp(x) - 1.0) / x.   for small abs(x) the
  c taylor series is used.  if x is negative the reflection formula
  c         exprel(x) = exp(x) * exprel(abs(x))
  c may be used  this reflection formula will be of use when the
  c evaluation for small abs(x) is done by chebyshev series rather than
  c taylor series.
  c
        external  r1mach
        data nterms, xbnd / 0, 0.0 /
  c
        if (nterms.ne.0) go to 10
        alneps = alog(r1mach(3))
        xn = 3.72 - 0.3*alneps
        xln = alog((xn+1.0)/1.36)
        nterms = xn - (xn*xln+alneps)/(xln+1.36) + 1.5
        xbnd = r1mach(3)
  c
   10   absx = abs(x)
        if (absx.le.0.5) go to 20
        call entsrc (irold, 1)
        exprel = (exp(x)-1.0)/x
        call entsrc (ir, irold)
        return
  c
   20   exprel = 1.0
        if (absx.lt.xbnd) return
  c
        exprel = 0.0
        do 30 i=1,nterms
          exprel = 1.0 + exprel*x/float(nterms+2-i)
   30   continue
  c
        return
        end