Module:Harmonics in equal: Difference between revisions
+link to relative cent |
Contribution (talk | contribs) evaluate boolean arguments, local reduction |
||
| Line 87: | Line 87: | ||
end | end | ||
return result | return result | ||
end | |||
-- evaluate boolean arguments | |||
local function eval_bool_arg(input, def_value) | |||
if type(input) == 'string' then | |||
input = input:match("^%s*(.-)%s*$"):lower() | |||
if input == 'true' then | |||
return true | |||
elseif input == 'false' then | |||
return false | |||
end | |||
end | |||
return def_value | |||
end | end | ||
| Line 146: | Line 159: | ||
-- optional precision for abs error, default about 3 digits | -- optional precision for abs error, default about 3 digits | ||
local prec = eval_num_arg(frame.args['prec'], prec_by_equal(steps, num, denom)) | local prec = eval_num_arg(frame.args['prec'], prec_by_equal(steps, num, denom)) | ||
local reduction = true | local reduction = eval_bool_arg(frame.args['reduction'], true) | ||
if steps == 1 then | if steps == 1 then | ||
reduction = false | reduction = false | ||