るりまサーチ (Ruby 2.6.0)

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

別のキーワード

  1. bigdecimal round
  2. _builtin round
  3. matrix round
  4. bigdecimal round_up
  5. bigdecimal round_mode

ライブラリ

キーワード

検索結果

Float#round(ndigits = 0) -> Integer | Float (54634.0)

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

...d(-2) # => 93600
t.round(-3) # => 94000
t.round(-100) # => 0

2.5.round(half: :up) # => 3
2.5.round(half: :even) # => 2
2.5.round(half: :down) # => 2
3.5.round(half: :up) # => 4
3.5.round(half: :even) # => 4
3.5.round(half: :down) # => 3
//}

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

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

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

...d(-2) # => 93600
t.round(-3) # => 94000
t.round(-100) # => 0

2.5.round(half: :up) # => 3
2.5.round(half: :even) # => 2
2.5.round(half: :down) # => 2
3.5.round(half: :up) # => 4
3.5.round(half: :even) # => 4
3.5.round(half: :down) # => 3
//}

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

Float::ROUNDS -> Integer (18304.0)

この定数は Ruby 2.7 から deprecated です。使わないでください。

この定数は Ruby 2.7 から deprecated です。使わないでください。


丸めモード (-1: 不定、0: 0.0 の方向に丸め、1: 四捨五入、2:正の無限
大の方向に丸め、3:負の無限大の方向に丸め)です。

Float#ceil(ndigits = 0) -> Integer | Float (22.0)

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

...

@param ndigits 10進数での小数点以下の有効桁数を整数で指定します。
正の整数を指定した場合、Float を返します。
小数点以下を、最大 n 桁にします。
負の整数を指定した場合、Integer を返...
...34567.89.ceil(-4) # => 40000
34567.89.ceil(-3) # => 35000
34567.89.ceil(-2) # => 34600
34567.89.ceil(-1) # => 34570
34567.89.ceil(0) # => 34568
34567.89.ceil(1) # => 34567.9
34567.89.ceil(2) # => 34567.89
34567.89.ceil(3) # => 34567.89
//}

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

Float#floor(ndigits = 0) -> Integer | Float (22.0)

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

...

@param ndigits 10進数での小数点以下の有効桁数を整数で指定します。
正の整数を指定した場合、Float を返します。
小数点以下を、最大 n 桁にします。
負の整数を指定した場合、Integer を返...
...oor(-4) # => 30000
34567.89.floor(-3) # => 34000
34567.89.floor(-2) # => 34500
34567.89.floor(-1) # => 34560
34567.89.floor(0) # => 34567
34567.89.floor(1) # => 34567.8
34567.89.floor(2) # => 34567.89
34567.89.floor(3) # => 34567.89
//}

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

絞り込み条件を変える

Float#to_i -> Integer (22.0)

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

...

@param ndigits 10進数での小数点以下の有効桁数を整数で指定します。
正の整数を指定した場合、Float を返します。
小数点以下を、最大 n 桁にします。
負の整数を指定した場合、Integer を返...

Float#truncate(ndigits = 0) -> Integer | Float (22.0)

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

...

@param ndigits 10進数での小数点以下の有効桁数を整数で指定します。
正の整数を指定した場合、Float を返します。
小数点以下を、最大 n 桁にします。
負の整数を指定した場合、Integer を返...