4,951
edits
Falterfire (talk | contribs) (Added GCD function) |
Falterfire (talk | contribs) (Added a fraction function) |
||
Line 289: | Line 289: | ||
end | end | ||
end | end | ||
end | |||
--Formats a pair of numbers as a reduced fraction | |||
function p.fraction(n, d) | |||
local gcd = p.gcd(n, d) | |||
return p.formatnum(n/gcd)..'/'..p.formatnum(d/gcd) | |||
end | end | ||
return p | return p |