Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 12 for isPowerOfTwo (0.26 sec)

  1. 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);
            assertEquals(x, Math.scalb(1.0, log2));
            assertTrue(isPowerOfTwo);
          } catch (ArithmeticException e) {
            assertFalse(isPowerOfTwo);
          }
        }
      }
    
    Java
    - Registered: Fri May 03 12:43:13 GMT 2024
    - Last Modified: Wed Feb 07 17:50:39 GMT 2024
    - 28.1K bytes
    - Viewed (0)
  2. 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);
            assertEquals(x, Math.scalb(1.0, log2));
            assertTrue(isPowerOfTwo);
          } catch (ArithmeticException e) {
            assertFalse(isPowerOfTwo);
          }
        }
      }
    
    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)
  3. 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) {
    Java
    - Registered: Fri May 03 12:43:13 GMT 2024
    - Last Modified: Wed Feb 07 17:50:39 GMT 2024
    - 24.5K bytes
    - Viewed (0)
  4. android/guava/src/com/google/common/math/DoubleMath.java

            checkRoundingUnnecessary(isPowerOfTwo(x));
            // fall through
          case FLOOR:
            increment = false;
            break;
          case CEILING:
            increment = !isPowerOfTwo(x);
            break;
          case DOWN:
            increment = exponent < 0 & !isPowerOfTwo(x);
            break;
          case UP:
            increment = exponent >= 0 & !isPowerOfTwo(x);
            break;
          case HALF_DOWN:
    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)
  5. 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) {
    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)
  6. android/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) {
    Java
    - Registered: Fri May 03 12:43:13 GMT 2024
    - Last Modified: Mon Mar 04 20:15:57 GMT 2024
    - 32.5K bytes
    - Viewed (0)
  7. 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) {
    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)
  8. guava-tests/test/com/google/common/math/BigIntegerMathTest.java

          assertTrue(BigIntegerMath.isPowerOfTwo(result));
          assertTrue(result.compareTo(x) >= 0);
          assertTrue(result.compareTo(x.add(x)) < 0);
        }
      }
    
      public void testFloorPowerOfTwo() {
        for (BigInteger x : POSITIVE_BIGINTEGER_CANDIDATES) {
          BigInteger result = BigIntegerMath.floorPowerOfTwo(x);
          assertTrue(BigIntegerMath.isPowerOfTwo(result));
          assertTrue(result.compareTo(x) <= 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)
  9. android/guava-tests/test/com/google/common/math/BigIntegerMathTest.java

          assertTrue(BigIntegerMath.isPowerOfTwo(result));
          assertTrue(result.compareTo(x) >= 0);
          assertTrue(result.compareTo(x.add(x)) < 0);
        }
      }
    
      public void testFloorPowerOfTwo() {
        for (BigInteger x : POSITIVE_BIGINTEGER_CANDIDATES) {
          BigInteger result = BigIntegerMath.floorPowerOfTwo(x);
          assertTrue(BigIntegerMath.isPowerOfTwo(result));
          assertTrue(result.compareTo(x) <= 0);
    Java
    - Registered: Fri May 03 12:43:13 GMT 2024
    - Last Modified: Wed Feb 07 17:50:39 GMT 2024
    - 28.2K bytes
    - Viewed (0)
  10. android/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:
    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)
Back to top