るりまサーチ

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

別のキーワード

  1. numeric step
  2. _builtin numeric
  3. numeric -@
  4. numeric %
  5. numeric i

キーワード

検索結果

<< 1 2 3 > >>

Integer#-(other) -> Numeric (18210.0)

算術演算子。差を計算します。

...算術演算子。差を計算します。

@param other 二項演算の右側の引数(対象)
@return 計算結果

//emlist[][ruby]{
4 - 1 #=> 3
//}...

Integer#**(other) -> Numeric (265.0)

算術演算子。冪(べき乗)を計算します。

...pow で Integer 以外を指定した場合に発生します。
@raise RangeError 2引数 pow で other に負の数を指定した場合に発生します。

//emlist[][ruby]{
2 ** 3 # => 8
2 ** 0 # => 1
0 ** 0 # => 1
3.pow(3, 8) # => 3
3.pow(3, -8) # => -5
3.pow(2, -2) # => -1
-
3.pow(3, 8...
...) # => 5
-
3.pow(3, -8) # => -3
5.pow(2, -8) # => -7
//}

結果が巨大すぎる整数になりそうなとき、警告を出したうえで Float::INFINITY を返します。

//emlist[計算を放棄して Float::INFINITY を返す例][ruby]{
p 100**9999999
# => warning: in a**b, b may be too b...

Integer#pow(other) -> Numeric (265.0)

算術演算子。冪(べき乗)を計算します。

...pow で Integer 以外を指定した場合に発生します。
@raise RangeError 2引数 pow で other に負の数を指定した場合に発生します。

//emlist[][ruby]{
2 ** 3 # => 8
2 ** 0 # => 1
0 ** 0 # => 1
3.pow(3, 8) # => 3
3.pow(3, -8) # => -5
3.pow(2, -2) # => -1
-
3.pow(3, 8...
...) # => 5
-
3.pow(3, -8) # => -3
5.pow(2, -8) # => -7
//}

結果が巨大すぎる整数になりそうなとき、警告を出したうえで Float::INFINITY を返します。

//emlist[計算を放棄して Float::INFINITY を返す例][ruby]{
p 100**9999999
# => warning: in a**b, b may be too b...

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

Integer#%(other) -> Numeric (241.0)

算術演算子。剰余を計算します。

...算術演算子。剰余を計算します。

//emlist[][ruby]{
13 % 4 # => 1
13 % -4 # => -3
-
13 % 4 # => 3
-
13 % -4 # => -1
//}

@param other 二項演算の右側の引数(対象)
@return 計算結果...

絞り込み条件を変える

Integer#modulo(other) -> Numeric (241.0)

算術演算子。剰余を計算します。

...算術演算子。剰余を計算します。

//emlist[][ruby]{
13 % 4 # => 1
13 % -4 # => -3
-
13 % 4 # => 3
-
13 % -4 # => -1
//}

@param other 二項演算の右側の引数(対象)
@return 計算結果...

Integer#fdiv(other) -> Numeric (240.0)

self を other で割った商を Float で返します。 ただし Complex が関わる場合は例外です。 その場合も成分は Float になります。

...指定します。

例:

654321.fdiv(13731) # => 47.652829364212366
654321.fdiv(13731.24) # => 47.65199646936475

-
1234567890987654321.fdiv(13731) # => -89910996357705.52
-
1234567890987654321.fdiv(13731.24) # => -89909424858035.72
@see Numeric#quo, Numeric#div, Integer#div...

Integer#/(other) -> Numeric (222.0)

除算の算術演算子。

...除算の算術演算子。

other が Integer の場合、整商(整数の商)を Integer で返します。
普通の商(剰余を考えない商)を越えない最大の整数をもって整商とします。

other が Float、Rational、Complex の場合、普通の商を other と
...
...側の引数(対象)
@return 計算結果

//emlist[例][ruby]{
7 / 2 # => 3
7 / -2 # => -4
7 / 2.0 # => 3.5
7 / Rational(2, 1) # => (7/2)
7 / Complex(2, 0) # => ((7/2)+0i)

begin
2 / 0
rescue => e
e # => #<ZeroDivisionError: divided by 0>
end
//}

@see Integer#div, Integer#fdiv, Numeric#quo...

Integer#divmod(other) -> [Integer, Numeric] (210.0)

self を other で割った商 q と余り r を、 [q, r] という 2 要素の配列にし て返します。 商 q は常に整数ですが、余り r は整数であるとは限りません。

...self を other で割った商 q と余り r を、 [q, r] という 2 要素の配列にし
て返します。 商 q は常に整数ですが、余り r は整数であるとは限りません。

@param other self を割る数。

@see Numeric#divmod...

Integer#*(other) -> Numeric (204.0)

算術演算子。積を計算します。

算術演算子。積を計算します。

@param other 二項演算の右側の引数(対象)
@return 計算結果

//emlist[][ruby]{
2 * 3 # => 6
//}

絞り込み条件を変える

<< 1 2 3 > >>