Beta { private static double sumDeltaMinusDeltaSum(final double p, final double q) { if (p < 10.0) { throw new NumberIsTooSmallException(p, 10.0, true); } if (q < 10.0) { throw new NumberIsTooSmallException(q, 10.0, true); } final double a = FastMath.min(p, q); final double b = FastMath.max(p, q); final double sqrtT = 10.0 / a; final double t = sqrtT * sqrtT; double z = DELTA[DELTA.length - 1]; for (int i = DELTA.length - 2; i >= 0; i--) { z = t * z + DELTA[i]; } return z / a + deltaMinusDeltaSum(a, b); } private  Beta(); static double regularizedBeta(double x, double a, double b); static double regularizedBeta(double x,
                                         double a, double b,
                                         double epsilon); static double regularizedBeta(double x,
                                         double a, double b,
                                         int maxIterations); static double regularizedBeta(double x,
                                         final double a, final double b,
                                         double epsilon, int maxIterations); @Deprecated static double logBeta(double a, double b,
                                 double epsilon,
                                 int maxIterations); static double logBeta(final double p, final double q);  }
@Test public void testSumDeltaMinusDeltaSum() { final int ulps = 3; for (int i = 0; i < SUM_DELTA_MINUS_DELTA_SUM_REF.length; i++) { final double[] ref = SUM_DELTA_MINUS_DELTA_SUM_REF[i]; final double a = ref[0]; final double b = ref[1]; final double expected = ref[2]; final double actual = sumDeltaMinusDeltaSum(a, b); final double tol = ulps * FastMath.ulp(expected); final StringBuilder builder = new StringBuilder(); builder.append(a).append(", ").append(b); Assert.assertEquals(builder.toString(), expected, actual, tol); } }
@Test(expected = NumberIsTooSmallException.class) public void testSumDeltaMinusDeltaSumPrecondition1() { sumDeltaMinusDeltaSum(9.0, 10.0); }
@Test(expected = NumberIsTooSmallException.class) public void testSumDeltaMinusDeltaSumPrecondition2() { sumDeltaMinusDeltaSum(10.0, 9.0); }