Advertisement
Guest User

Untitled

a guest
Oct 22nd, 2019
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.34 KB | None | 0 0
  1. double StandardNormalDistribution::cdf(const double& x) const {
  2. double k = 1.0/(1.0 + 0.2316419*x);
  3. double k_sum = k*(0.319381530 + k*(-0.356563782 + k*(1.781477937 + k*(-1.821255978 + 1.330274429*k))));
  4.  
  5. if (x >= 0.0) {
  6. return (1.0 - (1.0/(pow(2*M_PI,0.5)))*exp(-0.5*x*x) * k_sum);
  7. } else {
  8. return 1.0 - cdf(-x);
  9. }
  10. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement