Module:Harmonics in cet: Difference between revisions
Contribution (talk | contribs) No edit summary |
ArrowHead294 (talk | contribs) No edit summary |
||
| Line 3: | Line 3: | ||
local function approx(step, intervals, title, prec) | local function approx(step, intervals, title, prec) | ||
local tpri = {'! colspan="2" | Harmonic '} | local tpri = {'! colspan="2" | Harmonic '} | ||
local tabs = {'! rowspan="2" | Error \n! | local tabs = {'! rowspan="2" | Error \n! Absolute ([[cent|¢]]) '} | ||
local trel = {'! [[Relative interval error| | local trel = {'! [[Relative interval error|Relative]] (%) '} | ||
local tdeg = {'! colspan="2" | Steps'} | local tdeg = {'! colspan="2" | Steps'} | ||
| Line 15: | Line 15: | ||
v = s/size | v = s/size | ||
ev = math.floor(v + .5) | ev = math.floor(v + .5) | ||
table.insert(tpri, | table.insert(tpri, "" .. p) | ||
table.insert(tabs, string.format(fmt_abs, 1200 * (ev - v)*size)) | table.insert(tabs, "" .. string.gsub(string.format(fmt_abs, 1200 * (ev - v)*size), "%-", "−")) | ||
table.insert(trel, string.format(fmt_rel, 100 * (ev - v))) | table.insert(trel, "" .. string.gsub(string.format(fmt_rel, 100 * (ev - v)), "%-", "−")) | ||
table.insert(tdeg, | table.insert(tdeg, "" .. ev) | ||
end | end | ||
local titleMarkup = '' | local titleMarkup = '' | ||
if title then | if title then | ||
titleMarkup = '|-\n|+ ' .. title .. '\n' | titleMarkup = '|-\n|+ style="font-size: 110%;" | ' .. title .. '\n' | ||
end | end | ||
| Line 34: | Line 34: | ||
table.concat(trel, '\n|') .. '\n' .. | table.concat(trel, '\n|') .. '\n' .. | ||
'|-\n' .. | '|-\n' .. | ||
table.concat(tdeg, '\n|') .. '\n' .. | |||
'|}' | '|}' | ||
end | end | ||