public static double contFract(double a, double b, double x) {
		double aplusb = a + b;
		double aplus1 = a + 1.0D;
		double aminus1 = a - 1.0D;
		double c = 1.0D;
		double d = 1.0D - aplusb * x / aplus1;
		if (Math.abs(d) < Stat.FPMIN) d = FPMIN;
		d = 1.0D / d;
		double h = d;
		double aa = 0.0D;
		double del = 0.0D;
		int i = 1, i2 = 0;
		boolean test = true;
		while (test) {
			i2 = 2 * i;
			aa = i * (b - i) * x / ((aminus1 + i2) * (a + i2));
			d = 1.0D + aa * d;
			if (Math.abs(d) < Stat.FPMIN) d = FPMIN;
			c = 1.0D + aa / c;
			if (Math.abs(c) < Stat.FPMIN) c = FPMIN;
			d = 1.0D / d;
			h *= d * c;
			aa = -(a + i) * (aplusb + i) * x / ((a + i2) * (aplus1 + i2));
			d = 1.0D + aa * d;
			if (Math.abs(d) < Stat.FPMIN) d = FPMIN;
			c = 1.0D + aa / c;
			if (Math.abs(c) < Stat.FPMIN) c = FPMIN;
			d = 1.0D / d;
			del = d * c;
			h *= del;
			i++;
			if (Math.abs(del - 1.0D) < Stat.cfTol) test = false;
			if (i > Stat.cfMaxIter) {
				test = false;
				System.out.println("Maximum number of iterations (" + Stat.cfMaxIter + ") exceeded in Stat.contFract in Stat.incompleteBeta");
			}
		}
		return h;

	}