るりまサーチ

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

別のキーワード

  1. numeric step
  2. _builtin numeric
  3. numeric truncate
  4. numeric conjugate
  5. numeric imaginary

検索結果

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

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

...am ndigits 10進数での小数点以下の有効桁数を整数で指定します。
負の整数を指定した場合、小数点位置から左に少なくとも 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 (21240.0)

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

...@param ndigits 10進数での小数点以下の有効桁数を整数で指定します。
正の整数を指定した場合、Float を返します。
小数点以下を、最大 n 桁にします。
負の整数を指定した場合、Integer を返し...
...ます。
小数点位置から左に少なくとも n 個の 0 が並びます。

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

@see Numeric#truncate...