Module:Rational: Difference between revisions
Fix Weil height |
No edit summary |
||
Line 2: | Line 2: | ||
local u = require('Module:Utils') | local u = require('Module:Utils') | ||
local p = {} | local p = {} | ||
-- find the gcd of two integers | |||
function gcd(x, y) | |||
if x < y then | |||
x, y = y, x | |||
end | |||
while y > 0 do | |||
x, y = y, x % y | |||
end | |||
return x | |||
end | |||
-- construct a rational number n/m | -- construct a rational number n/m |