るりまサーチ (Ruby 2.1.0)

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

別のキーワード

  1. numeric step
  2. _builtin numeric
  3. numeric round
  4. numeric to_c
  5. numeric divmod

ライブラリ

クラス

キーワード

検索結果

Numeric#truncate -> Integer (81373.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

Integer#round(ndigits = 0, half: :up) -> Integer | Float (54874.0)

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

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

@param ndigits 10進数での小数点以下の有効桁数を整数で指定します。
正の整数を指定した場合、Float を返します。
小数点以下を、最大 n 桁にします。
負の整数を指定した場合、Integer を返します。
小数点位置から左に少なくとも n 個の 0 が並びます。
@param half ちょうど半分の値の丸め方を指定します。
サポートされている値は以下の通りです。

* :up or nil: ...

Float#truncate -> Integer (18373.0)

小数点以下を切り捨てて値を整数に変換します。

小数点以下を切り捨てて値を整数に変換します。


//emlist[例][ruby]{
2.8.truncate # => 2
(-2.8).truncate # => -2
//}

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

Float#to_i -> Integer (9073.0)

小数点以下を切り捨てて値を整数に変換します。

小数点以下を切り捨てて値を整数に変換します。


//emlist[例][ruby]{
2.8.truncate # => 2
(-2.8).truncate # => -2
//}

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

Float#floor -> Integer (9055.0)

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

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


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

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

絞り込み条件を変える