pub fn round(x: number, ndigits: option<number>) -> numberAvailable on crate feature
extended only.Expand description
Rounds a number to the nearest integer, halves away from zero.
Extended library — feature extended (from extended.lua).
§Parameters
ndigits: round to this many decimal places instead; the result is then a float.
§Examples
print(math.round(2.5)) --> 3
print(math.round(-2.5)) --> -3
print(math.round(2.4)) --> 2
print(math.round(3.14159, 2)) --> 3.14