Module:Q-odd-limit intervals: Difference between revisions

Restore some strings we used to use
use utils.table_contains and utils.value_provided where possible
Line 7: Line 7:


local PRIME_LIST = {2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31}
local PRIME_LIST = {2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31}
local function is_in(v, t)
for i = 1, #t do
if v == t[i] then
return true
end
end
return false
end


local function table_filter(t, thres)
local function table_filter(t, thres)
Line 144: Line 135:
error_abs_direct = string.format("%.3f", ead)
error_abs_direct = string.format("%.3f", ead)
error_rel_direct = string.format("%.1f", erd)
error_rel_direct = string.format("%.1f", erd)
if bit32.band(error_list[i].ratio.den, error_list[i].ratio.den - 1) == 0 and is_in(error_list[i].ratio.num, subgroup) then -- check power of 2 for den and prime for num
if bit32.band(error_list[i].ratio.den, error_list[i].ratio.den - 1) == 0 and utils.table_contains(subgroup, error_list[i].ratio.num) then -- check power of 2 for den and prime for num
ratiocomp = "'''" .. ratiocomp .. "'''"
ratiocomp = "'''" .. ratiocomp .. "'''"
error_abs_val = "'''" .. error_abs_val .. "'''"
error_abs_val = "'''" .. error_abs_val .. "'''"
Line 224: Line 215:
local apx = string.lower(frame.args["apx"]:gsub("%s+", ""))
local apx = string.lower(frame.args["apx"]:gsub("%s+", ""))
if title == nil or #title == 0 then
if not utils.value_provided (title) then
title = string.format("%d-odd-limit intervals in " .. steps .. "edo", limit)
title = string.format("%d-odd-limit intervals in " .. steps .. "edo", limit)
end
end