るりまサーチ

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

別のキーワード

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

ライブラリ

クラス

キーワード

検索結果

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

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

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

.../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#divmod, Integer#modulo, Numeric#modulo...

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

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

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

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

@param other self を割る数。

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

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

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

...* other < 0 のとき other < r <= 0
* q は整数

をみたす数です。
余り r は、other と同じ符号になります。
商 q は、Numeric#div (あるいは 「/」)で求められます。
modulo はメソッド % の呼び出しとして定義されています。

@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 (17132.0)

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

...* other < 0 のとき other < r <= 0
* q は整数

をみたす数です。
余り r は、other と同じ符号になります。
商 q は、Numeric#div (あるいは 「/」)で求められます。
modulo はメソッド % の呼び出しとして定義されています。

@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 (14148.0)

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

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

演算や比較を行うメソッド(+, -, *, /, <=>)は Numeric のサブクラスで定義されま
す。Numeric で定義されているメソッドは、サブクラスで...
...提供されているメソッド
(+, -, *, /, %) を利用して定義されるものがほとんどです。
つまり Numeric で定義されているメソッドは、Numeric のサブクラスとして新たに数値クラスを定義した時に、
演算メソッド(+, -, *, /, %, <=>, coerce...
...を表しメソッド定義などではこの記法を利用します。

効率のため Numeric のメソッドと同じメソッドがサブクラスで再定義されている場合があります。

Numeric
#coerce メソッドを使うことによって異なる数値クラス間で演算を...