るりまサーチ

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

別のキーワード

  1. _builtin main
  2. main define_method
  3. main private
  4. main public
  5. main using

ライブラリ

クラス

検索結果

Integer#remainder(other) -> Numeric (24238.0)

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

...@param other self を割る数。

//emlist[][ruby]{
5.remainder(3) # => 2
-5.remainder(3) # => -2
5.remainder(-3) # => 2
-5.remainder(-3) # => -2

-1234567890987654321.remainder(13731) # => -6966
-1234567890987654321.remainder(13731.24) # => -9906.22531493148
//}

@see Integer#di...

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

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

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

BigDecimal#remainder(n) -> BigDecimal (24232.0)

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

...)
x.remainder(3).to_i # => 1
(-x).remainder(3).to_i # => -1
x.remainder(-3).to_i # => 1
(-x).remainder(-3).to_i # => -1
//}

戻り値は self と同じ符号になります。これは BigDecimal#% とは異な
る点に注意してください。詳細は Numeric#%、
Numeric#remainder...

Bignum#remainder(other) -> Fixnum | Bignum | Float (24202.0)

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

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

r の符号は self と同じになります。

@param other self を割る数。

@see Bignum#divmod, Bignum#modulo, Numeric#modulo