Skip to content

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

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.

See also #finite? #i #fdiv #imag also in 4.1 · 4.0 · 3.3 · 3.2 · 3.1 · 3.0