Module:Harmonic entropy: Difference between revisions
Started a module to work with interval-related math, has a to_cents function for now. |
Bug fixing |
||
| Line 11: | Line 11: | ||
function p._to_cents(ratio, prec) | function p._to_cents(ratio, prec) | ||
-- ratio defaults to 1 | -- ratio defaults to 1 | ||
ratio = u.eval_num_arg( | ratio = u.eval_num_arg(ratio, 1) | ||
-- output without rounding if prec is omitted | -- output without rounding if prec is omitted | ||
if prec then | if prec then | ||
| Line 18: | Line 18: | ||
else | else | ||
-- prec defaults to 3 | -- prec defaults to 3 | ||
prec = u.eval_num_arg( | prec = u.eval_num_arg(prec, 3) | ||
return 1200*u._log(ratio) | return 1200*u._log(ratio) | ||
end | end | ||