File: normal_dis.cc

package info (click to toggle)
soapsnp 1.03-5
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 300 kB
  • sloc: cpp: 1,684; makefile: 42
file content (24 lines) | stat: -rw-r--r-- 529 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#include "soap_snp.h"

double Call_win::normal_value(double z) {
	if (z>6.0 || z<-6.0) {
		return 0.0;
	}
	else {
		double b1 = 0.31938153;
		double b2 = -0.356563782;
		double b3 = 1.781477937;
		double b4 = -1.821255978;
		double b5 = 1.330274429;
		double p = 0.2316419;
		double c2 = 0.39894228;

		double a = fabs(z);
		double t = 1.0/(1.0+a*p);
		double b = c2*exp((-z)*(z/2.0));
		double n = ((((b5*t+b4)*t+b3)*t+b2)*t+b1)*t;
		n = 1.0 - b*n;
		if (z < 0.0) n = 1.0 - n;
		return n>0.5?1-n:n;
	}
}