Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 11 for ArithmeticException (0.07 sec)

  1. guava-tests/test/com/google/common/math/LongMathTest.java

            // unless all n are fair game with this k
            assertThrows(
                ArithmeticException.class,
                () -> simpleBinomial(LongMath.biggestSimpleBinomials[k] + 1, k));
          }
        }
        int k = LongMath.biggestSimpleBinomials.length;
        assertThrows(ArithmeticException.class, () -> simpleBinomial(2 * k, k));
      }
    
      @AndroidIncompatible // slow
    Registered: Fri Sep 05 12:43:10 UTC 2025
    - Last Modified: Mon Aug 11 19:31:30 UTC 2025
    - 31.4K bytes
    - Viewed (0)
  2. android/guava-tests/test/com/google/common/math/IntMathTest.java

        for (int x : POSITIVE_INTEGER_CANDIDATES) {
          for (int m : NEGATIVE_INTEGER_CANDIDATES) {
            assertThrows(ArithmeticException.class, () -> IntMath.mod(x, m));
          }
        }
      }
    
      public void testModZeroModulusFails() {
        for (int x : ALL_INTEGER_CANDIDATES) {
          assertThrows(ArithmeticException.class, () -> IntMath.mod(x, 0));
        }
      }
    
      public void testGCD() {
    Registered: Fri Sep 05 12:43:10 UTC 2025
    - Last Modified: Mon Aug 11 19:31:30 UTC 2025
    - 24.1K bytes
    - Viewed (0)
  3. guava/src/com/google/common/math/LongMath.java

       *
       * @throws IllegalArgumentException if {@code x <= 0}
       * @throws ArithmeticException of the next-higher power of two is not representable as a {@code
       *     long}, i.e. when {@code x > 2^62}
       * @since 20.0
       */
      public static long ceilingPowerOfTwo(long x) {
        checkPositive("x", x);
        if (x > MAX_SIGNED_POWER_OF_TWO) {
          throw new ArithmeticException("ceilingPowerOfTwo(" + x + ") is not representable as a long");
        }
    Registered: Fri Sep 05 12:43:10 UTC 2025
    - Last Modified: Fri Aug 29 16:20:07 UTC 2025
    - 46.8K bytes
    - Viewed (0)
  4. android/guava-tests/test/com/google/common/math/DoubleMathTest.java

            assertTrue(isInBounds);
          } catch (ArithmeticException e) {
            assertFalse(isInBounds);
          }
        }
      }
    
      @GwtIncompatible // DoubleMath.roundToInt(double, RoundingMode)
      public void testRoundExactFractionalDoubleToIntFails() {
        for (double d : FRACTIONAL_DOUBLE_CANDIDATES) {
          assertThrows(ArithmeticException.class, () -> DoubleMath.roundToInt(d, UNNECESSARY));
        }
      }
    
    Registered: Fri Sep 05 12:43:10 UTC 2025
    - Last Modified: Thu Aug 07 16:05:33 UTC 2025
    - 27.3K bytes
    - Viewed (0)
  5. guava/src/com/google/common/math/BigIntegerMath.java

      }
    
      /**
       * Returns the base-2 logarithm of {@code x}, rounded according to the specified rounding mode.
       *
       * @throws IllegalArgumentException if {@code x <= 0}
       * @throws ArithmeticException if {@code mode} is {@link RoundingMode#UNNECESSARY} and {@code x}
       *     is not a power of two
       */
      @SuppressWarnings("fallthrough")
      // TODO(kevinb): remove after this warning is disabled globally
    Registered: Fri Sep 05 12:43:10 UTC 2025
    - Last Modified: Thu Aug 07 16:05:33 UTC 2025
    - 18.8K bytes
    - Viewed (0)
  6. guava-tests/test/com/google/common/math/BigIntegerMathTest.java

          boolean isPowerOf2 = BigIntegerMath.isPowerOfTwo(x);
          try {
            assertEquals(x, ZERO.setBit(BigIntegerMath.log2(x, UNNECESSARY)));
            assertTrue(isPowerOf2);
          } catch (ArithmeticException e) {
            assertFalse(isPowerOf2);
          }
        }
      }
    
      public void testLog2HalfUp() {
        for (BigInteger x : POSITIVE_BIGINTEGER_CANDIDATES) {
          int result = BigIntegerMath.log2(x, HALF_UP);
    Registered: Fri Sep 05 12:43:10 UTC 2025
    - Last Modified: Thu Aug 07 16:05:33 UTC 2025
    - 27K bytes
    - Viewed (0)
  7. android/guava-tests/test/com/google/common/math/BigDecimalMathTest.java

            assertWithMessage("Expected roundUnnecessaryShouldThrow call")
                .that(unnecessaryShouldThrow)
                .isTrue();
            assertThrows(
                "Expected ArithmeticException for roundToDouble(" + input + ", UNNECESSARY)",
                ArithmeticException.class,
                () -> BigDecimalMath.roundToDouble(input, UNNECESSARY));
          }
        }
      }
    
      public void testRoundToDouble_zero() {
    Registered: Fri Sep 05 12:43:10 UTC 2025
    - Last Modified: Mon Jul 14 14:44:08 UTC 2025
    - 10.9K bytes
    - Viewed (0)
  8. android/guava/src/com/google/common/primitives/UnsignedLongs.java

       *
       * <p><b>Java 8+ users:</b> use {@link Long#divideUnsigned(long, long)} instead.
       *
       * @param dividend the dividend (numerator)
       * @param divisor the divisor (denominator)
       * @throws ArithmeticException if divisor is 0
       */
      public static long divide(long dividend, long divisor) {
        if (divisor < 0) { // i.e., divisor >= 2^63:
          if (compare(dividend, divisor) < 0) {
            return 0; // dividend < divisor
    Registered: Fri Sep 05 12:43:10 UTC 2025
    - Last Modified: Mon Aug 11 19:31:30 UTC 2025
    - 17.8K bytes
    - Viewed (0)
  9. android/guava/src/com/google/common/primitives/UnsignedInts.java

       *
       * <p><b>Java 8+ users:</b> use {@link Integer#divideUnsigned(int, int)} instead.
       *
       * @param dividend the dividend (numerator)
       * @param divisor the divisor (denominator)
       * @throws ArithmeticException if divisor is 0
       */
      public static int divide(int dividend, int divisor) {
        return (int) (toLong(dividend) / toLong(divisor));
      }
    
      /**
    Registered: Fri Sep 05 12:43:10 UTC 2025
    - Last Modified: Sun Feb 09 16:22:33 UTC 2025
    - 13.8K bytes
    - Viewed (0)
  10. guava-tests/test/com/google/common/util/concurrent/MoreExecutorsTest.java

        List<Callable<Integer>> l = new ArrayList<>();
        l.add(
            new Callable<Integer>() {
              @Override
              public Integer call() {
                throw new ArithmeticException("/ by zero");
              }
            });
        l.add(null);
        try {
          invokeAnyImpl(e, l, false, 0, NANOSECONDS);
          fail();
        } catch (NullPointerException success) {
        } finally {
    Registered: Fri Sep 05 12:43:10 UTC 2025
    - Last Modified: Tue May 13 18:46:00 UTC 2025
    - 28K bytes
    - Viewed (0)
Back to top