System.Drawing.GeomUtilities.Phi C# (CSharp) Метод

Phi() статический приватный Метод

static private Phi ( double x ) : double
x double
Результат double
        static double Phi(double x)
        {
            // constants
            double a1 = 0.254829592;
            double a2 = -0.284496736;
            double a3 = 1.421413741;
            double a4 = -1.453152027;
            double a5 = 1.061405429;
            double p = 0.3275911;

            // Save the sign of x
            int sign = 1;
            if (x < 0)
                sign = -1;
            x = Math.Abs(x) / Math.Sqrt(2.0);

            // A&S refers to Handbook of Mathematical Functions by Abramowitz and Stegun.
            // See Stand-alone error function for details of the algorithm.
            // http://www.johndcook.com/blog/2009/01/19/stand-alone-error-function-erf/
            // A&S formula 7.1.26
            double t = 1.0 / (1.0 + p * x);
            double y = 1.0 - (((((a5 * t + a4) * t) + a3) * t + a2) * t + a1) * t * Math.Exp(-x * x);

            return 0.5 * (1.0 + sign * y);
        }