This page needs to be proofread.
39. INITIALIZE PARAMETERS
B.22
52. Use lookup table from data in Table 7.1 from Abramowitz and Stegun, Handbook of Mathematical Functions. Get bounds on y data and linear interpolate x data. The variable frac is the fraction of the gap between neighboring y values. Note: additions to the table require changes to the main routine to reflect the new dimension of the arrays,
real inv_erfc(real C)
{
real x, frac, x_table[] = {0.00,0.10,0.20,0.30,0.40,0.50,0.60,0.70,0.80,0.90,1.00,1.20,1.40,1.60,1.80,2.00}, y.table[]={1.00,.888,.777,.671,.572,.480,.396,.322,.258,.203,.157,.090,.048,.024,.011,.005};
int i;
i = 16;
while (i>0y_table[--i]<C); /* find bounds */
if(x < 15 {
frac=y.table[i] - C)/(y_table[i]-y.iable[i+1]);
x=x.table[i]+frac*(x_table[i+1]-x.table[i]);
}
else x=x_table[15]; /* if C > 2.0 simply use last x value */
return x;
}