- Sort Score
- Result 10 results
- Languages All
Results 1 - 10 of 1,254 for log2 (0.16 sec)
-
android/guava/src/com/google/common/math/BigIntegerMath.java
// Strip off 2s from this value. int shift = Long.numberOfTrailingZeros(product); product >>= shift; // Use floor(log2(num)) + 1 to prevent overflow of multiplication. int productBits = LongMath.log2(product, FLOOR) + 1; int bits = LongMath.log2(startingNumber, FLOOR) + 1; // Check for the next power of two boundary, to save us a CLZ operation. int nextPowerOfTwo = 1 << (bits - 1);
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) -
android/guava-tests/test/com/google/common/math/DoubleMathTest.java
int log2 = DoubleMath.log2(d, FLOOR); assertTrue(StrictMath.pow(2.0, log2) <= d); assertTrue(StrictMath.pow(2.0, log2 + 1) > d); } } @GwtIncompatible // DoubleMath.log2(double, RoundingMode), StrictMath public void testRoundLog2Ceiling() { for (double d : POSITIVE_FINITE_DOUBLE_CANDIDATES) { int log2 = DoubleMath.log2(d, CEILING);
Java - Registered: Fri Apr 26 12:43:10 GMT 2024 - Last Modified: Wed Feb 07 17:50:39 GMT 2024 - 28.1K bytes - Viewed (0) -
guava-tests/test/com/google/common/math/MathBenchmarking.java
return result; } /** * Generates a number in [0, 2^numBits) with an exponential distribution. The floor of the log2 of * the result is chosen uniformly at random in [0, numBits), and then the result is chosen in that * range uniformly at random. Zero is treated as having log2 == 0. */ static BigInteger randomNonNegativeBigInteger(int numBits) { int digits = RANDOM_SOURCE.nextInt(numBits);
Java - Registered: Fri Apr 12 12:43:09 GMT 2024 - Last Modified: Mon Dec 04 17:37:03 GMT 2017 - 4.1K bytes - Viewed (0) -
guava-tests/test/com/google/common/math/BigIntegerMathTest.java
} } // Relies on the correctness of log2(BigInteger, {HALF_UP,HALF_DOWN}). public void testLog2HalfEven() { for (BigInteger x : POSITIVE_BIGINTEGER_CANDIDATES) { int halfEven = BigIntegerMath.log2(x, HALF_EVEN); // Now figure out what rounding mode we should behave like (it depends if FLOOR was // odd/even). boolean floorWasEven = (BigIntegerMath.log2(x, FLOOR) & 1) == 0;
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) -
android/guava-tests/test/com/google/common/math/BigIntegerMathTest.java
} } // Relies on the correctness of log2(BigInteger, {HALF_UP,HALF_DOWN}). public void testLog2HalfEven() { for (BigInteger x : POSITIVE_BIGINTEGER_CANDIDATES) { int halfEven = BigIntegerMath.log2(x, HALF_EVEN); // Now figure out what rounding mode we should behave like (it depends if FLOOR was // odd/even). boolean floorWasEven = (BigIntegerMath.log2(x, FLOOR) & 1) == 0;
Java - Registered: Fri Apr 26 12:43:10 GMT 2024 - Last Modified: Wed Feb 07 17:50:39 GMT 2024 - 28.2K bytes - Viewed (0) -
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++) {
Java - Registered: Fri Apr 19 12:43:09 GMT 2024 - Last Modified: Mon Dec 04 17:37:03 GMT 2017 - 2.6K bytes - Viewed (0) -
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++) {
Java - Registered: Fri Apr 19 12:43:09 GMT 2024 - Last Modified: Mon Dec 04 17:37:03 GMT 2017 - 2.6K bytes - Viewed (0) -
guava-tests/test/com/google/common/math/DoubleMathTest.java
int log2 = DoubleMath.log2(d, FLOOR); assertTrue(StrictMath.pow(2.0, log2) <= d); assertTrue(StrictMath.pow(2.0, log2 + 1) > d); } } @GwtIncompatible // DoubleMath.log2(double, RoundingMode), StrictMath public void testRoundLog2Ceiling() { for (double d : POSITIVE_FINITE_DOUBLE_CANDIDATES) { int log2 = DoubleMath.log2(d, CEILING);
Java - Registered: Fri Apr 12 12:43:09 GMT 2024 - Last Modified: Wed Feb 07 17:50:39 GMT 2024 - 28.1K bytes - Viewed (0) -
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++) {
Java - Registered: Fri Apr 26 12:43:10 GMT 2024 - Last Modified: Mon Dec 04 17:37:03 GMT 2017 - 2.6K bytes - Viewed (0) -
android/guava/src/com/google/common/math/DoubleMath.java
* * <p>The computed result is within 1 ulp of the exact result. * * <p>If the result of this method will be immediately rounded to an {@code int}, {@link * #log2(double, RoundingMode)} is faster. */ public static double log2(double x) { return log(x) / LN_2; // surprisingly within 1 ulp according to tests } /** * Returns the base 2 logarithm of a double value, rounded with the specified rounding mode to an
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)