Module:Rational: Difference between revisions
m is_harmonic(), is_subharmonic() implemented |
mNo edit summary |
||
Line 444: | Line 444: | ||
-- determine whether a rational number represents a harmonic | -- determine whether a rational number represents a harmonic | ||
function p.is_harmonic(a, reduced) | function p.is_harmonic(a, reduced, large) | ||
if type(a) == 'number' then | if type(a) == 'number' then | ||
a = p.new(a) | a = p.new(a) | ||
Line 461: | Line 461: | ||
end | end | ||
if reduced then | if reduced then | ||
if p.lt(a, 1) or p.geq(a, 2) then | if large then | ||
-- an approximation | |||
local cents = p.cents(a) | |||
if cents < 0 or cents >= 1200 then | |||
return false | |||
end | |||
else | |||
if p.lt(a, 1) or p.geq(a, 2) then | |||
return false | |||
end | |||
end | end | ||
end | end |