Pixel-Composer/scripts/real_number_functions/real_number_functions.gml

17 lines
330 B
Plaintext
Raw Normal View History

2023-12-04 12:09:31 +01:00
function GCD(num1, num2) {
if(num1 * num2 == 0) return 1;
2023-12-04 12:09:31 +01:00
var n1 = max(num1, num2);
var n2 = min(num1, num2);
var nn = n1 % n2;
if(nn == 0) return n2;
return GCD(n2, nn);
2023-12-04 12:09:31 +01:00
}
function GCDs(num1, num2) {
if(num1 == num2) return 0;
if(num1 % num2 == 0) return num2;
if(num2 % num1 == 0) return num1;
return 0;
}