Module:Utils: Difference between revisions

Plumtree (talk | contribs)
prime_factorization_raw() added for use in other modules
Plumtree (talk | contribs)
Moving signum() to Module:Utils
Line 117: Line 117:
end
end
return table.concat(powers, " × ")
return table.concat(powers, " × ")
end
-- returns signum(x); cannot be used with {{#invoke:}}
function p.signum(x)
if type(x) ~= 'number' then
return 0
end
if x > 0 then return 1 end
if x < 0 then return -1 end
return 0
end
end


return p
return p