round(p1 = v1, p2 = {})
public
Returns int rounded to the nearest value with a precision of ndigits decimal digits (default: 0).
When the precision is negative, the returned value is an integer with at least ndigits.abs trailing zeros.
Returns self when ndigits is zero or positive.
1.round #=> 1 1.round(2) #=> 1 15.round(-1) #=> 20 (-15).round(-1) #=> -20
The optional half keyword argument is available similar to Float#round.
25.round(-1, half: :up) #=> 30 25.round(-1, half: :down) #=> 20 25.round(-1, half: :even) #=> 20 35.round(-1, half: :up) #=> 40 35.round(-1, half: :down) #=> 30 35.round(-1, half: :even) #=> 40 (-25).round(-1, half: :up) #=> -30 (-25).round(-1, half: :down) #=> -20 (-25).round(-1, half: :even) #=> -20