Maintenance Ruby 3.4 gets fixes, but no new features. Switch to Ruby 4.0 →
instance method
Numeric#round
() -> ::Integer
(::Integer digits) -> ::Numeric
round(digits = 0) → 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 self rounded to the nearest value with a precision of digits decimal digits.
Numeric implements this by converting self to a Float and invoking Float#round.