1 REAL FUNCTION sgamma(a)
57 REAL a1,a2,a3,a4,a5,a6,a7,aa,aaa,b,b0,c,d,e,e1,e2,e3,e4,e5,p,q,q0,
58 + q1,q2,q3,q4,q5,q6,q7,r,s,s2,si,sqrt32,t,u,v,w,x
62 EXTERNAL ranf,sexpo,snorm
69 SAVE aa,aaa,s2,s,d,q0,b,si,c,q1,q2,q3,q4,q5,q6,q7,a1,a2,a3,a4,a5,
70 + a6,a7,e1,e2,e3,e4,e5,sqrt32
77 DATA q1,q2,q3,q4,q5,q6,q7/.04166669,.02083148,.00801191,.00144121,
78 + -.00007388,.00024511,.00024240/
79 DATA a1,a2,a3,a4,a5,a6,a7/.3333333,-.2500030,.2000062,-.1662921,
80 + .1423657,-.1367177,.1233795/
81 DATA e1,e2,e3,e4,e5/1.,.4999897,.1668290,.0407753,.0102930/
82 DATA aa/0.0/,aaa/0.0/,sqrt32/5.656854/
87 IF (a.LT.1.0) go to 130
108 IF (d*u.LE.t*t*t)
RETURN
112 IF (a.EQ.aaa) go to 40
115 q0 = ((((((q7*r+q6)*r+q5)*r+q4)*r+q3)*r+q2)*r+q1)*r
121 IF (a.LE.3.686) go to 30
122 IF (a.LE.13.022) go to 20
133 20 b = 1.654 + .0076*s2
140 30 b = .463 + s + .178*s2
142 c = .195/s - .079 + .16*s
146 40
IF (x.LE.0.0) go to 70
151 IF (
abs(v).LE.0.25) go to 50
152 q = q0 - s*t + 0.25*t*t + (s2+s2)*alog(1.0+v)
155 50 q = q0 + 0.5*t*t* ((((((a7*v+a6)*v+a5)*v+a4)*v+a3)*v+a2)*v+a1)*v
159 60
IF (alog(1.0-u).LE.q)
RETURN
172 80
IF (t.LT. (-.7187449)) go to 70
177 IF (
abs(v).LE.0.25) go to 90
178 q = q0 - s*t + 0.25*t*t + (s2+s2)*alog(1.0+v)
181 90 q = q0 + 0.5*t*t* ((((((a7*v+a6)*v+a5)*v+a4)*v+a3)*v+a2)*v+a1)*v
185 100
IF (q.LE.0.0) go to 70
186 IF (q.LE.0.5) go to 110
190 IF (q.LT.15.0) go to 105
197 IF ((q+e-0.5*t*t).GT.87.49823) go to 125
198 IF (c*
abs(u).GT.
exp(q+e-0.5*t*t)) go to 70
204 110 w = ((((e5*q+e4)*q+e3)*q+e2)*q+e1)*q
208 120
IF (c*
abs(u).GT.w*
exp(e-0.5*t*t)) go to 70
224 130 b0 = 1.0 + .3678794*a
226 IF (p.GE.1.0) go to 150
227 sgamma =
exp(alog(p)/a)
228 IF (sexpo().LT.sgamma) go to 140
231 150 sgamma = -alog((b0-p)/a)
232 IF (sexpo().LT. (1.0-a)*alog(sgamma)) go to 140
octave_value sqrt(void) const