You are currently viewing the gmlscripts.pro static mirror. Forum access and script submissions are not available through this mirror.

Invert gmlscripts.pro

gcd

gcd(a,b)
Returns the greatest common divisor of the given integers.
COPY/// gcd(a,b)
//
//  Returns the greatest common divisor of the given integers.
//
//      a,b         non-negative integers, real
//
/// gmlscripts.pro/license
{
    var a,b,r;
    a = max(argument0,argument1);
    b = min(argument0,argument1);
    while (b != 0) {
        r = a mod b;
        a = b;
        b = r;
    }
    return a;
}

Contributors: xot

GitHub: View · Commits · Blame · Raw