Module:JI ratios: Difference between revisions
No edit summary |
No edit summary |
||
| Line 231: | Line 231: | ||
for j = i, #products do | for j = i, #products do | ||
local numerator = products[j] | local numerator = products[j] | ||
if numerator / denominator > equave_as_float then | |||
break | |||
end | |||
local gcd = utils._gcd(numerator, denominator) | local gcd = utils._gcd(numerator, denominator) | ||
local ratio = {numerator, denominator} | local ratio_already_added = false | ||
for k = 1, #ratios do | |||
ratio_already_added = ratio_already_added and ratios[k][1] == numerator and ratios[k][2] == denominator | |||
if ratio_already_added then | |||
break | |||
end | |||
end | |||
if not ratio_already_added then | |||
local ratio = { numerator, denominator } | |||
if p.ratio_within_search(ratio, equave, fine_search_args) then | if p.ratio_within_search(ratio, equave, fine_search_args) then | ||
table.insert(ratios, ratio) | table.insert(ratios, ratio) | ||
end | end | ||
end | end | ||
end | end | ||