Module:TemplateMath
Documentation for this module may be created at Module:TemplateMath/doc
local p = {}
function p.doOp(frame)
local n = 1
local op1 = frame.args[1]
local op = frame.args[2]
local op2 = frame.args[3]
if op == "+" then
n = op1 + op2
elseif op == "-" then
n = op1 - op2
elseif op == "*" then
n = op1 * op2
elseif op == "/" then
n = op1 / op2
elseif op == "^" then
n = op1 ^ op2
elseif op == 'r' then
n = op2 ^ (1 / op1)
elseif op == "l" then
n = math.log(op1) / math.log(op2)
else
n = "?"
end
return n
end
return p