/[gsl]/gsl/cdf/gaussinv.c
ViewVC logotype

Diff of /gsl/cdf/gaussinv.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.1.2.1 by bjg, Sun Jun 29 10:47:46 2003 UTC revision 1.1.2.2 by bjg, Fri Jul 18 15:54:03 2003 UTC
# Line 37  static double Line 37  static double
37  small (double q)  small (double q)
38  {  {
39    const double a[8] = { 3.387132872796366608, 133.14166789178437745,    const double a[8] = { 3.387132872796366608, 133.14166789178437745,
40                          1971.5909503065514427, 13731.693765509461125,      1971.5909503065514427, 13731.693765509461125,
41                          45921.953931549871457, 67265.770927008700853,      45921.953931549871457, 67265.770927008700853,
42                          33430.575583588128105, 2509.0809287301226727      33430.575583588128105, 2509.0809287301226727
43    };    };
44      
45    const double b[8] = { 1.0, 42.313330701600911252,    const double b[8] = { 1.0, 42.313330701600911252,
46                          687.1870074920579083, 5394.1960214247511077,      687.1870074920579083, 5394.1960214247511077,
47                          21213.794301586595867, 39307.89580009271061,      21213.794301586595867, 39307.89580009271061,
48                          28729.085735721942674, 5226.495278852854561      28729.085735721942674, 5226.495278852854561
49    };    };
50      
51    double r = 0.180625 - q * q;    double r = 0.180625 - q * q;
52      
53    double x = q * rat_eval (a, 8, b, 8, r);    double x = q * rat_eval (a, 8, b, 8, r);
54      
55    return x;    return x;
56  }  }
57    
# Line 59  static double Line 59  static double
59  intermediate (double r)  intermediate (double r)
60  {  {
61    const double a[] = { 1.42343711074968357734, 4.6303378461565452959,    const double a[] = { 1.42343711074968357734, 4.6303378461565452959,
62                         5.7694972214606914055, 3.64784832476320460504,      5.7694972214606914055, 3.64784832476320460504,
63                         1.27045825245236838258, 0.24178072517745061177,      1.27045825245236838258, 0.24178072517745061177,
64                         0.0227238449892691845833, 7.7454501427834140764e-4      0.0227238449892691845833, 7.7454501427834140764e-4
65    };    };
66      
67    const double b[] = { 1.0, 2.05319162663775882187,    const double b[] = { 1.0, 2.05319162663775882187,
68                         1.6763848301838038494, 0.68976733498510000455,      1.6763848301838038494, 0.68976733498510000455,
69                         0.14810397642748007459, 0.0151986665636164571966,      0.14810397642748007459, 0.0151986665636164571966,
70                         5.475938084995344946e-4, 1.05075007164441684324e-9      5.475938084995344946e-4, 1.05075007164441684324e-9
71    };    };
72      
73    double x = rat_eval (a, 8, b, 8, (r - 1.6));    double x = rat_eval (a, 8, b, 8, (r - 1.6));
74    
75    return x;    return x;
# Line 79  static double Line 79  static double
79  tail (double r)  tail (double r)
80  {  {
81    const double a[] = { 6.6579046435011037772, 5.4637849111641143699,    const double a[] = { 6.6579046435011037772, 5.4637849111641143699,
82                         1.7848265399172913358, 0.29656057182850489123,      1.7848265399172913358, 0.29656057182850489123,
83                         0.026532189526576123093, 0.0012426609473880784386,      0.026532189526576123093, 0.0012426609473880784386,
84                         2.71155556874348757815e-5, 2.01033439929228813265e-7      2.71155556874348757815e-5, 2.01033439929228813265e-7
85    };    };
86      
87    const double b[] = { 1.0, 0.59983220655588793769,    const double b[] = { 1.0, 0.59983220655588793769,
88                         0.13692988092273580531, 0.0148753612908506148525,      0.13692988092273580531, 0.0148753612908506148525,
89                         7.868691311456132591e-4, 1.8463183175100546818e-5,      7.868691311456132591e-4, 1.8463183175100546818e-5,
90                         1.4215117583164458887e-7, 2.04426310338993978564e-15      1.4215117583164458887e-7, 2.04426310338993978564e-15
91    };    };
92      
93    double x = rat_eval (a, 8, b, 8, (r - 5.0));    double x = rat_eval (a, 8, b, 8, (r - 5.0));
94      
95    return x;    return x;
96  }  }
97    
# Line 110  gsl_cdf_ugaussian_Pinv (double p) Line 110  gsl_cdf_ugaussian_Pinv (double p)
110      {      {
111        return GSL_NEGINF;        return GSL_NEGINF;
112      }      }
113      
114    if (fabs(dp) <= 0.425)    if (fabs (dp) <= 0.425)
115      {      {
116        x = small (dp);        x = small (dp);
117    
118        return x;        return x;
119      }      }
120    
121    pp =  (p < 0.5) ? p : 1.0 - p;    pp = (p < 0.5) ? p : 1.0 - p;
122    
123    r = sqrt (-log (pp));    r = sqrt (-log (pp));
124    
# Line 157  gsl_cdf_ugaussian_Qinv (double p) Line 157  gsl_cdf_ugaussian_Qinv (double p)
157      {      {
158        return GSL_POSINF;        return GSL_POSINF;
159      }      }
160    
161    if (fabs(dp) <= 0.425)    if (fabs (dp) <= 0.425)
162      {      {
163        x = small (dp);        x = small (dp);
164    
165        return -x;        return -x;
166      }      }
167    
168    pp =  (p < 0.5) ? p : 1.0 - p;    pp = (p < 0.5) ? p : 1.0 - p;
169    
170    r = sqrt (-log (pp));    r = sqrt (-log (pp));
171    

Legend:
Removed from v.1.1.2.1  
changed lines
  Added in v.1.1.2.2

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26