Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 25 for Gcd (0.23 sec)

  1. src/cmd/go/testdata/script/cover_swig.txt

    /* Compute the greatest common divisor of positive integers */
    int gcd(int x, int y) {
      int g;
      g = y;
      while (x > 0) {
        g = x;
        x = y % x;
        y = g;
      }
      return g;
    }
    
    
    -- main.go --
    package main
    
    import (
    	"fmt"
    )
    
    func main() {
    	// Call our gcd() function
    	x := 42
    	y := 105
    	g := Gcd(x, y)
    	fmt.Println("The gcd of", x, "and", y, "is", g)
    
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri Jan 05 21:29:51 UTC 2024
    - 1.1K bytes
    - Viewed (0)
  2. src/math/big/int_test.go

    	}
    	var Y *Int
    	if y != nil {
    		Y = new(Int)
    	}
    
    	D := new(Int).GCD(X, Y, a, b)
    	if D.Cmp(d) != 0 {
    		t.Errorf("GCD(%s, %s, %s, %s): got d = %s, want %s", x, y, a, b, D, d)
    	}
    	if x != nil && X.Cmp(x) != 0 {
    		t.Errorf("GCD(%s, %s, %s, %s): got x = %s, want %s", x, y, a, b, X, x)
    	}
    	if y != nil && Y.Cmp(y) != 0 {
    		t.Errorf("GCD(%s, %s, %s, %s): got y = %s, want %s", x, y, a, b, Y, y)
    	}
    
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu May 23 18:42:28 UTC 2024
    - 58.5K bytes
    - Viewed (0)
  3. android/guava/src/com/google/common/math/IntMath.java

        int bTwos = Integer.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.
    
          // We bend over backwards to avoid branching, adapting a technique from
    Registered: Wed Jun 12 16:38:11 UTC 2024
    - Last Modified: Wed Feb 07 17:50:39 UTC 2024
    - 23.5K bytes
    - Viewed (0)
  4. android/guava-tests/test/com/google/common/math/IntMathTest.java

          for (int b : POSITIVE_INTEGER_CANDIDATES) {
            assertEquals(valueOf(a).gcd(valueOf(b)), valueOf(IntMath.gcd(a, b)));
          }
        }
      }
    
      public void testGCDZero() {
        for (int a : POSITIVE_INTEGER_CANDIDATES) {
          assertEquals(a, IntMath.gcd(a, 0));
          assertEquals(a, IntMath.gcd(0, a));
        }
        assertEquals(0, IntMath.gcd(0, 0));
      }
    
      public void testGCDNegativePositiveThrows() {
    Registered: Wed Jun 12 16:38:11 UTC 2024
    - Last Modified: Wed Feb 07 17:50:39 UTC 2024
    - 24.5K bytes
    - Viewed (0)
  5. docs/distributed/DESIGN.md

    1024 drives. In this scenario 16 becomes the erasure set size. This is decided based on the greatest common divisor (GCD) of acceptable erasure set sizes ranging from *4 to 16*.
    
    - *If total drives has many common divisors the algorithm chooses the minimum amounts of erasure sets possible for a erasure set size of any N*.  In the example with 1024 drives - 4, 8, 16 are GCD factors. With 16 drives we get a total of 64 possible sets, with 8 drives we get a total of 128 possible sets, with 4...
    Registered: Sun Jun 16 00:44:34 UTC 2024
    - Last Modified: Tue Aug 15 23:04:20 UTC 2023
    - 8K bytes
    - Viewed (0)
  6. android/guava-tests/test/com/google/common/math/LongMathTest.java

            assertEquals(valueOf(a).gcd(valueOf(b)), valueOf(LongMath.gcd(a, b)));
          }
        }
      }
    
      @GwtIncompatible // TODO
      public void testGCDZero() {
        for (long a : POSITIVE_LONG_CANDIDATES) {
          assertEquals(a, LongMath.gcd(a, 0));
          assertEquals(a, LongMath.gcd(0, a));
        }
        assertEquals(0, LongMath.gcd(0, 0));
      }
    
      @GwtIncompatible // TODO
    Registered: Wed Jun 12 16:38:11 UTC 2024
    - Last Modified: Mon Mar 04 20:15:57 UTC 2024
    - 32.5K bytes
    - Viewed (0)
  7. guava/src/com/google/common/math/IntMath.java

        int bTwos = Integer.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.
    
          // We bend over backwards to avoid branching, adapting a technique from
    Registered: Wed Jun 12 16:38:11 UTC 2024
    - Last Modified: Wed Feb 07 17:50:39 UTC 2024
    - 23.5K bytes
    - Viewed (0)
  8. guava-tests/test/com/google/common/math/LongMathTest.java

            assertEquals(valueOf(a).gcd(valueOf(b)), valueOf(LongMath.gcd(a, b)));
          }
        }
      }
    
      @GwtIncompatible // TODO
      public void testGCDZero() {
        for (long a : POSITIVE_LONG_CANDIDATES) {
          assertEquals(a, LongMath.gcd(a, 0));
          assertEquals(a, LongMath.gcd(0, a));
        }
        assertEquals(0, LongMath.gcd(0, 0));
      }
    
      @GwtIncompatible // TODO
    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. android/guava/src/com/google/common/math/LongMath.java

        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.
    
          // We bend over backwards to avoid branching, adapting a technique from
    Registered: Wed Jun 12 16:38:11 UTC 2024
    - Last Modified: Wed Feb 07 17:50:39 UTC 2024
    - 44.6K bytes
    - Viewed (0)
  10. guava/src/com/google/common/math/LongMath.java

        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.
    
          // We bend over backwards to avoid branching, adapting a technique from
    Registered: Wed Jun 12 16:38:11 UTC 2024
    - Last Modified: Wed Feb 07 17:50:39 UTC 2024
    - 44.6K bytes
    - Viewed (0)
Back to top