Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 58 for factorials (0.2 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));
        }
      }
    
    Java
    - Registered: Fri Apr 26 12:43:10 GMT 2024
    - Last Modified: Mon Dec 04 17:37:03 GMT 2017
    - 3.3K 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));
        }
      }
    
    Java
    - Registered: Fri Apr 19 12:43:09 GMT 2024
    - Last Modified: Mon Dec 04 17:37:03 GMT 2017
    - 3.3K bytes
    - Viewed (0)
  3. android/guava-tests/benchmark/com/google/common/math/DoubleMathBenchmark.java

          tmp += Double.doubleToRawLongBits(DoubleMath.log2(positiveDoubles[j]));
        }
        return tmp;
      }
    
      @Benchmark
      long factorial(int reps) {
        long tmp = 0;
        for (int i = 0; i < reps; i++) {
          int j = i & ARRAY_MASK;
          tmp += Double.doubleToRawLongBits(DoubleMath.factorial(factorials[j]));
        }
        return tmp;
      }
    
      @Benchmark
      int isMathematicalInteger(int reps) {
        int tmp = 0;
    Java
    - Registered: Fri Apr 26 12:43:10 GMT 2024
    - Last Modified: Mon Dec 04 17:37:03 GMT 2017
    - 2.5K bytes
    - Viewed (0)
  4. guava-tests/benchmark/com/google/common/math/DoubleMathBenchmark.java

          tmp += Double.doubleToRawLongBits(DoubleMath.log2(positiveDoubles[j]));
        }
        return tmp;
      }
    
      @Benchmark
      long factorial(int reps) {
        long tmp = 0;
        for (int i = 0; i < reps; i++) {
          int j = i & ARRAY_MASK;
          tmp += Double.doubleToRawLongBits(DoubleMath.factorial(factorials[j]));
        }
        return tmp;
      }
    
      @Benchmark
      int isMathematicalInteger(int reps) {
        int tmp = 0;
    Java
    - Registered: Fri Apr 19 12:43:09 GMT 2024
    - Last Modified: Mon Dec 04 17:37:03 GMT 2017
    - 2.5K bytes
    - Viewed (0)
  5. guava-tests/benchmark/com/google/common/math/ApacheBenchmark.java

        public abstract boolean noAddOverflow(long a, long b);
    
        public abstract boolean noMulOverflow(int a, int b);
    
        public abstract boolean noMulOverflow(long a, long b);
      }
    
      private final int[] factorials = new int[ARRAY_SIZE];
      private final int[][] binomials = new int[ARRAY_SIZE][2];
      private final int[][] nonnegInt = new int[ARRAY_SIZE][2];
      private final long[][] nonnegLong = new long[ARRAY_SIZE][2];
    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)
  6. android/guava-tests/benchmark/com/google/common/math/ApacheBenchmark.java

        public abstract boolean noAddOverflow(long a, long b);
    
        public abstract boolean noMulOverflow(int a, int b);
    
        public abstract boolean noMulOverflow(long a, long b);
      }
    
      private final int[] factorials = new int[ARRAY_SIZE];
      private final int[][] binomials = new int[ARRAY_SIZE][2];
      private final int[][] nonnegInt = new int[ARRAY_SIZE][2];
      private final long[][] nonnegLong = new long[ARRAY_SIZE][2];
    Java
    - Registered: Fri Apr 26 12:43:10 GMT 2024
    - Last Modified: Mon Dec 04 17:37:03 GMT 2017
    - 6.9K bytes
    - Viewed (0)
  7. android/guava/src/com/google/common/math/BigIntegerMath.java

          return BigInteger.valueOf(LongMath.factorials[n]);
        }
    
        // Pre-allocate space for our list of intermediate BigIntegers.
        int approxSize = IntMath.divide(n * IntMath.log2(n, CEILING), Long.SIZE, CEILING);
        ArrayList<BigInteger> bignums = new ArrayList<>(approxSize);
    
        // Start from the pre-computed maximum long factorial.
        int startingNumber = LongMath.factorials.length;
    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)
  8. 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 Apr 26 12:43:10 GMT 2024
    - Last Modified: Mon Mar 04 20:15:57 GMT 2024
    - 32.5K bytes
    - Viewed (0)
  9. 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)
  10. android/guava/src/com/google/common/math/LongMath.java

        if (k > (n >> 1)) {
          k = n - k;
        }
        switch (k) {
          case 0:
            return 1;
          case 1:
            return n;
          default:
            if (n < factorials.length) {
              return factorials[n] / (factorials[k] * factorials[n - k]);
            } else if (k >= biggestBinomials.length || n > biggestBinomials[k]) {
              return Long.MAX_VALUE;
    Java
    - Registered: Fri Apr 26 12:43:10 GMT 2024
    - Last Modified: Wed Feb 07 17:50:39 GMT 2024
    - 44.6K bytes
    - Viewed (0)
Back to top