Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 16 for checkedMultiply (0.26 sec)

  1. android/guava-tests/benchmark/com/google/common/math/ApacheBenchmark.java

            try {
              int unused = IntMath.checkedMultiply(a, b);
              return true;
            } catch (ArithmeticException e) {
              return false;
            }
          }
    
          @Override
          public boolean noMulOverflow(long a, long b) {
            try {
              long unused = LongMath.checkedMultiply(a, b);
              return true;
            } catch (ArithmeticException e) {
    Registered: Wed Jun 12 16:38:11 UTC 2024
    - Last Modified: Mon Dec 04 17:37:03 UTC 2017
    - 6.9K bytes
    - Viewed (0)
  2. guava/src/com/google/common/math/LongMath.java

         */
        if (leadingZeros > Long.SIZE + 1) {
          return a * b;
        }
        checkNoOverflow(leadingZeros >= Long.SIZE, "checkedMultiply", a, b);
        checkNoOverflow(a >= 0 | b != Long.MIN_VALUE, "checkedMultiply", a, b);
        long result = a * b;
        checkNoOverflow(a == 0 || result / a == b, "checkedMultiply", a, b);
        return result;
      }
    
      /**
    Registered: Wed Jun 12 16:38:11 UTC 2024
    - Last Modified: Wed Feb 07 17:50:39 UTC 2024
    - 44.6K bytes
    - Viewed (0)
  3. android/guava/src/com/google/common/math/LongMath.java

         */
        if (leadingZeros > Long.SIZE + 1) {
          return a * b;
        }
        checkNoOverflow(leadingZeros >= Long.SIZE, "checkedMultiply", a, b);
        checkNoOverflow(a >= 0 | b != Long.MIN_VALUE, "checkedMultiply", a, b);
        long result = a * b;
        checkNoOverflow(a == 0 || result / a == b, "checkedMultiply", a, b);
        return result;
      }
    
      /**
    Registered: Wed Jun 12 16:38:11 UTC 2024
    - Last Modified: Wed Feb 07 17:50:39 UTC 2024
    - 44.6K bytes
    - Viewed (0)
  4. android/guava/src/com/google/common/collect/CartesianList.java

        this.axes = axes;
        int[] axesSizeProduct = new int[axes.size() + 1];
        axesSizeProduct[axes.size()] = 1;
        try {
          for (int i = axes.size() - 1; i >= 0; i--) {
            axesSizeProduct[i] = IntMath.checkedMultiply(axesSizeProduct[i + 1], axes.get(i).size());
          }
        } catch (ArithmeticException e) {
          throw new IllegalArgumentException(
              "Cartesian product too large; must have size at most Integer.MAX_VALUE");
    Registered: Wed Jun 12 16:38:11 UTC 2024
    - Last Modified: Thu Nov 30 21:54:06 UTC 2023
    - 4.8K bytes
    - Viewed (0)
  5. android/guava/src/com/google/common/math/IntMath.java

       *
       * @throws ArithmeticException if {@code a * b} overflows in signed {@code int} arithmetic
       */
      public static int checkedMultiply(int a, int b) {
        long result = (long) a * b;
        checkNoOverflow(result == (int) result, "checkedMultiply", a, b);
        return (int) result;
      }
    
      /**
       * Returns the {@code b} to the {@code k}th power, provided it does not overflow.
       *
    Registered: Wed Jun 12 16:38:11 UTC 2024
    - Last Modified: Wed Feb 07 17:50:39 UTC 2024
    - 23.5K bytes
    - Viewed (0)
  6. guava/src/com/google/common/math/IntMath.java

       *
       * @throws ArithmeticException if {@code a * b} overflows in signed {@code int} arithmetic
       */
      public static int checkedMultiply(int a, int b) {
        long result = (long) a * b;
        checkNoOverflow(result == (int) result, "checkedMultiply", a, b);
        return (int) result;
      }
    
      /**
       * Returns the {@code b} to the {@code k}th power, provided it does not overflow.
       *
    Registered: Wed Jun 12 16:38:11 UTC 2024
    - Last Modified: Wed Feb 07 17:50:39 UTC 2024
    - 23.5K bytes
    - Viewed (0)
  7. guava/src/com/google/common/collect/CartesianList.java

        this.axes = axes;
        int[] axesSizeProduct = new int[axes.size() + 1];
        axesSizeProduct[axes.size()] = 1;
        try {
          for (int i = axes.size() - 1; i >= 0; i--) {
            axesSizeProduct[i] = IntMath.checkedMultiply(axesSizeProduct[i + 1], axes.get(i).size());
          }
        } catch (ArithmeticException e) {
          throw new IllegalArgumentException(
              "Cartesian product too large; must have size at most Integer.MAX_VALUE");
    Registered: Wed Jun 12 16:38:11 UTC 2024
    - Last Modified: Thu Nov 30 21:54:06 UTC 2023
    - 4.8K bytes
    - Viewed (0)
  8. android/guava-tests/test/com/google/common/math/LongMathTest.java

            boolean expectedSuccess = fitsInLong(expectedResult);
            try {
              assertEquals(a * b, LongMath.checkedMultiply(a, b));
              assertTrue(expectedSuccess);
            } catch (ArithmeticException e) {
              if (expectedSuccess) {
                failFormat(
                    "expected checkedMultiply(%s, %s) = %s; got ArithmeticException",
                    a, b, expectedResult);
              }
            }
          }
    Registered: Wed Jun 12 16:38:11 UTC 2024
    - Last Modified: Mon Mar 04 20:15:57 UTC 2024
    - 32.5K bytes
    - Viewed (0)
  9. guava-tests/test/com/google/common/math/LongMathTest.java

            boolean expectedSuccess = fitsInLong(expectedResult);
            try {
              assertEquals(a * b, LongMath.checkedMultiply(a, b));
              assertTrue(expectedSuccess);
            } catch (ArithmeticException e) {
              if (expectedSuccess) {
                failFormat(
                    "expected checkedMultiply(%s, %s) = %s; got ArithmeticException",
                    a, b, expectedResult);
              }
            }
          }
    Registered: Wed Jun 12 16:38:11 UTC 2024
    - Last Modified: Mon Mar 04 20:15:57 UTC 2024
    - 32.5K bytes
    - Viewed (0)
  10. guava/src/com/google/common/collect/TopKSelector.java

        this.k = k;
        checkArgument(k >= 0, "k (%s) must be >= 0", k);
        checkArgument(k <= Integer.MAX_VALUE / 2, "k (%s) must be <= Integer.MAX_VALUE / 2", k);
        this.buffer = (T[]) new Object[IntMath.checkedMultiply(k, 2)];
        this.bufferSize = 0;
        this.threshold = null;
      }
    
      /**
       * Adds {@code elem} as a candidate for the top {@code k} elements. This operation takes amortized
       * O(1) time.
       */
    Registered: Wed Jun 12 16:38:11 UTC 2024
    - Last Modified: Mon Apr 01 16:15:01 UTC 2024
    - 11.2K bytes
    - Viewed (0)
Back to top