るりまサーチ

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

別のキーワード

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

ライブラリ

検索結果

Numeric#remainder(other) -> Numeric (6148.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 と同じになります。...
...りません。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) #=> -1
p (-13).remainder(-4) #=>...
...-1
p (-11).remainder(3.5) #=> -0.5
//}

@see Numeric#divmod, Numeric#modulo...