Module:Infobox ET: Difference between revisions

Plumtree (talk | contribs)
Consistency limits added
Plumtree (talk | contribs)
m Fifth ratio simplification
Line 17: Line 17:
local step_size = i._backslash_ratio('1\\' .. tuning)
local step_size = i._backslash_ratio('1\\' .. tuning)
local fifth = math.floor(math.log(1.5)/math.log(rat.as_float(equave))*size+0.5)
local fifth = math.floor(math.log(1.5)/math.log(rat.as_float(equave))*size+0.5)
local fifth_ratio = rat.new(fifth, size)
if rat.as_table(fifth_ratio)[1] ~= fifth then
fifth_ratio = ' (→' .. rat.as_ratio(fifth_ratio, '\\') .. ')'
else
fifth_ratio = ''
end
return '<div style="\n' ..
return '<div style="\n' ..
'border: 1px solid #999;\n' ..
'border: 1px solid #999;\n' ..
Line 37: Line 43:
'|-\n' ..
'|-\n' ..
'| style="text-align:right; padding-right: 0.25em" | Fifth\n' ..
'| style="text-align:right; padding-right: 0.25em" | Fifth\n' ..
'| style="background-color: white; padding-left: 0.25em; font-weight: bold" | ' .. string.format("%d", fifth) .. '\\' .. tuning .. ' (' .. i._to_cents(i._backslash_ratio(fifth .. '\\' .. tuning), 6) .. '¢)\n' ..
'| style="background-color: white; padding-left: 0.25em; font-weight: bold" | ' .. string.format("%d", fifth) .. '\\' .. tuning .. ' (' .. i._to_cents(i._backslash_ratio(fifth .. '\\' .. tuning), 6) .. '¢)' .. fifth_ratio .. '\n' ..
'|-\n' ..
'|-\n' ..
'| style="text-align:right; padding-right: 0.25em" | Consistency limit\n' ..
'| style="text-align:right; padding-right: 0.25em" | Consistency limit\n' ..