Search Options

Results per page
Sort
Preferred Languages
Advance

Results 11 - 20 of 1,008 for log2 (0.03 sec)

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

          nonzero[i] = randomNonZeroBigInteger(Long.SIZE - 2).longValue();
          longs[i] = RANDOM_SOURCE.nextLong();
        }
      }
    
      @Benchmark
      int log2(int reps) {
        int tmp = 0;
        for (int i = 0; i < reps; i++) {
          int j = i & ARRAY_MASK;
          tmp += LongMath.log2(positive[j], mode);
        }
        return tmp;
      }
    
      @Benchmark
      int log10(int reps) {
        int tmp = 0;
        for (int i = 0; i < reps; i++) {
    Registered: Fri Nov 01 12:43:10 UTC 2024
    - Last Modified: Mon Dec 04 17:37:03 UTC 2017
    - 2.6K bytes
    - Viewed (0)
  2. guava-tests/benchmark/com/google/common/math/IntMathRoundingBenchmark.java

        }
      }
    
      @Param({"DOWN", "UP", "FLOOR", "CEILING", "HALF_EVEN", "HALF_UP", "HALF_DOWN"})
      RoundingMode mode;
    
      @Benchmark
      int log2(int reps) {
        int tmp = 0;
        for (int i = 0; i < reps; i++) {
          int j = i & ARRAY_MASK;
          tmp += IntMath.log2(positive[j], mode);
        }
        return tmp;
      }
    
      @Benchmark
      int log10(int reps) {
        int tmp = 0;
        for (int i = 0; i < reps; i++) {
    Registered: Fri Nov 01 12:43:10 UTC 2024
    - Last Modified: Mon Dec 04 17:37:03 UTC 2017
    - 2.6K bytes
    - Viewed (0)
  3. android/guava-tests/test/com/google/common/math/IntMathTest.java

        }
      }
    
      public void testLog2NegativeAlwaysThrows() {
        for (int x : NEGATIVE_INTEGER_CANDIDATES) {
          for (RoundingMode mode : ALL_ROUNDING_MODES) {
            assertThrows(IllegalArgumentException.class, () -> IntMath.log2(x, mode));
          }
        }
      }
    
      // Relies on the correctness of BigIntegerMath.log2 for all modes except UNNECESSARY.
    Registered: Fri Nov 01 12:43:10 UTC 2024
    - Last Modified: Sat Oct 19 00:26:48 UTC 2024
    - 23.1K bytes
    - Viewed (0)
  4. guava-tests/test/com/google/common/math/IntMathTest.java

        }
      }
    
      public void testLog2NegativeAlwaysThrows() {
        for (int x : NEGATIVE_INTEGER_CANDIDATES) {
          for (RoundingMode mode : ALL_ROUNDING_MODES) {
            assertThrows(IllegalArgumentException.class, () -> IntMath.log2(x, mode));
          }
        }
      }
    
      // Relies on the correctness of BigIntegerMath.log2 for all modes except UNNECESSARY.
    Registered: Fri Nov 01 12:43:10 UTC 2024
    - Last Modified: Sat Oct 19 00:26:48 UTC 2024
    - 23.1K bytes
    - Viewed (0)
  5. android/guava-tests/benchmark/com/google/common/math/DoubleMathRoundingBenchmark.java

        }
        return tmp;
      }
    
      @Benchmark
      int log2Round(int reps) {
        int tmp = 0;
        for (int i = 0; i < reps; i++) {
          int j = i & ARRAY_MASK;
          tmp += DoubleMath.log2(positiveDoubles[j], mode);
        }
        return tmp;
      }
    Registered: Fri Nov 01 12:43:10 UTC 2024
    - Last Modified: Mon Dec 04 17:37:03 UTC 2017
    - 2.6K bytes
    - Viewed (0)
  6. guava-tests/test/com/google/common/math/LongMathTest.java

        }
      }
    
      public void testLog2NegativeAlwaysThrows() {
        for (long x : NEGATIVE_LONG_CANDIDATES) {
          for (RoundingMode mode : ALL_ROUNDING_MODES) {
            assertThrows(IllegalArgumentException.class, () -> LongMath.log2(x, mode));
          }
        }
      }
    
      /* Relies on the correctness of BigIntegerMath.log2 for all modes except UNNECESSARY. */
    Registered: Fri Nov 01 12:43:10 UTC 2024
    - Last Modified: Fri Oct 18 15:00:32 UTC 2024
    - 30.6K bytes
    - Viewed (0)
  7. android/guava-tests/benchmark/com/google/common/math/BigIntegerMathBenchmark.java

      @SuppressWarnings("UseCorrectAssertInTests") // TODO(b/345814817): Remove or convert assertion.
      private static BigInteger oldSlowFactorial(int n1, int n2) {
        assert n1 <= n2;
        if (IntMath.log2(n2, CEILING) * (n2 - n1) < Long.SIZE - 1) {
          // the result will definitely fit into a long
          long result = 1;
          for (int i = n1 + 1; i <= n2; i++) {
            result *= i;
          }
    Registered: Fri Nov 01 12:43:10 UTC 2024
    - Last Modified: Mon Aug 19 16:21:24 UTC 2024
    - 3.4K bytes
    - Viewed (0)
  8. guava-tests/benchmark/com/google/common/math/DoubleMathRoundingBenchmark.java

        }
        return tmp;
      }
    
      @Benchmark
      int log2Round(int reps) {
        int tmp = 0;
        for (int i = 0; i < reps; i++) {
          int j = i & ARRAY_MASK;
          tmp += DoubleMath.log2(positiveDoubles[j], mode);
        }
        return tmp;
      }
    Registered: Fri Nov 01 12:43:10 UTC 2024
    - Last Modified: Mon Dec 04 17:37:03 UTC 2017
    - 2.6K bytes
    - Viewed (0)
  9. android/guava/src/com/google/common/math/LongMath.java

         *
         * The key idea is that based on the number of leading zeros (equivalently, floor(log2(x))), we
         * can narrow the possible floor(log10(x)) values to two. For example, if floor(log2(x)) is 6,
         * then 64 <= x < 128, so floor(log10(x)) is either 1 or 2.
         */
        int y = maxLog10ForLeadingZeros[Long.numberOfLeadingZeros(x)];
        /*
    Registered: Fri Nov 01 12:43:10 UTC 2024
    - Last Modified: Wed Oct 09 16:39:37 UTC 2024
    - 45.2K bytes
    - Viewed (0)
  10. android/guava/src/com/google/common/math/DoubleUtils.java

        // This is an extremely fast implementation of BigInteger.doubleValue(). JDK patch pending.
        BigInteger absX = x.abs();
        int exponent = absX.bitLength() - 1;
        // exponent == floor(log2(abs(x)))
        if (exponent < Long.SIZE - 1) {
          return x.longValue();
        } else if (exponent > MAX_EXPONENT) {
          return x.signum() * POSITIVE_INFINITY;
        }
    
        /*
    Registered: Fri Nov 01 12:43:10 UTC 2024
    - Last Modified: Sat Oct 19 00:26:48 UTC 2024
    - 5.1K bytes
    - Viewed (0)
Back to top