We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 0e7addc + 0236af6 commit 779acacCopy full SHA for 779acac
src/utils/Utils.js
@@ -390,16 +390,20 @@ class Utils {
390
// Find the Greatest Common Divisor of two numbers
391
//
392
static getGCD(a, b, p = 7) {
393
- let big = Math.pow(10, p - Math.floor(Math.log10(Math.max(a, b))))
394
- a = Math.round(Math.abs(a) * big)
395
- b = Math.round(Math.abs(b) * big)
+ let factor = Math.pow(10, p - Math.floor(Math.log10(Math.max(a, b))))
+ if (factor > 1) {
+ a = Math.round(Math.abs(a) * factor)
396
+ b = Math.round(Math.abs(b) * factor)
397
+ } else {
398
+ factor = 1
399
+ }
400
401
while (b) {
402
let t = b
403
b = a % b
404
a = t
405
}
- return a / big
406
+ return a / factor
407
408
409
static getPrimeFactors(n) {
0 commit comments