Пример #1
0
 public void testFactorial() {
   for (int i = 0; i <= DoubleMath.MAX_FACTORIAL; i++) {
     double actual = BigIntegerMath.factorial(i).doubleValue();
     double result = DoubleMath.factorial(i);
     assertEquals(actual, result, Math.ulp(actual));
   }
 }
Пример #2
0
 public void testLog2Accuracy() {
   for (double d : POSITIVE_FINITE_DOUBLE_CANDIDATES) {
     double dmLog2 = DoubleMath.log2(d);
     double trueLog2 = trueLog2(d);
     assertTrue(Math.abs(dmLog2 - trueLog2) <= Math.ulp(trueLog2));
   }
 }