Module:Interval table: Difference between revisions

CompactStar (talk | contribs)
No edit summary
CompactStar (talk | contribs)
No edit summary
Line 6: Line 6:
local ET = require('Module:ET')
local ET = require('Module:ET')


-- Create list of ratios up to a max numerator & denominator, and max ratio size
-- Generates list of ratios up to a max numerator & denominator, and max ratio size  
local function get_ratios_list(max_nd, max_size)
local function get_ratios_list(max_nd, max_size)
local ratios = {}
local ratios = {}
Line 68: Line 68:
local n = ratios_list[j][1]
local n = ratios_list[j][1]
local d = ratios_list[j][2]
local d = ratios_list[j][2]
-- Show all ratios within 1/3 of ET size in approximate ratios
-- In approximate ratios column, show all ratios in the list that are within 1/3 of ET size (33.3 relative cents)
if math.abs(et.size - u._cents(n/d)) <= (et.size/3) then
if math.abs(et.size - math.log(n * d)/math.log(1200)) <= (400 / et.size) then
wikitext = wikitext .. '[[' .. n .. '/' .. d .. ']]' .. ', '
wikitext = wikitext .. '[[' .. n .. '/' .. d .. ']]' .. ', '
end
end