Search Options

Results per page
Sort
Preferred Languages
Advance

Results 11 - 20 of 58 for factorial (0.24 sec)

  1. guava-tests/test/com/google/common/math/BigIntegerMathTest.java

      }
    
      // Depends on the correctness of BigIntegerMath.factorial
      private static void runBinomialTest(int firstN, int lastN) {
        for (int n = firstN; n <= lastN; n++) {
          for (int k = 0; k <= n; k++) {
            BigInteger expected =
                BigIntegerMath.factorial(n)
                    .divide(BigIntegerMath.factorial(k))
                    .divide(BigIntegerMath.factorial(n - k));
    Java
    - Registered: Fri Apr 12 12:43:09 GMT 2024
    - Last Modified: Wed Feb 07 17:50:39 GMT 2024
    - 28.2K bytes
    - Viewed (0)
  2. android/guava-tests/test/com/google/common/math/BigIntegerMathTest.java

      }
    
      // Depends on the correctness of BigIntegerMath.factorial
      private static void runBinomialTest(int firstN, int lastN) {
        for (int n = firstN; n <= lastN; n++) {
          for (int k = 0; k <= n; k++) {
            BigInteger expected =
                BigIntegerMath.factorial(n)
                    .divide(BigIntegerMath.factorial(k))
                    .divide(BigIntegerMath.factorial(n - k));
    Java
    - Registered: Fri May 03 12:43:13 GMT 2024
    - Last Modified: Wed Feb 07 17:50:39 GMT 2024
    - 28.2K bytes
    - Viewed (0)
  3. android/guava/src/com/google/common/math/BigIntegerMath.java

       * <p>This uses an efficient binary recursive algorithm to compute the factorial with balanced
       * multiplies. It also removes all the 2s from the intermediate products (shifting them back in at
       * the end).
       *
       * @throws IllegalArgumentException if {@code n < 0}
       */
      public static BigInteger factorial(int n) {
        checkNonNegative("n", n);
    
        // If the factorial is small enough, just use LongMath to do it.
    Java
    - Registered: Fri Apr 26 12:43:10 GMT 2024
    - Last Modified: Wed Feb 07 17:50:39 GMT 2024
    - 18.9K bytes
    - Viewed (0)
  4. guava-tests/test/com/google/common/math/LongMathTest.java

      public void testConstantsFactorials() {
        long expected = 1;
        for (int i = 0; i < LongMath.factorials.length; i++, expected *= i) {
          assertEquals(expected, LongMath.factorials[i]);
        }
        try {
          LongMath.checkedMultiply(
              LongMath.factorials[LongMath.factorials.length - 1], LongMath.factorials.length);
          fail("Expected ArithmeticException");
        } catch (ArithmeticException expect) {
        }
    Java
    - Registered: Fri Apr 12 12:43:09 GMT 2024
    - Last Modified: Mon Mar 04 20:15:57 GMT 2024
    - 32.5K bytes
    - Viewed (0)
  5. guava-tests/test/com/google/common/math/IntMathTest.java

        }
      }
    
      // Depends on the correctness of BigIntegerMath.factorial.
      public void testFactorial() {
        for (int n = 0; n <= 50; n++) {
          BigInteger expectedBig = BigIntegerMath.factorial(n);
          int expectedInt = fitsInInt(expectedBig) ? expectedBig.intValue() : Integer.MAX_VALUE;
          assertEquals(expectedInt, IntMath.factorial(n));
        }
      }
    
      public void testFactorialNegative() {
    Java
    - Registered: Fri Apr 12 12:43:09 GMT 2024
    - Last Modified: Wed Feb 07 17:50:39 GMT 2024
    - 24.5K bytes
    - Viewed (0)
  6. android/guava-tests/test/com/google/common/math/LongMathTest.java

      public void testConstantsFactorials() {
        long expected = 1;
        for (int i = 0; i < LongMath.factorials.length; i++, expected *= i) {
          assertEquals(expected, LongMath.factorials[i]);
        }
        try {
          LongMath.checkedMultiply(
              LongMath.factorials[LongMath.factorials.length - 1], LongMath.factorials.length);
          fail("Expected ArithmeticException");
        } catch (ArithmeticException expect) {
        }
    Java
    - Registered: Fri May 03 12:43:13 GMT 2024
    - Last Modified: Mon Mar 04 20:15:57 GMT 2024
    - 32.5K bytes
    - Viewed (0)
  7. android/guava-tests/test/com/google/common/math/IntMathTest.java

        }
      }
    
      // Depends on the correctness of BigIntegerMath.factorial.
      public void testFactorial() {
        for (int n = 0; n <= 50; n++) {
          BigInteger expectedBig = BigIntegerMath.factorial(n);
          int expectedInt = fitsInInt(expectedBig) ? expectedBig.intValue() : Integer.MAX_VALUE;
          assertEquals(expectedInt, IntMath.factorial(n));
        }
      }
    
      public void testFactorialNegative() {
    Java
    - Registered: Fri May 03 12:43:13 GMT 2024
    - Last Modified: Wed Feb 07 17:50:39 GMT 2024
    - 24.5K bytes
    - Viewed (0)
  8. android/guava/src/com/google/common/math/DoubleMath.java

       * Double.MAX_VALUE}.
       *
       * <p>The result is within 1 ulp of the true value.
       *
       * @throws IllegalArgumentException if {@code n < 0}
       */
      public static double factorial(int n) {
        checkNonNegative("n", n);
        if (n > MAX_FACTORIAL) {
          return Double.POSITIVE_INFINITY;
        } else {
          // Multiplying the last (n & 0xf) values into their own accumulator gives a more accurate
    Java
    - Registered: Fri Apr 26 12:43:10 GMT 2024
    - Last Modified: Wed Feb 07 17:50:39 GMT 2024
    - 18.9K bytes
    - Viewed (0)
  9. android/guava-tests/benchmark/com/google/common/math/ApacheBenchmark.java

     *
     * @author Louis Wasserman
     */
    public class ApacheBenchmark {
      private enum Impl {
        GUAVA {
          @Override
          public double factorialDouble(int n) {
            return DoubleMath.factorial(n);
          }
    
          @Override
          public int gcdInt(int a, int b) {
            return IntMath.gcd(a, b);
          }
    
          @Override
          public long gcdLong(long a, long b) {
    Java
    - Registered: Fri May 03 12:43:13 GMT 2024
    - Last Modified: Mon Dec 04 17:37:03 GMT 2017
    - 6.9K bytes
    - Viewed (0)
  10. guava-tests/benchmark/com/google/common/math/ApacheBenchmark.java

     *
     * @author Louis Wasserman
     */
    public class ApacheBenchmark {
      private enum Impl {
        GUAVA {
          @Override
          public double factorialDouble(int n) {
            return DoubleMath.factorial(n);
          }
    
          @Override
          public int gcdInt(int a, int b) {
            return IntMath.gcd(a, b);
          }
    
          @Override
          public long gcdLong(long a, long b) {
    Java
    - Registered: Fri Apr 19 12:43:09 GMT 2024
    - Last Modified: Mon Dec 04 17:37:03 GMT 2017
    - 6.9K bytes
    - Viewed (0)
Back to top