End of Life Ruby 3.0 has reached end of life and gets no more fixes. Switch to Ruby 4.0 →
instance method
Numeric#round
num.round([ndigits]) → integer or float
numeric.c
View on GitHub ↗
static VALUE
num_round(int argc, VALUE* argv, VALUE num)
{
return flo_round(argc, argv, rb_Float(num));
}
Returns num rounded to the nearest value with a precision of ndigits decimal digits (default: 0).
Numeric implements this by converting its value to a Float and invoking Float#round.