るりまサーチ

最速Rubyリファレンスマニュアル検索!
51件ヒット [1-51件を表示] (0.033秒)
トップページ > クエリ:self[x] > クエリ:truncate[x]

別のキーワード

  1. object yield_self
  2. _builtin yield_self
  3. _builtin self
  4. tracepoint self
  5. codeobject document_self

ライブラリ

クラス

キーワード

検索結果

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

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

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

@param 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 (18147.0)

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

...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...

Pathname#truncate(length) -> 0 (18139.0)

File.truncate(self.to_s, length) と同じです。

...File.truncate(self.to_s, length) と同じです。


@param length 変更したいサイズを整数で与えます。

@see File.truncate...

Numeric (72.0)

数値を表す抽象クラスです。Integer や Float などの数値クラス は Numeric のサブクラスとして実装されています。

...- o o o
to_s | - - o o o o o
truncate
| o o - - o o -
Numeric Integer Fixnum Bi...
...Numeric#ceil, Numeric#floor, Numeric#round, Numeric#truncate
のふるまいの違いの表です。左の実数に対して各メソッドを呼ぶと表のような数を
返します。

| ceil floor round truncate
------------------------------------------...
...**d
if self > 0
self
.quo(x).ceil * x
else
self
.quo(x).floor * x
end
end

def rounddown(d=0)
x = 10**d
if self < 0
self
.quo(x).ceil * x
else
self
.quo(x).floor * x
end
end

def roundoff(d=0)
x = 10**d
if self < 0
(self.quo(x) -...
...to_r | - o o o o
to_s | - o o o o
truncate
| o o o o -
upto | - o - - -...

Numeric#remainder(other) -> Numeric (52.0)

self を other で割った余り r を返します。

...
self
を other で割った余り r を返します。

ここで、商 q と余り r は、

* self == other * q + r


* self > 0 のとき 0 <= r < |other|
* self < 0 のとき -|other| < r <= 0
* q は整数

をみたす数です。r の符号は self と同じになります。...
...商 q を直接返すメソッドはありません。self.quo(other).truncate がそれに相当します。

@param other 自身を割る数を指定します。

//emlist[例][ruby]{
p 13.remainder(4) #=> 1
p (11.5).remainder(3.5) #=> 1.0
p 13.remainder(-4) #=> 1
p (-13).remainder(4)...

絞り込み条件を変える

NEWS for Ruby 2.5.0 (30.0)

NEWS for Ruby 2.5.0 このドキュメントは前回リリース以降のバグ修正を除くユーザーに影響のある機能の変更のリストです。

...readable_real?, File.writable?, File.writable_real?,
File.executable?, File.executable_real?, File.mkfifo, File.readlink,
File.truncate, File#truncate, File.chmod, File.lchmod, File.chown,
File.lchown, File.unlink, File.utime, File.lstat はGVLを解放するようになりまし...
...Integer#ceil, Integer#truncate は常に Integer を返すようになりました
13420
* Integer#pow を追加 12508 11003
* Integer#allbits?, Integer#anybits?, Integer#nobits? を追加 12753
* Integer.sqrt を追加 13219

* Kernel
* Object#yield_self を追加 6721...
...* BigDecimal.new
* BigDecimal.ver
* BigDecimal#clone と BigDecimal#dup は新しいインスタンスを作らなくなりました。selfを返します。

* coverage
* ブランチカバレッジとメソッドカバレッジの計測をサポートしました 13901
...