- Sort Score
- Result 10 results
- Languages All
Results 1 - 10 of 167 for divide (0.1 sec)
-
android/guava-tests/test/com/google/common/math/IntMathTest.java
} boolean dividesEvenly = (p % q) == 0; try { assertEquals(p + "/" + q, p, IntMath.divide(p, q, UNNECESSARY) * q); assertTrue(p + "/" + q + " not expected to divide evenly", dividesEvenly); } catch (ArithmeticException e) { assertFalse(p + "/" + q + " expected to divide evenly", dividesEvenly); } } } } public void testZeroDivIsAlwaysZero() {
Registered: Fri Nov 01 12:43:10 UTC 2024 - Last Modified: Sat Oct 19 00:26:48 UTC 2024 - 23.1K bytes - Viewed (0) -
guava-tests/test/com/google/common/math/LongMathTest.java
long expected = new BigDecimal(valueOf(p)).divide(new BigDecimal(valueOf(q)), 0, mode).longValue(); long actual = LongMath.divide(p, q, mode); if (expected != actual) { failFormat("expected divide(%s, %s, %s) = %s; got %s", p, q, mode, expected, actual); } } } } } @GwtIncompatible // TODO
Registered: Fri Nov 01 12:43:10 UTC 2024 - Last Modified: Fri Oct 18 15:00:32 UTC 2024 - 30.6K bytes - Viewed (0) -
guava-tests/test/com/google/common/math/IntMathTest.java
} boolean dividesEvenly = (p % q) == 0; try { assertEquals(p + "/" + q, p, IntMath.divide(p, q, UNNECESSARY) * q); assertTrue(p + "/" + q + " not expected to divide evenly", dividesEvenly); } catch (ArithmeticException e) { assertFalse(p + "/" + q + " expected to divide evenly", dividesEvenly); } } } } public void testZeroDivIsAlwaysZero() {
Registered: Fri Nov 01 12:43:10 UTC 2024 - Last Modified: Sat Oct 19 00:26:48 UTC 2024 - 23.1K bytes - Viewed (0) -
guava/src/com/google/common/math/BigIntegerMath.java
*/ sqrt0 = sqrtApproxWithDoubles(x.shiftRight(shift)).shiftLeft(shift >> 1); } BigInteger sqrt1 = sqrt0.add(x.divide(sqrt0)).shiftRight(1); if (sqrt0.equals(sqrt1)) { return sqrt0; } do { sqrt0 = sqrt1; sqrt1 = sqrt0.add(x.divide(sqrt0)).shiftRight(1); } while (sqrt1.compareTo(sqrt0) < 0); return sqrt0; } @GwtIncompatible // TODO
Registered: Fri Nov 01 12:43:10 UTC 2024 - Last Modified: Wed Oct 16 17:21:56 UTC 2024 - 18.8K bytes - Viewed (0) -
android/guava/src/com/google/common/primitives/UnsignedLongs.java
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 } else { return 1; // dividend >= divisor } } // Optimization - use signed division if dividend < 2^63 if (dividend >= 0) { return dividend / divisor; } /*
Registered: Fri Nov 01 12:43:10 UTC 2024 - Last Modified: Mon Aug 12 21:04:48 UTC 2024 - 17.6K bytes - Viewed (0) -
android/guava-tests/test/com/google/common/primitives/UnsignedIntsTest.java
Random r = new Random(0L); for (int i = 0; i < 1000000; i++) { int dividend = r.nextInt(); int divisor = r.nextInt(); // Test that the Euclidean property is preserved: assertThat( dividend - (divisor * UnsignedInts.divide(dividend, divisor) + UnsignedInts.remainder(dividend, divisor))) .isEqualTo(0); } }
Registered: Fri Nov 01 12:43:10 UTC 2024 - Last Modified: Sat Oct 19 02:56:12 UTC 2024 - 12.5K bytes - Viewed (0) -
android/guava-tests/benchmark/com/google/common/math/BigIntegerMathBenchmark.java
result *= i; } return BigInteger.valueOf(result); } /* * We want each multiplication to have both sides with approximately the same number of digits. * Currently, we just divide the range in half. */ int mid = (n1 + n2) >>> 1; return oldSlowFactorial(n1, mid).multiply(oldSlowFactorial(mid, n2)); } @Benchmark int slowFactorial(int reps) { int tmp = 0;
Registered: Fri Nov 01 12:43:10 UTC 2024 - Last Modified: Mon Aug 19 16:21:24 UTC 2024 - 3.4K bytes - Viewed (0) -
guava-tests/benchmark/com/google/common/math/BigIntegerMathBenchmark.java
result *= i; } return BigInteger.valueOf(result); } /* * We want each multiplication to have both sides with approximately the same number of digits. * Currently, we just divide the range in half. */ int mid = (n1 + n2) >>> 1; return oldSlowFactorial(n1, mid).multiply(oldSlowFactorial(mid, n2)); } @Benchmark int slowFactorial(int reps) { int tmp = 0;
Registered: Fri Nov 01 12:43:10 UTC 2024 - Last Modified: Mon Aug 19 16:21:24 UTC 2024 - 3.4K bytes - Viewed (0) -
android/guava/src/com/google/common/math/LongMath.java
a >>= aTwos; // divide out all 2s int bTwos = Long.numberOfTrailingZeros(b); b >>= bTwos; // divide out all 2s while (a != b) { // both a, b are odd // The key to the binary GCD algorithm is as follows: // Both a and b are odd. Assume a > b; then gcd(a - b, b) = gcd(a, b). // But in gcd(a - b, b), a - b is even and b is odd, so we can divide out powers of two.
Registered: Fri Nov 01 12:43:10 UTC 2024 - Last Modified: Wed Oct 09 16:39:37 UTC 2024 - 45.2K bytes - Viewed (0) -
guava/src/com/google/common/math/LongMath.java
a >>= aTwos; // divide out all 2s int bTwos = Long.numberOfTrailingZeros(b); b >>= bTwos; // divide out all 2s while (a != b) { // both a, b are odd // The key to the binary GCD algorithm is as follows: // Both a and b are odd. Assume a > b; then gcd(a - b, b) = gcd(a, b). // But in gcd(a - b, b), a - b is even and b is odd, so we can divide out powers of two.
Registered: Fri Nov 01 12:43:10 UTC 2024 - Last Modified: Wed Oct 09 16:39:37 UTC 2024 - 45.2K bytes - Viewed (0)