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

Diff of /gsl/cdf/logistic.c

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

revision 1.1.2.1 by bjg, Sun Jul 20 15:01:32 2003 UTC revision 1.1.2.2 by bjg, Mon Jul 21 16:15:10 2003 UTC
# Line 25  Line 25 
25  double  double
26  gsl_cdf_logistic_P (const double x, const double a)  gsl_cdf_logistic_P (const double x, const double a)
27  {  {
28    double P = 1/(1+exp(-x/a));    double P;
29      double u = x / a;
30    
31      if (u >= 0)
32        {
33          P = 1 / (1 + exp (-u));
34        }
35      else
36        {
37          P = exp (u) / (1 + exp (u));
38        }
39    
40    return P;    return P;
41  }  }
42    
43  double  double
44  gsl_cdf_logistic_Q (const double x, const double a)  gsl_cdf_logistic_Q (const double x, const double a)
45  {  {
46    double u = exp(-x/a);    double Q;
47    double Q = u /(1+ u);    double u = x / a;
48    
49      if (u >= 0)
50        {
51          Q = exp (-u) / (1 + exp (-u));
52        }
53      else
54        {
55          Q = 1 / (1 + exp (u));
56        }
57    
58    return Q;    return Q;
59  }  }

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