### Question:
PoissonDistribution extends AbstractDiscreteDistribution { @Override public double cumulativeProbability(int x) { if (x < 0) { return 0; } if (x == Integer.MAX_VALUE) { return 1; } return RegularizedGamma.Q.value((double) x + 1, mean, epsilon, maxIterations); } PoissonDistribution(double p); private  PoissonDistribution(double p,
                                double epsilon,
                                int maxIterations); @Override double probability(int x); @Override double logProbability(int x); @Override double cumulativeProbability(int x); double normalApproximateProbability(int x); @Override double getMean(); @Override double getVariance(); @Override int getSupportLowerBound(); @Override int getSupportUpperBound(); @Override boolean isSupportConnected(); @Override DiscreteDistribution.Sampler createSampler(final UniformRandomProvider rng);  }### Answer:
@Test void testLargeMeanCumulativeProbability() { double mean = 1.0; while (mean <= 10000000.0) { final PoissonDistribution dist = new PoissonDistribution(mean); double x = mean * 2.0; final double dx = x / 10.0; double p = Double.NaN; final double sigma = Math.sqrt(mean); while (x >= 0) { try { p = dist.cumulativeProbability((int) x); Assertions.assertFalse(Double.isNaN(p), "NaN cumulative probability"); if (x > mean - 2 * sigma) { Assertions.assertTrue(p > 0, "Zero cumulative probaility"); } } catch (final AssertionError ex) { Assertions.fail("mean of " + mean + " and x of " + x + " caused " + ex.getMessage()); } x -= dx; } mean *= 10.0; } }
@Test void testLargeMeanInverseCumulativeProbability() { double mean = 1.0; while (mean <= 100000.0) { final PoissonDistribution dist = new PoissonDistribution(mean); double p = 0.1; final double dp = p; while (p < .99) { try { final int ret = dist.inverseCumulativeProbability(p); Assertions.assertTrue(p <= dist.cumulativeProbability(ret)); Assertions.assertTrue(p > dist.cumulativeProbability(ret - 1)); } catch (final AssertionError ex) { Assertions.fail("mean of " + mean + " and p of " + p + " caused " + ex.getMessage()); } p += dp; } mean *= 10.0; } }