Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 30 for factorial (0.07 sec)

  1. android/guava-tests/benchmark/com/google/common/math/BigIntegerMathBenchmark.java

          binomials[i] = RANDOM_SOURCE.nextInt(factorials[i] + 1);
        }
      }
    
      /** Previous version of BigIntegerMath.factorial, kept for timing purposes. */
      private static BigInteger oldSlowFactorial(int n) {
        if (n <= 20) {
          return BigInteger.valueOf(LongMath.factorial(n));
        } else {
          int k = 20;
          return BigInteger.valueOf(LongMath.factorial(k)).multiply(oldSlowFactorial(k, n));
        }
      }
    
    Registered: Fri Nov 01 12:43:10 UTC 2024
    - Last Modified: Mon Aug 19 16:21:24 UTC 2024
    - 3.4K bytes
    - Viewed (0)
  2. guava-tests/benchmark/com/google/common/math/BigIntegerMathBenchmark.java

          binomials[i] = RANDOM_SOURCE.nextInt(factorials[i] + 1);
        }
      }
    
      /** Previous version of BigIntegerMath.factorial, kept for timing purposes. */
      private static BigInteger oldSlowFactorial(int n) {
        if (n <= 20) {
          return BigInteger.valueOf(LongMath.factorial(n));
        } else {
          int k = 20;
          return BigInteger.valueOf(LongMath.factorial(k)).multiply(oldSlowFactorial(k, n));
        }
      }
    
    Registered: Fri Nov 01 12:43:10 UTC 2024
    - Last Modified: Mon Aug 19 16:21:24 UTC 2024
    - 3.4K bytes
    - Viewed (0)
  3. android/guava-tests/test/com/google/common/math/DoubleMathTest.java

          double actual = BigIntegerMath.factorial(i).doubleValue();
          double result = DoubleMath.factorial(i);
          assertThat(result).isWithin(Math.ulp(actual)).of(actual);
        }
      }
    
      public void testFactorialTooHigh() {
        assertThat(DoubleMath.factorial(DoubleMath.MAX_FACTORIAL + 1)).isPositiveInfinity();
        assertThat(DoubleMath.factorial(DoubleMath.MAX_FACTORIAL + 20)).isPositiveInfinity();
      }
    
    Registered: Fri Nov 01 12:43:10 UTC 2024
    - Last Modified: Fri Oct 18 15:00:32 UTC 2024
    - 27.3K bytes
    - Viewed (0)
  4. guava-tests/test/com/google/common/math/DoubleMathTest.java

          double actual = BigIntegerMath.factorial(i).doubleValue();
          double result = DoubleMath.factorial(i);
          assertThat(result).isWithin(Math.ulp(actual)).of(actual);
        }
      }
    
      public void testFactorialTooHigh() {
        assertThat(DoubleMath.factorial(DoubleMath.MAX_FACTORIAL + 1)).isPositiveInfinity();
        assertThat(DoubleMath.factorial(DoubleMath.MAX_FACTORIAL + 20)).isPositiveInfinity();
      }
    
    Registered: Fri Nov 01 12:43:10 UTC 2024
    - Last Modified: Fri Oct 18 15:00:32 UTC 2024
    - 27.3K bytes
    - Viewed (0)
  5. 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.
    Registered: Fri Nov 01 12:43:10 UTC 2024
    - Last Modified: Wed Oct 16 17:21:56 UTC 2024
    - 18.8K bytes
    - Viewed (0)
  6. 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() {
    Registered: Fri Nov 01 12:43:10 UTC 2024
    - Last Modified: Sat Oct 19 00:26:48 UTC 2024
    - 23.1K bytes
    - Viewed (0)
  7. 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() {
    Registered: Fri Nov 01 12:43:10 UTC 2024
    - Last Modified: Sat Oct 19 00:26:48 UTC 2024
    - 23.1K bytes
    - Viewed (0)
  8. guava-tests/test/com/google/common/math/LongMathTest.java

        long expected = 1;
        for (int i = 0; i < LongMath.factorials.length; i++, expected *= i) {
          assertEquals(expected, LongMath.factorials[i]);
        }
        assertThrows(
            ArithmeticException.class,
            () ->
                LongMath.checkedMultiply(
                    LongMath.factorials[LongMath.factorials.length - 1], LongMath.factorials.length));
      }
    
      @GwtIncompatible // TODO
    Registered: Fri Nov 01 12:43:10 UTC 2024
    - Last Modified: Fri Oct 18 15:00:32 UTC 2024
    - 30.6K bytes
    - Viewed (0)
  9. android/guava/src/com/google/common/collect/Collections2.java

        final ImmutableList<E> inputList;
    
        PermutationCollection(ImmutableList<E> input) {
          this.inputList = input;
        }
    
        @Override
        public int size() {
          return IntMath.factorial(inputList.size());
        }
    
        @Override
        public boolean isEmpty() {
          return false;
        }
    
        @Override
        public Iterator<List<E>> iterator() {
    Registered: Fri Nov 01 12:43:10 UTC 2024
    - Last Modified: Fri Oct 18 20:24:49 UTC 2024
    - 22.8K bytes
    - Viewed (0)
  10. guava/src/com/google/common/collect/Collections2.java

        final ImmutableList<E> inputList;
    
        PermutationCollection(ImmutableList<E> input) {
          this.inputList = input;
        }
    
        @Override
        public int size() {
          return IntMath.factorial(inputList.size());
        }
    
        @Override
        public boolean isEmpty() {
          return false;
        }
    
        @Override
        public Iterator<List<E>> iterator() {
    Registered: Fri Nov 01 12:43:10 UTC 2024
    - Last Modified: Fri Oct 18 20:24:49 UTC 2024
    - 23.1K bytes
    - Viewed (0)
Back to top