Log in

View Full Version : lcm and gcd


jmac698
6th August 2011, 18:17
Quick utilities if you're ever searching for them (I was)

x=42
y=36
parms=str_bracket(string(x)+","+string(y))+"="
messageclip("lcm"+parms+string(lcm(x,y))+"; gcd"+parms+string(gcd(x,y)))

function gcd(int x, int y){
t = x%y
x = y
y = t
return (y>0)?gcd(x,y):x
}

function lcm(int x, int y){
y*abs(x)/gcd(x,y)
}

function str_bracket(string s){
"("+s+")"
}

Chikuzen
7th August 2011, 03:25
http://www.mediafire.com/download.php?ri8l69r3jho56z3

jmac698
7th August 2011, 05:51
And more timestrings... and gcd
http://users.telenet.be/darnley/avisynth/mine.html#timestrings