Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 3 of 3 for checkedPow (0.08 sec)

  1. guava/src/com/google/common/math/LongMath.java

      public static long checkedPow(long b, int k) {
        checkNonNegative("exponent", k);
        if (b >= -2 & b <= 2) {
          switch ((int) b) {
            case 0:
              return (k == 0) ? 1 : 0;
            case 1:
              return 1;
            case -1:
              return ((k & 1) == 0) ? 1 : -1;
            case 2:
              checkNoOverflow(k < Long.SIZE - 1, "checkedPow", b, k);
              return 1L << k;
    Registered: Fri Sep 05 12:43:10 UTC 2025
    - Last Modified: Fri Aug 29 16:20:07 UTC 2025
    - 46.8K bytes
    - Viewed (0)
  2. guava-tests/test/com/google/common/math/LongMathTest.java

      @GwtIncompatible // TODO
      public void testConstantsPowersOf10() {
        for (int i = 0; i < LongMath.powersOf10.length; i++) {
          assertEquals(LongMath.checkedPow(10, i), LongMath.powersOf10[i]);
        }
        assertThrows(
            ArithmeticException.class, () -> LongMath.checkedPow(10, LongMath.powersOf10.length));
      }
    
      @GwtIncompatible // TODO
      public void testConstantsHalfPowersOf10() {
    Registered: Fri Sep 05 12:43:10 UTC 2025
    - Last Modified: Mon Aug 11 19:31:30 UTC 2025
    - 31.4K bytes
    - Viewed (0)
  3. android/guava-tests/test/com/google/common/math/IntMathTest.java

            BigInteger expectedResult = valueOf(b).pow(k);
            boolean expectedSuccess = fitsInInt(expectedResult);
            try {
              assertEquals(b + "^" + k, force32(expectedResult.intValue()), IntMath.checkedPow(b, k));
              assertTrue(b + "^" + k + " should have succeeded", expectedSuccess);
            } catch (ArithmeticException e) {
              assertFalse(b + "^" + k + " should have failed", expectedSuccess);
            }
    Registered: Fri Sep 05 12:43:10 UTC 2025
    - Last Modified: Mon Aug 11 19:31:30 UTC 2025
    - 24.1K bytes
    - Viewed (0)
Back to top