Ruby 4.0 リファレンスマニュアル

instance method Numeric#floor

floor(ndigits = 0) -> Integer | Float[permalink][rdoc][edit]
() → Integer
(Integer digits) → Numeric

self と等しいかより小さな整数のうち最大のものを返します。

self を to_f で Float に変換してから Float#floor を呼び出すのと同じです。

Complex では未定義化されています。

[PARAM] ndigits:
10進数での小数点以下の有効桁数を整数で指定します。負の整数を指定した場合、小数点位置から左に少なくとも n 個の 0 が並びます。
例
p 1.floor      # => 1
p 1.2.floor    # => 1
p (-1.2).floor # => -2
p (-1.5).floor # => -2

p 1.234567.floor(2)   # => 1.23
p 34567.89.floor(-2)  # => 34500

[SEE_ALSO] Numeric#ceil, Numeric#round, Numeric#truncate

[SEE_ALSO] Integer#floor