るりまサーチ

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

別のキーワード

  1. _builtin new
  2. _builtin inspect
  3. _builtin []
  4. _builtin to_s
  5. _builtin each

ライブラリ

クラス

キーワード

検索結果

Integer#remainder(other) -> Numeric (26137.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 (26137.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...

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

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

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

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

@param other self を割る数。

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

Numeric (8036.0)

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

...- - - o
rectangular | o - - - - - o
remainder
| o - - o - - -
round | o o -...
...q としたとき、x と q⋅y が一致する(つまり割り切れる)とは限りません。
その差 x − q⋅y を剰余(余り;remainder)と言います。
整除法は商と剰余がセットで決まる除法なので「剰余付き除法」とも呼ばれます。

しばし...
...の定義は何通りもありますが、
Ruby では、2通りの定義を採用し、剰余について
Numeric#modulo メソッドと Numeric#remainder メソッドとして
実装されています。

modulo は、

* y > 0 のとき 0 <= r < y
* y < 0 のとき y < r <= 0

となるよ...
...-----------------------------------------------------------
rectangular | o - - - o
remainder
| o o - - -
round | o o o o -
sin...

Numeric#%(other) -> Numeric (8006.0)

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

...す。

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

//emlist[例][ruby]{
p 13.modulo(4) #=> 1
p (11.5).modulo(3.5) #=> 1.0
p 13.modulo(-4) #=> -3
p (-13).modulo(4) #=> 3
p (-13).modulo(-4) #=> -1
p (-11).modulo(3.5) #=> 3.0
//}

@see Numeric#divmod, Numeric#remainder...

絞り込み条件を変える

Numeric#modulo(other) -> Numeric (8006.0)

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

...す。

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

//emlist[例][ruby]{
p 13.modulo(4) #=> 1
p (11.5).modulo(3.5) #=> 1.0
p 13.modulo(-4) #=> -3
p (-13).modulo(4) #=> 3
p (-13).modulo(-4) #=> -1
p (-11).modulo(3.5) #=> 3.0
//}

@see Numeric#divmod, Numeric#remainder...