/** * _more_ * * @param x * @return _more_ * @throws ArithmeticException */ static private double stirf(double x) throws ArithmeticException { double STIR[] = {7.87311395793093628397E-4, -2.29549961613378126380E-4, -2.68132617805781232825E-3, 3.47222221605458667310E-3, 8.33333333333482257126E-2,}; double MAXSTIR = 143.01608; double w = 1.0 / x; double y = Math.exp(x); w = 1.0 + w * polevl(w, STIR, 4); if (x > MAXSTIR) { /* Avoid overflow in Math.pow() */ double v = Math.pow(x, 0.5 * x - 0.25); y = v * (v / y); } else { y = Math.pow(x, x - 0.5) / y; } y = SQTPI * y * w; return y; }
/** * @param x double value * @return The Error function * <p/> * <FONT size=2> * Converted to Java from<BR> * Cephes Math Library Release 2.2: July, 1992<BR> * Copyright 1984, 1987, 1989, 1992 by Stephen L. Moshier<BR> * Direct inquiries to 30 Frost Street, Cambridge, MA 02140<BR> * @throws ArithmeticException */ static public double erf(double x) throws ArithmeticException { double y, z; double T[] = {9.60497373987051638749E0, 9.00260197203842689217E1, 2.23200534594684319226E3, 7.00332514112805075473E3, 5.55923013010394962768E4}; double U[] = { //1.00000000000000000000E0, 3.35617141647503099647E1, 5.21357949780152679795E2, 4.59432382970980127987E3, 2.26290000613890934246E4, 4.92673942608635921086E4 }; if (Math.abs(x) > 1.0) { return (1.0 - erfc(x)); } z = x * x; y = x * polevl(z, T, 4) / p1evl(z, U, 5); return y; }