3 #define twopi 6.283195307179587
4 #define con (twopi / 2.0) * 10.0e-10
6 extern void normbase(double *, double *);
8 double bivnor(double ah
, double ak
, double r
)
11 based on alg 4628 comm. acm oct 73
12 gives the probability that a bivariate normal exceeds (ah,ak).
13 gh and gk are .5 times the right tail areas of ah, ak under a n(0,1)
15 Tranlated from FORTRAN to ratfor using struct; from ratfor to C by hand.
17 double a2
, ap
, b
, cn
, conex
, ex
, g2
, gh
, gk
, gw
, h2
, h4
, rr
, s1
, s2
,
18 sgn
, sn
, sp
, sqr
, t
, temp
, w2
, wh
, wk
;
46 b
= atan(r
/sqr
)/twopi
+.25;
80 b
= b
-(gw
+g2
)/2+gw
*g2
;
108 t
= (atan(wk
)-wk
*s1
)/twopi
;