Module:Utils: Difference between revisions

Plumtree (talk | contribs)
Moving signum() to Module:Utils
Plumtree (talk | contribs)
round(): %g -> %f - the former uses exponential notation when it's shorter than floating point representation; it's undesirable
Line 47: Line 47:
-- prec defaults to 6
-- prec defaults to 6
prec = p.eval_num_arg(prec, 6)
prec = p.eval_num_arg(prec, 6)
return string.format(string.format("%%.%dg", prec), x)
return string.format(string.format("%%.%df", prec), x)
end
end