/// <summary>
        /// Returns the value of complementary error function for the specified argument.
        /// </summary>
        /// <param name="x">A real number.</param>
        /// <returns>The value of the complementary error function for x.</returns>
        public static double Erfc(double x)
        {
            double absx = Math.Abs(x);

            if (absx > MaxArgVal)
            {
                return((x > 0.0) ? 0.0 : 2.0);
            }

            if (absx <= Intval1)
            {
                return(1.0 - Erf(x));
            }

            if (x < 0.0)
            {
                return(2.0 - Erfc(-x));
            }

            if (absx <= Intval2)
            {
                return(Math.Exp(-(x * x)) * RationalFunc(erfc_p1, erfc_q1, x));
            }
            else
            {
                double xsq    = x * x;
                double invxsq = 1.0 / xsq;
                double R      = RationalFunc(erfc_p2, erfc_q2, invxsq);
                double t      = 1.0 / ExMath.SqrtPi + invxsq * R;
                return(Math.Exp(-xsq) / x * (t - ExMath.Truncate(t)));
            }
        }