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

Diff of /gsl/cdf/gauss.c

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

revision 1.1.2.7 by jstover, Sun Feb 23 02:11:42 2003 UTC revision 1.1.2.8 by bjg, Tue Feb 25 22:52:55 2003 UTC
# Line 23  Line 23 
23   * standard Normal distribution, i.e., mean 0 and standard   * standard Normal distribution, i.e., mean 0 and standard
24   * deviation 1. If you want to compute Pr(X < t) for a Gaussian random   * deviation 1. If you want to compute Pr(X < t) for a Gaussian random
25   * variable X with non-zero mean m and standard deviation sd not equal   * variable X with non-zero mean m and standard deviation sd not equal
26   * to 1, find gsl_cdf_gauss ( (t-m)/sd ). This approximation is accurate   * to 1, find gsl_cdf_gaussian ( (t-m)/sd ). This approximation is accurate
27   * to at least double precision. The accuracy was verified with a pari-gp   * to at least double precision. The accuracy was verified with a pari-gp
28   * script. The largest error found was about 1.4E-20. The coefficients   * script. The largest error found was about 1.4E-20. The coefficients
29   * were derived by Cody.   * were derived by Cody.
# Line 56  Line 56 
56   * IEEE double precision dependent constants.   * IEEE double precision dependent constants.
57   *   *
58   * GAUSS_EPSILON: Smallest positive value such that   * GAUSS_EPSILON: Smallest positive value such that
59   *                gsl_cdf_gauss(x) > 0.5.   *                gsl_cdf_gaussian(x) > 0.5.
60   * GAUSS_XUPPER: Smallest value x such that gsl_cdf_gauss(x) < 1.0.   * GAUSS_XUPPER: Smallest value x such that gsl_cdf_gaussian(x) < 1.0.
61   * GAUSS_XLOWER: Largest value x such that gsl_cdf_gauss(x) > 0.0.   * GAUSS_XLOWER: Largest value x such that gsl_cdf_gaussian(x) > 0.0.
62   */   */
63    
64  #ifndef GAUSS_EPSILON  #ifndef GAUSS_EPSILON
# Line 221  static double gauss_grandex ( const doub Line 221  static double gauss_grandex ( const doub
221    return result;    return result;
222  }  }
223    
224  double gsl_cdf_gauss_Q (const double x )  double gsl_cdf_gaussian_Q (const double x )
225  {  {
226    double result;    double result;
227    double absx;    double absx;
# Line 248  double gsl_cdf_gauss_Q (const double x ) Line 248  double gsl_cdf_gauss_Q (const double x )
248            result = 1.0 - result;            result = 1.0 - result;
249          }          }
250      }      }
251    else if ( x < GAUSS_XUPPER || x < GAUSS_XLOWER )    else if ( x >= -GAUSS_XUPPER || x <= -GAUSS_XLOWER )
252      {      {
253        result = gauss_grandex (x);        result = gauss_grandex (x);
254        if ( x < 0.0 )        if ( x < 0.0 )
# Line 256  double gsl_cdf_gauss_Q (const double x ) Line 256  double gsl_cdf_gauss_Q (const double x )
256            result = 1.0 - result;            result = 1.0 - result;
257          }          }
258      }      }
259    else if ( x > GAUSS_XUPPER )    else if ( x > -GAUSS_XLOWER )
260      {      {
261        result = 0.0;        result = 0.0;
262      }      }
263    else if ( x < GAUSS_XLOWER )    else if ( x < -GAUSS_XUPPER )
264      {      {
265        result = 1.0;        result = 1.0;
266      }      }
# Line 271  double gsl_cdf_gauss_Q (const double x ) Line 271  double gsl_cdf_gauss_Q (const double x )
271    
272    return result;    return result;
273  }  }
274  double gsl_cdf_gauss_P(const double x)  double gsl_cdf_gaussian_P(const double x)
275  {  {
276    double result;    double result;
277    double absx;    double absx;

Legend:
Removed from v.1.1.2.7  
changed lines
  Added in v.1.1.2.8

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