- Sort Score
- Result 10 results
- Languages All
Results 1 - 9 of 9 for isPowerOfTwo (0.23 sec)
-
android/guava-tests/test/com/google/common/math/DoubleMathTest.java
for (double x : POSITIVE_FINITE_DOUBLE_CANDIDATES) { boolean isPowerOfTwo = StrictMath.pow(2.0, DoubleMath.log2(x, FLOOR)) == x; try { int log2 = DoubleMath.log2(x, UNNECESSARY); assertThat(Math.scalb(1.0, log2)).isEqualTo(x); assertTrue(isPowerOfTwo); } catch (ArithmeticException e) { assertFalse(isPowerOfTwo); } } }
Registered: Fri Nov 01 12:43:10 UTC 2024 - Last Modified: Fri Oct 18 15:00:32 UTC 2024 - 27.3K bytes - Viewed (0) -
android/guava-tests/benchmark/com/google/common/math/DoubleMathBenchmark.java
if (DoubleMath.isMathematicalInteger(doubles[j])) { tmp++; } } return tmp; } @Benchmark int isPowerOfTwo(int reps) { int tmp = 0; for (int i = 0; i < reps; i++) { int j = i & ARRAY_MASK; if (DoubleMath.isPowerOfTwo(doubles[j])) { tmp++; } } return tmp; }
Registered: Fri Nov 01 12:43:10 UTC 2024 - Last Modified: Mon Dec 04 17:37:03 UTC 2017 - 2.5K bytes - Viewed (0) -
guava-tests/test/com/google/common/math/DoubleMathTest.java
for (double x : POSITIVE_FINITE_DOUBLE_CANDIDATES) { boolean isPowerOfTwo = StrictMath.pow(2.0, DoubleMath.log2(x, FLOOR)) == x; try { int log2 = DoubleMath.log2(x, UNNECESSARY); assertThat(Math.scalb(1.0, log2)).isEqualTo(x); assertTrue(isPowerOfTwo); } catch (ArithmeticException e) { assertFalse(isPowerOfTwo); } } }
Registered: Fri Nov 01 12:43:10 UTC 2024 - Last Modified: Fri Oct 18 15:00:32 UTC 2024 - 27.3K bytes - Viewed (0) -
android/guava-tests/test/com/google/common/math/IntMathTest.java
@GwtCompatible(emulated = true) public class IntMathTest extends TestCase { public void testMaxSignedPowerOfTwo() { assertTrue(IntMath.isPowerOfTwo(IntMath.MAX_SIGNED_POWER_OF_TWO)); // Extra work required to make GWT happy. long value = IntMath.MAX_SIGNED_POWER_OF_TWO * 2L; assertFalse(IntMath.isPowerOfTwo((int) value)); } public void testCeilingPowerOfTwo() { for (int x : POSITIVE_INTEGER_CANDIDATES) {
Registered: Fri Nov 01 12:43:10 UTC 2024 - Last Modified: Sat Oct 19 00:26:48 UTC 2024 - 23.1K bytes - Viewed (0) -
guava-tests/test/com/google/common/math/IntMathTest.java
@GwtCompatible(emulated = true) public class IntMathTest extends TestCase { public void testMaxSignedPowerOfTwo() { assertTrue(IntMath.isPowerOfTwo(IntMath.MAX_SIGNED_POWER_OF_TWO)); // Extra work required to make GWT happy. long value = IntMath.MAX_SIGNED_POWER_OF_TWO * 2L; assertFalse(IntMath.isPowerOfTwo((int) value)); } public void testCeilingPowerOfTwo() { for (int x : POSITIVE_INTEGER_CANDIDATES) {
Registered: Fri Nov 01 12:43:10 UTC 2024 - Last Modified: Sat Oct 19 00:26:48 UTC 2024 - 23.1K bytes - Viewed (0) -
guava-tests/test/com/google/common/math/LongMathTest.java
@GwtCompatible(emulated = true) public class LongMathTest extends TestCase { @SuppressWarnings("ConstantOverflow") public void testMaxSignedPowerOfTwo() { assertTrue(LongMath.isPowerOfTwo(LongMath.MAX_SIGNED_POWER_OF_TWO)); assertFalse(LongMath.isPowerOfTwo(LongMath.MAX_SIGNED_POWER_OF_TWO * 2)); } public void testCeilingPowerOfTwo() { for (long x : POSITIVE_LONG_CANDIDATES) {
Registered: Fri Nov 01 12:43:10 UTC 2024 - Last Modified: Fri Oct 18 15:00:32 UTC 2024 - 30.6K bytes - Viewed (0) -
guava/src/com/google/common/math/BigIntegerMath.java
int logFloor = x.bitLength() - 1; switch (mode) { case UNNECESSARY: checkRoundingUnnecessary(isPowerOfTwo(x)); // fall through case DOWN: case FLOOR: return logFloor; case UP: case CEILING: return isPowerOfTwo(x) ? logFloor : logFloor + 1; case HALF_DOWN: case HALF_UP: case HALF_EVEN:
Registered: Fri Nov 01 12:43:10 UTC 2024 - Last Modified: Wed Oct 16 17:21:56 UTC 2024 - 18.8K bytes - Viewed (0) -
android/guava/src/com/google/common/math/LongMath.java
*/ // Whenever both tests are cheap and functional, it's faster to use &, | instead of &&, || @SuppressWarnings("ShortCircuitBoolean") public static boolean isPowerOfTwo(long x) { return x > 0 & (x & (x - 1)) == 0; } /** * Returns 1 if {@code x < y} as unsigned longs, and 0 otherwise. Assumes that x - y fits into a
Registered: Fri Nov 01 12:43:10 UTC 2024 - Last Modified: Wed Oct 09 16:39:37 UTC 2024 - 45.2K bytes - Viewed (0) -
guava/src/com/google/common/math/LongMath.java
*/ // Whenever both tests are cheap and functional, it's faster to use &, | instead of &&, || @SuppressWarnings("ShortCircuitBoolean") public static boolean isPowerOfTwo(long x) { return x > 0 & (x & (x - 1)) == 0; } /** * Returns 1 if {@code x < y} as unsigned longs, and 0 otherwise. Assumes that x - y fits into a
Registered: Fri Nov 01 12:43:10 UTC 2024 - Last Modified: Wed Oct 09 16:39:37 UTC 2024 - 45.2K bytes - Viewed (0)