るりまサーチ

最速Rubyリファレンスマニュアル検索!
11件ヒット [1-11件を表示] (0.027秒)
トップページ > ライブラリ:ビルトイン[x] > クエリ:TRUNC[x] > クラス:Integer[x]

別のキーワード

  1. socket msg_trunc
  2. fcntl o_trunc
  3. etc pc_no_trunc
  4. _builtin trunc
  5. constants trunc

検索結果

Integer#truncate(ndigits = 0) -> Integer (6103.0)

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

...します。
負の整数を指定した場合、小数点位置から左に少なくとも n 個の 0 が並びます。

//emlist[][ruby]{
1.truncate # => 1
1.truncate(2) # => 1
18.truncate(-1) # => 10
(-18).truncate(-1) # => -10
//}

@see Numeric#truncate...

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

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

...定した場合、Integer を返します。
小数点位置から左に少なくとも n 個の 0 が並びます。

//emlist[][ruby]{
1.truncate # => 1
1.truncate(2) # => 1.0
18.truncate(-1) # => 10
(-18).truncate(-1) # => -10
//}

@see Numeric#truncate...