Home
last modified time | relevance | path

Searched refs:gcd (Results 1 – 25 of 117) sorted by relevance

12345

/external/python/cpython2/Lib/test/
Dtest_binop.py6 def gcd(a, b): function
44 g = gcd(den, num)
217 self.assertEqual(gcd(10, 12), 2)
218 self.assertEqual(gcd(10, 15), 5)
219 self.assertEqual(gcd(10, 11), 1)
220 self.assertEqual(gcd(100, 15), 5)
221 self.assertEqual(gcd(-10, 2), -2)
222 self.assertEqual(gcd(10, -2), 2)
223 self.assertEqual(gcd(-10, -2), -2)
226 self.assertTrue(gcd(i, j) > 0)
[all …]
Dtest_fractions.py14 gcd = fractions.gcd variable
60 g = gcd(num, den)
98 self.assertEqual(0, gcd(0, 0))
99 self.assertEqual(1, gcd(1, 0))
100 self.assertEqual(-1, gcd(-1, 0))
101 self.assertEqual(1, gcd(0, 1))
102 self.assertEqual(-1, gcd(0, -1))
103 self.assertEqual(1, gcd(7, 1))
104 self.assertEqual(-1, gcd(7, -1))
105 self.assertEqual(1, gcd(-23, 15))
[all …]
/external/mp4parser/isoparser/src/main/java/com/googlecode/mp4parser/util/
DMath.java4 public static long gcd(long a, long b) { in gcd() method in Math
13 public static int gcd(int a, int b) { in gcd() method in Math
23 return a * (b / gcd(a, b)); in lcm()
27 return a * (b / gcd(a, b)); in lcm()
/external/bouncycastle/bcprov/src/main/java/org/bouncycastle/crypto/generators/
DRSAKeyPairGenerator.java59 BigInteger p, q, n, d, e, pSub1, qSub1, gcd, lcm; in generateKeyPair() local
111 gcd = p; in generateKeyPair()
113 q = gcd; in generateKeyPair()
118 gcd = pSub1.gcd(qSub1); in generateKeyPair()
119 lcm = pSub1.divide(gcd).multiply(qSub1); in generateKeyPair()
180 if (!e.gcd(p.subtract(ONE)).equals(ONE)) in chooseRandomPrime()
/external/bouncycastle/repackaged/bcprov/src/main/java/com/android/org/bouncycastle/crypto/generators/
DRSAKeyPairGenerator.java61 BigInteger p, q, n, d, e, pSub1, qSub1, gcd, lcm; in generateKeyPair() local
113 gcd = p; in generateKeyPair()
115 q = gcd; in generateKeyPair()
120 gcd = pSub1.gcd(qSub1); in generateKeyPair()
121 lcm = pSub1.divide(gcd).multiply(qSub1); in generateKeyPair()
182 if (!e.gcd(p.subtract(ONE)).equals(ONE)) in chooseRandomPrime()
/external/python/cpython3/Lib/test/
Dtest_binop.py7 def gcd(a, b): function
45 g = gcd(den, num)
201 self.assertEqual(gcd(10, 12), 2)
202 self.assertEqual(gcd(10, 15), 5)
203 self.assertEqual(gcd(10, 11), 1)
204 self.assertEqual(gcd(100, 15), 5)
205 self.assertEqual(gcd(-10, 2), -2)
206 self.assertEqual(gcd(10, -2), 2)
207 self.assertEqual(gcd(-10, -2), -2)
210 self.assertTrue(gcd(i, j) > 0)
[all …]
Dtest_fractions.py15 gcd = fractions.gcd variable
53 g = math.gcd(num, den)
89 gcd(1, 1)
93 self.assertEqual(0, gcd(0, 0))
94 self.assertEqual(1, gcd(1, 0))
95 self.assertEqual(-1, gcd(-1, 0))
96 self.assertEqual(1, gcd(0, 1))
97 self.assertEqual(-1, gcd(0, -1))
98 self.assertEqual(1, gcd(7, 1))
99 self.assertEqual(-1, gcd(7, -1))
[all …]
Dtest_math.py697 gcd = math.gcd
698 self.assertEqual(gcd(0, 0), 0)
699 self.assertEqual(gcd(1, 0), 1)
700 self.assertEqual(gcd(-1, 0), 1)
701 self.assertEqual(gcd(0, 1), 1)
702 self.assertEqual(gcd(0, -1), 1)
703 self.assertEqual(gcd(7, 1), 1)
704 self.assertEqual(gcd(7, -1), 1)
705 self.assertEqual(gcd(-23, 15), 1)
706 self.assertEqual(gcd(120, 84), 12)
[all …]
/external/apache-commons-math/src/main/java/org/apache/commons/math/fraction/
DFraction.java270 final int d = MathUtils.gcd(num, den); in Fraction()
489 int d1 = MathUtils.gcd(denominator, fraction.denominator); in addSub()
510 int d2 = (tmodd1==0)?d1:MathUtils.gcd(tmodd1, d1); in addSub()
542 int d1 = MathUtils.gcd(numerator, fraction.denominator); in multiply()
543 int d2 = MathUtils.gcd(fraction.numerator, denominator); in multiply()
622 int gcd = MathUtils.gcd(numerator, denominator); in getReducedFraction() local
623 numerator /= gcd; in getReducedFraction()
624 denominator /= gcd; in getReducedFraction()
DBigFraction.java131 final BigInteger gcd = num.gcd(den); in BigFraction() local
132 if (BigInteger.ONE.compareTo(gcd) < 0) { in BigFraction()
133 num = num.divide(gcd); in BigFraction()
134 den = den.divide(gcd); in BigFraction()
1021 final BigInteger gcd = numerator.gcd(denominator); in reduce() local
1022 return new BigFraction(numerator.divide(gcd), denominator.divide(gcd)); in reduce()
/external/boringssl/src/crypto/fipsmodule/bn/
Dgcd_extra.c133 BIGNUM *gcd = BN_CTX_get(ctx); in bn_is_relatively_prime() local
134 if (gcd == NULL || in bn_is_relatively_prime()
135 !bn_gcd_consttime(gcd, &shift, x, y, ctx)) { in bn_is_relatively_prime()
140 if (gcd->width == 0) { in bn_is_relatively_prime()
143 BN_ULONG mask = shift | (gcd->d[0] ^ 1); in bn_is_relatively_prime()
144 for (int i = 1; i < gcd->width; i++) { in bn_is_relatively_prime()
145 mask |= gcd->d[i]; in bn_is_relatively_prime()
159 BIGNUM *gcd = BN_CTX_get(ctx); in bn_lcm_consttime() local
160 int ret = gcd != NULL && in bn_lcm_consttime()
162 bn_gcd_consttime(gcd, &shift, a, b, ctx) && in bn_lcm_consttime()
[all …]
/external/mp4parser/isoparser/src/main/java/com/googlecode/mp4parser/authoring/
DMovie.java79 timescale = gcd(track.getTrackMetaData().getTimescale(), timescale);
84 public static long gcd(long a, long b) {
88 return gcd(b, a % b);
/external/tensorflow/tensorflow/python/ops/signal/
Dutil_ops.py32 def gcd(a, b, name=None): function
65 math_gcd = fractions.gcd
67 math_gcd = math.gcd
/external/libvpx/libvpx/vpx_util/
Dvpx_timestamp.h24 static INLINE int gcd(int64_t a, int b) { in gcd() function
36 const int denom = gcd(ratio->num, ratio->den); in reduce_ratio()
/external/tensorflow/tensorflow/core/lib/math/
Dmath_util_test.cc206 unsigned int gcd; member
221 EXPECT_EQ(tc.gcd, MathUtil::GCD<uint32>(tc.x, tc.y)); in TEST()
222 EXPECT_EQ(tc.gcd, MathUtil::GCD<uint32>(tc.y, tc.x)); in TEST()
223 EXPECT_EQ(tc.gcd, MathUtil::GCD<uint64>(tc.x, tc.y)); in TEST()
224 EXPECT_EQ(tc.gcd, MathUtil::GCD<uint64>(tc.y, tc.x)); in TEST()
/external/libcxx/test/std/numerics/numeric.ops/numeric.ops.gcd/
Dgcd.pass.cpp45 static_assert(std::is_same_v<Output, decltype(std::gcd(value1, value2))>, ""); in test0()
46 static_assert(std::is_same_v<Output, decltype(std::gcd(value2, value1))>, ""); in test0()
47 assert(static_cast<Output>(out) == std::gcd(value1, value2)); in test0()
141 auto res = std::gcd(static_cast<std::int64_t>(1234), INT32_MIN); in main()
/external/guava/android/guava-tests/test/com/google/common/math/
DIntMathTest.java444 assertEquals(valueOf(a).gcd(valueOf(b)), valueOf(IntMath.gcd(a, b))); in testGCD()
451 assertEquals(a, IntMath.gcd(a, 0)); in testGCDZero()
452 assertEquals(a, IntMath.gcd(0, a)); in testGCDZero()
454 assertEquals(0, IntMath.gcd(0, 0)); in testGCDZero()
460 IntMath.gcd(a, 3); in testGCDNegativePositiveThrows()
465 IntMath.gcd(3, a); in testGCDNegativePositiveThrows()
475 IntMath.gcd(a, 0); in testGCDNegativeZeroThrows()
480 IntMath.gcd(0, a); in testGCDNegativeZeroThrows()
DLongMathTest.java521 assertEquals(valueOf(a).gcd(valueOf(b)), valueOf(LongMath.gcd(a, b))); in testGCDExhaustive()
529 assertEquals(a, LongMath.gcd(a, 0)); in testGCDZero()
530 assertEquals(a, LongMath.gcd(0, a)); in testGCDZero()
532 assertEquals(0, LongMath.gcd(0, 0)); in testGCDZero()
539 LongMath.gcd(a, 3); in testGCDNegativePositiveThrows()
544 LongMath.gcd(3, a); in testGCDNegativePositiveThrows()
555 LongMath.gcd(a, 0); in testGCDNegativeZeroThrows()
560 LongMath.gcd(0, a); in testGCDNegativeZeroThrows()
/external/guava/guava-tests/test/com/google/common/math/
DIntMathTest.java444 assertEquals(valueOf(a).gcd(valueOf(b)), valueOf(IntMath.gcd(a, b))); in testGCD()
451 assertEquals(a, IntMath.gcd(a, 0)); in testGCDZero()
452 assertEquals(a, IntMath.gcd(0, a)); in testGCDZero()
454 assertEquals(0, IntMath.gcd(0, 0)); in testGCDZero()
460 IntMath.gcd(a, 3); in testGCDNegativePositiveThrows()
465 IntMath.gcd(3, a); in testGCDNegativePositiveThrows()
475 IntMath.gcd(a, 0); in testGCDNegativeZeroThrows()
480 IntMath.gcd(0, a); in testGCDNegativeZeroThrows()
DLongMathTest.java521 assertEquals(valueOf(a).gcd(valueOf(b)), valueOf(LongMath.gcd(a, b))); in testGCDExhaustive()
529 assertEquals(a, LongMath.gcd(a, 0)); in testGCDZero()
530 assertEquals(a, LongMath.gcd(0, a)); in testGCDZero()
532 assertEquals(0, LongMath.gcd(0, 0)); in testGCDZero()
539 LongMath.gcd(a, 3); in testGCDNegativePositiveThrows()
544 LongMath.gcd(3, a); in testGCDNegativePositiveThrows()
555 LongMath.gcd(a, 0); in testGCDNegativeZeroThrows()
560 LongMath.gcd(0, a); in testGCDNegativeZeroThrows()
/external/python/rsa/rsa/
Dprime.py30 def gcd(p, q): function
185 d = gcd(a, b)
/external/python/cpython3/Doc/library/
Dfractions.rst175 .. function:: gcd(a, b)
178 *a* or *b* is nonzero, then the absolute value of ``gcd(a, b)`` is the
179 largest integer that divides both *a* and *b*. ``gcd(a,b)`` has the same
180 sign as *b* if *b* is nonzero; otherwise it takes the sign of *a*. ``gcd(0,
184 Use :func:`math.gcd` instead.
/external/compiler-rt/test/tsan/Darwin/
Dgcd-io-barrier-race.mm22 …irectory() stringByAppendingPathComponent:[NSString stringWithFormat:@"temp-gcd-io.%d", getpid()]];
54 // CHECK: Location is global 'my_global' {{(of size 8 )?}}at [[ADDR]] (gcd-io-barrier-race.mm.tmp+0…
Dgcd-io-race.mm24 …irectory() stringByAppendingPathComponent:[NSString stringWithFormat:@"temp-gcd-io.%d", getpid()]];
55 // CHECK: Location is global 'my_global' {{(of size 8 )?}}at [[ADDR]] (gcd-io-race.mm.tmp+0x{{[0-9,…
/external/python/cpython2/Doc/library/
Dfractions.rst129 .. function:: gcd(a, b)
132 *a* or *b* is nonzero, then the absolute value of ``gcd(a, b)`` is the
133 largest integer that divides both *a* and *b*. ``gcd(a,b)`` has the same
134 sign as *b* if *b* is nonzero; otherwise it takes the sign of *a*. ``gcd(0,

12345