### Question:
Scalars { public static double digamma(double x) { if (x > 0 && x <= 1.0e-5) { return -0.5772156649 - 1.0 / x; } double result = 0; double y = x; while (y < 8.5) { result -= 1.0 / y; y += 1.0; } double r = 1.0 / y; result += Math.log(y) - 0.5 * r; r = r * r; result -= r * (8.3333333333e-2 - r * (8.3333333333e-3 - r * 3.968253968e-3)); return result; } private  Scalars(); static boolean isZero(double val); static boolean isZero(double val, double epsilon); static double log2(double x); static double digamma(double x); static final double DEFAULT_EPSILON; }### Answer:
@Test public void testDigammaShouldMatchCommonsMath() { for (double d: toIterable(doubles(), 10000)) { assertThat("digamma of " + d, Scalars.digamma(d), closeTo(Gamma.digamma(d), 1.0e-8)); } for (double d: someDoubles(0, 2.0e-5)) { assertThat("digamma of " + d, Scalars.digamma(d), closeTo(Gamma.digamma(d), 1.0e-8)); } for (double d: someDoubles(-10, 0)) { assertThat("digamma of " + d, Scalars.digamma(d), closeTo(Gamma.digamma(d), 1.0e-8)); } for (double d: someDoubles(0, 10)) { assertThat("digamma of " + d, Scalars.digamma(d), closeTo(Gamma.digamma(d), 1.0e-8)); } }