- Sort Score
- Result 10 results
- Languages All
Results 1 - 10 of 13 for ArithmeticException (0.47 sec)
-
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) -
src/main/java/jcifs/util/InputValidator.java
* @param operation the operation name * @throws ArithmeticException if operation would overflow */ public static void validateIntegerAddition(int a, int b, String operation) { long result = (long) a + (long) b; if (result > Integer.MAX_VALUE || result < Integer.MIN_VALUE) { throw new ArithmeticException(operation + " would cause integer overflow: " + a + " + " + b); } }
Registered: Sun Sep 07 00:10:21 UTC 2025 - Last Modified: Sat Aug 30 05:58:03 UTC 2025 - 13.5K bytes - Viewed (0) -
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) -
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) -
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) -
src/test/java/jcifs/util/InputValidatorTest.java
assertEquals(100, InputValidator.safeAdd(50, 50)); assertEquals(0, InputValidator.safeAdd(-50, 50)); assertThrows(ArithmeticException.class, () -> InputValidator.safeAdd(Integer.MAX_VALUE, 1)); assertThrows(ArithmeticException.class, () -> InputValidator.safeAdd(Integer.MIN_VALUE, -1)); } @Test @DisplayName("Test safe integer multiplication")
Registered: Sun Sep 07 00:10:21 UTC 2025 - Last Modified: Sat Aug 30 05:58:03 UTC 2025 - 11.9K bytes - Viewed (0) -
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) -
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) -
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) -
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)