Home
last modified time | relevance | path

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

1234

/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/bouncycastle/bcprov/src/main/java/org/bouncycastle/crypto/generators/
DRSAKeyPairGenerator.java58 BigInteger p, q, n, d, e, pSub1, qSub1, gcd, lcm; in generateKeyPair() local
110 gcd = p; in generateKeyPair()
112 q = gcd; in generateKeyPair()
117 gcd = pSub1.gcd(qSub1); in generateKeyPair()
118 lcm = pSub1.divide(gcd).multiply(qSub1); in generateKeyPair()
179 if (!e.gcd(p.subtract(ONE)).equals(ONE)) in chooseRandomPrime()
/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/guava/guava-gwt/test-super/com/google/common/math/super/com/google/common/math/
DIntMathTest.java196 assertEquals(valueOf(a).gcd(valueOf(b)), valueOf(IntMath.gcd(a, b))); in testGCD()
203 assertEquals(a, IntMath.gcd(a, 0)); in testGCDZero()
204 assertEquals(a, IntMath.gcd(0, a)); in testGCDZero()
206 assertEquals(0, IntMath.gcd(0, 0)); in testGCDZero()
212 IntMath.gcd(a, 3); in testGCDNegativePositiveThrows()
216 IntMath.gcd(3, a); in testGCDNegativePositiveThrows()
225 IntMath.gcd(a, 0); in testGCDNegativeZeroThrows()
229 IntMath.gcd(0, a); in testGCDNegativeZeroThrows()
DLongMathTest.java114 assertEquals(valueOf(a).gcd(valueOf(b)), valueOf(LongMath.gcd(a, b))); in testGCDExhaustive()
/external/python/cpython3/Lib/test/
Dtest_binop.py8 def gcd(a, b): function
46 g = gcd(den, num)
202 self.assertEqual(gcd(10, 12), 2)
203 self.assertEqual(gcd(10, 15), 5)
204 self.assertEqual(gcd(10, 11), 1)
205 self.assertEqual(gcd(100, 15), 5)
206 self.assertEqual(gcd(-10, 2), -2)
207 self.assertEqual(gcd(10, -2), 2)
208 self.assertEqual(gcd(-10, -2), -2)
211 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.py680 gcd = math.gcd
681 self.assertEqual(gcd(0, 0), 0)
682 self.assertEqual(gcd(1, 0), 1)
683 self.assertEqual(gcd(-1, 0), 1)
684 self.assertEqual(gcd(0, 1), 1)
685 self.assertEqual(gcd(0, -1), 1)
686 self.assertEqual(gcd(7, 1), 1)
687 self.assertEqual(gcd(7, -1), 1)
688 self.assertEqual(gcd(-23, 15), 1)
689 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/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/guava/guava-tests/test/com/google/common/math/
DIntMathTest.java363 assertEquals(valueOf(a).gcd(valueOf(b)), valueOf(IntMath.gcd(a, b))); in testGCD()
370 assertEquals(a, IntMath.gcd(a, 0)); in testGCDZero()
371 assertEquals(a, IntMath.gcd(0, a)); in testGCDZero()
373 assertEquals(0, IntMath.gcd(0, 0)); in testGCDZero()
379 IntMath.gcd(a, 3); in testGCDNegativePositiveThrows()
383 IntMath.gcd(3, a); in testGCDNegativePositiveThrows()
392 IntMath.gcd(a, 0); in testGCDNegativeZeroThrows()
396 IntMath.gcd(0, a); in testGCDNegativeZeroThrows()
DLongMathTest.java433 assertEquals(valueOf(a).gcd(valueOf(b)), valueOf(LongMath.gcd(a, b))); in testGCDExhaustive()
441 assertEquals(a, LongMath.gcd(a, 0)); in testGCDZero()
442 assertEquals(a, LongMath.gcd(0, a)); in testGCDZero()
444 assertEquals(0, LongMath.gcd(0, 0)); in testGCDZero()
451 LongMath.gcd(a, 3); in testGCDNegativePositiveThrows()
455 LongMath.gcd(3, a); in testGCDNegativePositiveThrows()
465 LongMath.gcd(a, 0); in testGCDNegativeZeroThrows()
469 LongMath.gcd(0, a); in testGCDNegativeZeroThrows()
/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/swiftshader/third_party/LLVM/test/CodeGen/X86/
D2011-01-24-DbgValue-Before-Use.ll18 define i64 @gcd(i64 %a, i64 %b) nounwind readnone optsize noinline ssp {
52 %call6 = tail call i64 @gcd(i64 %conv, i64 %conv5) optsize, !dbg !26
74 !llvm.dbg.lv.gcd = !{!10, !11, !12}
77 …!"gcd", metadata !"gcd", metadata !"", metadata !1, i32 5, metadata !3, i1 false, i1 true, i32 0, …
/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/tensorflow/tensorflow/contrib/signal/python/ops/
Dutil_ops.py30 def gcd(a, b, name=None): function
62 return ops.convert_to_tensor(fractions.gcd(const_a, const_b))
/external/python/cpython3/Doc/library/
Dfractions.rst168 .. function:: gcd(a, b)
171 *a* or *b* is nonzero, then the absolute value of ``gcd(a, b)`` is the
172 largest integer that divides both *a* and *b*. ``gcd(a,b)`` has the same
173 sign as *b* if *b* is nonzero; otherwise it takes the sign of *a*. ``gcd(0,
177 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,
/external/mesa3d/src/getopt/
Dgetopt_long.c81 static int gcd(int, int);
102 gcd(int a, int b) in gcd() function
133 ncycle = gcd(nnonopts, nopts); in permute_args()
/external/boringssl/src/crypto/fipsmodule/rsa/
Drsa.c634 BIGNUM n, pm1, qm1, lcm, gcd, de, dmp1, dmq1, iqmp_times_q; in RSA_check_key() local
669 BN_init(&gcd); in RSA_check_key()
680 !BN_gcd(&gcd, &pm1, &qm1, ctx)) { in RSA_check_key()
685 if (!BN_div(&lcm, NULL, &lcm, &gcd, ctx) || in RSA_check_key()
686 !BN_gcd(&gcd, &pm1, &qm1, ctx) || in RSA_check_key()
737 BN_free(&gcd); in RSA_check_key()
/external/guava/guava-gwt/src-super/com/google/common/math/super/com/google/common/math/
DLongMath.java126 public static long gcd(long a, long b) { in gcd() method in LongMath
270 long commonDivisor = gcd(x, denominator); in multiplyFraction()

1234