Anonymous

Module:Shared: Difference between revisions

From Melvor Idle
added p.fractionpair
m (Formatting)
(added p.fractionpair)
Line 292: Line 292:
local gcd = p.gcd(n, d)
local gcd = p.gcd(n, d)
return p.formatnum(n/gcd)..'/'..p.formatnum(d/gcd)
return p.formatnum(n/gcd)..'/'..p.formatnum(d/gcd)
end
--Similar to p.fraction but returns the simplified numerator and denomerator separately without formatting
function p.fractionpair(n, d)
local gcd = p.gcd(n, d)
return n / gcd, d / gcd
end
end