Erf { public static double erfcInv(final double x) { return erfInv(1 - x); } private  Erf(); static double erf(double x); static double erfc(double x); static double erf(double x1, double x2); static double erfInv(final double x); static double erfcInv(final double x);  }
@Test public void testErfcInvNaN() { Assert.assertTrue(Double.isNaN(Erf.erfcInv(-0.001))); Assert.assertTrue(Double.isNaN(Erf.erfcInv(+2.001))); }
@Test public void testErfcInvInfinite() { Assert.assertTrue(Double.isInfinite(Erf.erfcInv(-0))); Assert.assertTrue(Erf.erfcInv( 0) > 0); Assert.assertTrue(Double.isInfinite(Erf.erfcInv(+2))); Assert.assertTrue(Erf.erfcInv(+2) < 0); }
@Test public void testErfcInv() { for (double x = -5.85; x < 5.9; x += 0.01) { final double y = Erf.erfc(x); final double dydxAbs = 2 * FastMath.exp(-x * x) / FastMath.sqrt(FastMath.PI); Assert.assertEquals(x, Erf.erfcInv(y), 1.0e-15 / dydxAbs); } }