Maintenance Ruby 3.4 gets fixes, but no new features. Switch to Ruby 4.0 →
instance method
Numeric#floor
() -> ::Integer
(::Integer digits) -> ::Numeric
floor(ndigits = 0) → float or integer
numeric.c
View on GitHub ↗
static VALUE
num_floor(int argc, VALUE *argv, VALUE num)
{
return flo_floor(argc, argv, rb_Float(num));
}
Returns the largest float or integer that is less than or equal to self, as specified by the given ndigits, which must be an integer-convertible object.
Equivalent to self.to_f.floor(ndigits).
Related: ceil, Float#floor.