public static Apfloat cdfApfloat(double x, double y, double p[], double q[]) {
		Apfloat xAp = new Apfloat(x);
		Apfloat mhalf = new Apfloat(-0.5); // -1/2

		/* Evaluate pnorm for sqrt(32) < |z| < 50 */
		Apfloat result = new Apfloat(0.0);
		Apfloat xsq = new Apfloat(1.0 / (x * x));
		Apfloat xnum = xsq.multiply(new Apfloat(p[5]));
		Apfloat xden = xsq;
		for (int i = 1; i <= 4; ++i) {
			xnum = xnum.add(new Apfloat(p[i - 1])).multiply(xsq);
			xden = xden.add(new Apfloat(q[i - 1])).multiply(xsq);
		}
		result = xsq.multiply((xnum.add(new Apfloat(p[4]))).divide(xden.add(new Apfloat(q[4]))));
		result = new Apfloat(Constants.M_1_SQRT_2PI).subtract(result).divide(new Apfloat(y));
		/*!* 	xsq = floor(x * SIXTEN) / SIXTEN; *!*/
		xsq = new Apfloat(java.lang.Math.floor(x * SIXTEN) / SIXTEN);
		Apfloat del = xAp.subtract(xsq).multiply(xAp.add(xsq));

		/*!* 	result = exp(-xsq * xsq * 0.5) * exp(-del * 0.5) * result; *!*/
		result = ApfloatMath.exp(xsq.multiply(xsq).multiply(mhalf)).multiply(ApfloatMath.exp(del.multiply(mhalf))).multiply(result);
		Apfloat ccum = Apfloat.ONE.subtract(result);
		if (x > 0.0) {
			Apfloat temp = result;
			result = ccum;
			ccum = temp;
		}

		return result;
	}