~ubuntu-branches/debian/jessie/eso-midas/jessie

« back to all changes in this revision

Viewing changes to contrib/tsa/libsrc/riembi.for

  • Committer: Package Import Robot
  • Author(s): Ole Streicher
  • Date: 2014-04-22 14:44:58 UTC
  • Revision ID: package-import@ubuntu.com-20140422144458-okiwi1assxkkiz39
Tags: upstream-13.09pl1.2+dfsg
ImportĀ upstreamĀ versionĀ 13.09pl1.2+dfsg

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
c
 
2
      real function riembi(p,q,x)
 
3
c implementation of Lentz's continued fraction 
 
4
c based on ideas from Numerical Recipes (Press et. al., 1986)
 
5
      implicit none
 
6
      real p,q,x,gamlog,rbfrac,zero,one,two,sav
 
7
      parameter (zero=0.,one=1.,two=2.)
 
8
c Abramovitz & Stegun 1971 (26.5.8)
 
9
      if (x.lt.zero.or.x.gt.one) then
 
10
cc obsolete Fortran statement: PAUSE
 
11
cc        pause 'riembi: argument X out of range'
 
12
        riembi = -999999.
 
13
        return
 
14
      elseif (x.eq.zero.or.x.eq.one) then
 
15
        sav=zero
 
16
      else
 
17
c Abramovitz & Stegun 1971 (6.2.2)
 
18
        sav=exp(gamlog(p+q)
 
19
     $-gamlog(p)-gamlog(q)+p*log(x)+q*log(one-x))
 
20
      endif
 
21
c Abramovitz & Stegun 1971 (26.5.8)
 
22
      if ((p+one)/(p+q+two).gt.x) then
 
23
        riembi=sav*rbfrac(p,q,x)/p
 
24
      else
 
25
c Abramovitz & Stegun 1971 (26.5.2)
 
26
        riembi=one-sav*rbfrac(q,p,one-x)/q
 
27
      endif
 
28
      end
 
29
c
 
30
c                                   
 
31
c