るりまサーチ

最速Rubyリファレンスマニュアル検索!
4件ヒット [1-4件を表示] (0.018秒)

別のキーワード

  1. _builtin float
  2. float to_d
  3. json float
  4. float rationalize
  5. fiddle type_float

ライブラリ

検索結果

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

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

...数で指定します。
正の整数を指定した場合、Float を返します。
小数点以下を、最大 n 桁にします。
負の整数を指定した場合、Integer を返します。
小数点位置から左に少なくとも...
...]{
1.round # => 1
1.round(2) # => 1.0
15.round(-1) # => 20
(-15).round(-1) # => -20

25.round(-1, half: :up) # => 30
25.round(-1, half: :down) # => 20
25.round(-1, half: :even) # => 20
35.round(-1, half: :up) # => 40
35.round(-1, half: :down) # => 30
35.round(-1,...
...half: :even) # => 40
(-25).round(-1, half: :up) # => -30
(-25).round(-1, half: :down) # => -20
(-25).round(-1, half: :even) # => -20
//}

@see Numeric#round...