13件ヒット
[1-13件を表示]
(0.080秒)
種類
- インスタンスメソッド (12)
- クラス (1)
検索結果
先頭5件
-
Float
# modulo(other) -> Float (96616.0) -
算術演算子。剰余を計算します。
算術演算子。剰余を計算します。
@param other 二項演算の右側の引数(対象)
//emlist[例][ruby]{
# 剰余
3.0 % 1.2 # => 0.6000000000000001
3.0 % 0.0 # ZeroDivisionError
//} -
Bignum
# modulo(other) -> Fixnum | Bignum | Float (69616.0) -
算術演算子。剰余を計算します。
算術演算子。剰余を計算します。
@param other 二項演算の右側の引数(対象)
@return 計算結果 -
Fixnum
# modulo(other) -> Fixnum | Bignum | Float (69616.0) -
算術演算子。剰余を計算します。
算術演算子。剰余を計算します。
@param other 二項演算の右側の引数(対象)
@return 計算結果 -
Float
# %(other) -> Float (51316.0) -
算術演算子。剰余を計算します。
算術演算子。剰余を計算します。
@param other 二項演算の右側の引数(対象)
//emlist[例][ruby]{
# 剰余
3.0 % 1.2 # => 0.6000000000000001
3.0 % 0.0 # ZeroDivisionError
//} -
Float
# divmod(other) -> [Numeric] (51025.0) -
self を other で割った商 q と余り r を、 [q, r] という 2 要素の配列にして返します。 商 q は常に整数ですが、余り r は整数であるとは限りません。
self を other で割った商 q と余り r を、
[q, r] という 2 要素の配列にして返します。
商 q は常に整数ですが、余り r は整数であるとは限りません。
ここで、商 q と余り r は、
* self == other * q + r
と
* other > 0 のとき: 0 <= r < other
* other < 0 のとき: other < r <= 0
* q は整数
をみたす数です。
このメソッドは、メソッド / と % によって定義されています。
@param other 自身を割る数を指定します。
//emli... -
Integer
# pow(other , modulo) -> Integer (24382.0) -
算術演算子。冪(べき乗)を計算します。
算術演算子。冪(べき乗)を計算します。
@param other 二項演算の右側の引数(対象)
@param modulo 指定すると、計算途中に巨大な値を生成せずに (self**other) % modulo と同じ結果を返します。
@return 計算結果
@raise TypeError 2引数 pow で Integer 以外を指定した場合に発生します。
@raise RangeError 2引数 pow で other に負の数を指定した場合に発生します。
//emlist[][ruby]{
2 ** 3 # => 8
2 ** 0 # => 1
0 ** 0 # => 1
... -
Bignum
# remainder(other) -> Fixnum | Bignum | Float (24346.0) -
self を other で割った余り r を返します。
self を other で割った余り r を返します。
r の符号は self と同じになります。
@param other self を割る数。
@see Bignum#divmod, Bignum#modulo, Numeric#modulo -
Bignum
# %(other) -> Fixnum | Bignum | Float (24316.0) -
算術演算子。剰余を計算します。
算術演算子。剰余を計算します。
@param other 二項演算の右側の引数(対象)
@return 計算結果 -
Fixnum
# %(other) -> Fixnum | Bignum | Float (24316.0) -
算術演算子。剰余を計算します。
算術演算子。剰余を計算します。
@param other 二項演算の右側の引数(対象)
@return 計算結果 -
Numeric (24235.0)
-
数値を表す抽象クラスです。Integer や Float などの数値クラス は Numeric のサブクラスとして実装されています。
数値を表す抽象クラスです。Integer や Float などの数値クラス
は Numeric のサブクラスとして実装されています。
演算や比較を行うメソッド(+, -, *, /, <=>)は Numeric のサブクラスで定義されま
す。Numeric で定義されているメソッドは、サブクラスで提供されているメソッド
(+, -, *, /, %) を利用して定義されるものがほとんどです。
つまり Numeric で定義されているメソッドは、Numeric のサブクラスとして新たに数値クラスを定義した時に、
演算メソッド(+, -, *, /, %, <=>, coerce)だけを定義すれ... -
Integer
# **(other) -> Numeric (24082.0) -
算術演算子。冪(べき乗)を計算します。
算術演算子。冪(べき乗)を計算します。
@param other 二項演算の右側の引数(対象)
@param modulo 指定すると、計算途中に巨大な値を生成せずに (self**other) % modulo と同じ結果を返します。
@return 計算結果
@raise TypeError 2引数 pow で Integer 以外を指定した場合に発生します。
@raise RangeError 2引数 pow で other に負の数を指定した場合に発生します。
//emlist[][ruby]{
2 ** 3 # => 8
2 ** 0 # => 1
0 ** 0 # => 1
... -
Integer
# pow(other) -> Numeric (24082.0) -
算術演算子。冪(べき乗)を計算します。
算術演算子。冪(べき乗)を計算します。
@param other 二項演算の右側の引数(対象)
@param modulo 指定すると、計算途中に巨大な値を生成せずに (self**other) % modulo と同じ結果を返します。
@return 計算結果
@raise TypeError 2引数 pow で Integer 以外を指定した場合に発生します。
@raise RangeError 2引数 pow で other に負の数を指定した場合に発生します。
//emlist[][ruby]{
2 ** 3 # => 8
2 ** 0 # => 1
0 ** 0 # => 1
... -
Integer
# div(other) -> Integer (24061.0) -
整商(整数の商)を返します。 普通の商(剰余を考えない商)を越えない最大の整数をもって整商とします。
整商(整数の商)を返します。
普通の商(剰余を考えない商)を越えない最大の整数をもって整商とします。
other が Integer オブジェクトの場合、Integer#/ の結果と一致します。
div に対応する剰余メソッドは modulo です。
@param other 二項演算の右側の引数(対象)
@return 計算結果
//emlist[例][ruby]{
7.div(2) # => 3
7.div(-2) # => -4
7.div(2.0) # => 3
7.div(Rational(2, 1)) # => 3
begin
2.div(0)
rescue => ...