instance method Integer#truncate

truncate(ndigits = 0) -> Integer[permalink][rdoc][edit]

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

[PARAM] ndigits:
10進数での小数点以下の有効桁数を整数で指定します。負の整数を指定した場合、小数点位置から左に少なくとも n 個の 0 が並びます。

1.truncate           # => 1
1.truncate(2)        # => 1
18.truncate(-1)      # =>  10
(-18).truncate(-1)   # => -10

[SEE_ALSO] Numeric#truncate