remainder(other) -> Numeric[permalink][rdoc][edit](Numeric) → Numeric-
selfをotherで割った余りrを返します。ここで、商
qと余りrは、self == other * q + r
と
self > 0のとき0 <= r < |other|self < 0のとき-|other| < r <= 0qは整数
をみたす数です。
rの符号はselfと同じになります。商qを直接返すメソッドはありません。self.quo(other).truncateがそれに相当します。Complex では未定義化されています。
- [PARAM]
other: -
selfに対する除数
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_ALSO] Numeric#divmod, Numeric#modulo