Module:Rational: Difference between revisions
Document this mess, starting with the first function |
Two of the functions are not working properly, mark with todo |
||
Line 553: | Line 553: | ||
-- determine whether a rational number represents a harmonic | -- determine whether a rational number represents a harmonic | ||
-- TODO: rework. doesn't correctly check reduced harmonics. | |||
function p.is_harmonic(a, reduced, large) | function p.is_harmonic(a, reduced, large) | ||
if type(a) == "number" then | if type(a) == "number" then | ||
Line 567: | Line 568: | ||
end | end | ||
end | end | ||
if reduced then | if reduced then -- for reduced harmonics, a false will have been returned before reaching here | ||
return p.is_reduced(a, 2, large) | return p.is_reduced(a, 2, large) | ||
end | end | ||
Line 574: | Line 575: | ||
-- determine whether a rational number represents a subharmonic | -- determine whether a rational number represents a subharmonic | ||
-- TODO: rework. doesn't correctly check reduced subharmonics. | |||
function p.is_subharmonic(a, reduced, large) | function p.is_subharmonic(a, reduced, large) | ||
if type(a) == "number" then | if type(a) == "number" then | ||
Line 588: | Line 590: | ||
end | end | ||
end | end | ||
if reduced then | if reduced then -- for reduced subharmonics, a false will have been returned before reaching here | ||
return p.is_reduced(a, 2, large) | return p.is_reduced(a, 2, large) | ||
end | end |