Module:Harmonic entropy: Difference between revisions

Bug fixing
Round to 3 decimal places by default ("no rounding" can be achieved by using prec ≥ 12)
Line 12: Line 12:
-- ratio defaults to 1
-- ratio defaults to 1
ratio = u.eval_num_arg(ratio, 1)
ratio = u.eval_num_arg(ratio, 1)
-- output without rounding if prec is omitted
-- prec defaults to 3
if prec then
prec = u.eval_num_arg(prec, 3)
return u._round(1200*u._log(ratio), prec)
return u._round(1200*u._log(ratio), prec)
-- output with rounding if prec is given
else
-- prec defaults to 3
prec = u.eval_num_arg(prec, 3)
return 1200*u._log(ratio)
end
end
end


return p
return p