GammaFunction extends Function1D<Double, Double> { @Override public Double evaluate(final Double x) { if (x > 0.0) { return Math.exp(Gamma.logGamma(x)); } return Math.PI / Math.sin(Math.PI * x) / evaluate(1 - x); }  @Override Double evaluate(final Double x);  }
@Test public void test() { final double x = RANDOM.nextDouble(); assertEquals(Math.log(GAMMA.evaluate(x)), LN_GAMMA.evaluate(x), EPS); }