るりまサーチ (Ruby 2.3.0)

最速Rubyリファレンスマニュアル検索!
5件ヒット [1-5件を表示] (0.074秒)
トップページ > クラス:Numeric[x] > クエリ:_builtin[x] > クエリ:numeric[x] > バージョン:2.3.0[x] > クエリ:floor[x]

別のキーワード

  1. _builtin new
  2. _builtin inspect
  3. _builtin []
  4. _builtin to_s
  5. _builtin each

ライブラリ

キーワード

検索結果

Numeric#floor -> Integer (105433.0)

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

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


//emlist[例][ruby]{
1.floor #=> 1
1.2.floor #=> 1
(-1.2).floor #=> -2
(-1.5).floor #=> -2
//}

@see Numeric#ceil, Numeric#round, Numeric#truncate...

Numeric#ceil -> Integer (51076.0)

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

...自身と等しいかより大きな整数のうち最小のものを返します。

//emlist[例][ruby]{
1.ceil #=> 1
1.2.ceil #=> 2
(-1.2).ceil #=> -1
(-1.5).ceil #=> -1
//}

@see Numeric#floor, Numeric#round, Numeric#truncate...

Numeric#round -> Integer (51076.0)

自身ともっとも近い整数を返します。

...0.5, -0.5 はそれぞれ 1,-1 に切り上げされます。いわゆる四捨五入ですが、偶数丸めではありません。

//emlist[例][ruby]{
1.round #=> 1
1.2.round #=> 1
(-1.2).round #=> -1
(-1.5).round #=> -2
//}

@see Numeric#ceil, Numeric#floor, Numeric#truncate...

Numeric#truncate -> Integer (51076.0)

0 から 自身までの整数で、自身にもっとも近い整数を返します。

...0 から 自身までの整数で、自身にもっとも近い整数を返します。

//emlist[例][ruby]{
1.truncate #=> 1
1.2.truncate #=> 1
(-1.2).truncate #=> -1
(-1.5).truncate #=> -1
//}

@see Numeric#ceil, Numeric#floor, Numeric#round...

Numeric#div(other) -> Integer (51040.0)

self を other で割った整数の商 q を返します。

...> 0 のとき: 0 <= r < other
* other < 0 のとき: other < r <= 0
* q は整数
をみたす数です。
商に対応する余りは Numeric#modulo で求められます。
div はメソッド / を呼びだし、floorを取ることで計算されます。

メソッド / の定義は...

絞り込み条件を変える