- Sort Score
- Result 10 results
- Languages All
Results 21 - 30 of 1,262 for log2 (0.27 sec)
-
guava-tests/benchmark/com/google/common/math/DoubleMathBenchmark.java
doubles[i] = randomDouble(Long.SIZE); factorials[i] = RANDOM_SOURCE.nextInt(100); } } @Benchmark long log2(int reps) { long tmp = 0; for (int i = 0; i < reps; i++) { int j = i & ARRAY_MASK; tmp += Double.doubleToRawLongBits(DoubleMath.log2(positiveDoubles[j])); } return tmp; } @Benchmark long factorial(int reps) { long 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) -
android/guava-tests/benchmark/com/google/common/math/BigIntegerMathBenchmark.java
} } /** Returns the product of {@code n1} exclusive through {@code n2} inclusive. */ 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; }
Java - Registered: Fri May 03 12:43:13 GMT 2024 - Last Modified: Mon Dec 04 17:37:03 GMT 2017 - 3.3K bytes - Viewed (0) -
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)]; /*
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) -
guava-tests/benchmark/com/google/common/math/BigIntegerMathRoundingBenchmark.java
nonzero1[i] = randomNonZeroBigInteger(1024); nonzero2[i] = randomNonZeroBigInteger(1024); } } @Benchmark int log2(int reps) { int tmp = 0; for (int i = 0; i < reps; i++) { int j = i & ARRAY_MASK; tmp += BigIntegerMath.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: Tue Jun 30 13:06:20 GMT 2020 - 2.8K bytes - Viewed (0) -
guava-tests/test/com/google/common/math/IntMathTest.java
} } } } // Relies on the correctness of BigIntegerMath.log2 for all modes except UNNECESSARY. public void testLog2MatchesBigInteger() { for (int x : POSITIVE_INTEGER_CANDIDATES) { for (RoundingMode mode : ALL_SAFE_ROUNDING_MODES) { assertEquals(BigIntegerMath.log2(valueOf(x), mode), IntMath.log2(x, mode)); } } } // Relies on the correctness of isPowerOfTwo(int).
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) -
guava-tests/benchmark/com/google/common/math/DoubleMathRoundingBenchmark.java
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/collect/TopKSelectorTest.java
top.offer(1); for (int i = 1; i < n; i++) { top.offer(0); } assertThat(top.topK()).containsExactlyElementsIn(Collections.nCopies(k, 0)); assertThat(compareCalls[0]).isAtMost(10L * n * IntMath.log2(k, RoundingMode.CEILING)); } public void testExceedMaxIteration() { /* * Bug #5692 occurred when TopKSelector called Arrays.sort incorrectly. */
Java - Registered: Fri Apr 19 12:43:09 GMT 2024 - Last Modified: Thu Mar 07 18:34:03 GMT 2024 - 3.9K bytes - Viewed (0) -
guava-tests/benchmark/com/google/common/math/BigIntegerMathBenchmark.java
} } /** Returns the product of {@code n1} exclusive through {@code n2} inclusive. */ 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; }
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) -
android/guava-tests/test/com/google/common/collect/TopKSelectorTest.java
top.offer(1); for (int i = 1; i < n; i++) { top.offer(0); } assertThat(top.topK()).containsExactlyElementsIn(Collections.nCopies(k, 0)); assertThat(compareCalls[0]).isAtMost(10L * n * IntMath.log2(k, RoundingMode.CEILING)); } public void testExceedMaxIteration() { /* * Bug #5692 occurred when TopKSelector called Arrays.sort incorrectly. */
Java - Registered: Fri May 03 12:43:13 GMT 2024 - Last Modified: Thu Mar 07 18:34:03 GMT 2024 - 3.9K bytes - Viewed (0) -
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; } /*
Java - Registered: Fri Apr 26 12:43:10 GMT 2024 - Last Modified: Wed Apr 28 15:37:52 GMT 2021 - 5.1K bytes - Viewed (0)