るりまサーチ

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

別のキーワード

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

ライブラリ

キーワード

検索結果

<< 1 2 3 > >>

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

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

...乗)を計算します。

@
param other 二項演算の右側の引数(対象)
@
param modulo 指定すると、計算途中に巨大な値を生成せずに (self**other) % modulo と同じ結果を返します。
@
return 計算結果
@
raise TypeError 2引数 pow で Integer 以外を指定した場...
...合に発生します。
@raise RangeError 2引数 pow で other に負の数を指定した場合に発生します。
@
raise ArgumentError 計算結果が巨大になりすぎる場合に発生します。

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


計算結果が巨大すぎるときは ArgumentError が発生します。

//emlist[計算結果が巨大すぎる例][ruby]{
p 100**9999999999999999999
# => exponent is too large (ArgumentError)
//}

判定の閾値は変わりえます。

@
see BigDecimal#power...

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

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

...乗)を計算します。

@
param other 二項演算の右側の引数(対象)
@
param modulo 指定すると、計算途中に巨大な値を生成せずに (self**other) % modulo と同じ結果を返します。
@
return 計算結果
@
raise TypeError 2引数 pow で Integer 以外を指定した場...
...合に発生します。
@raise RangeError 2引数 pow で other に負の数を指定した場合に発生します。
@
raise ArgumentError 計算結果が巨大になりすぎる場合に発生します。

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


計算結果が巨大すぎるときは ArgumentError が発生します。

//emlist[計算結果が巨大すぎる例][ruby]{
p 100**9999999999999999999
# => exponent is too large (ArgumentError)
//}

判定の閾値は変わりえます。

@
see BigDecimal#power...

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

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

...乗)を計算します。

@
param other 二項演算の右側の引数(対象)
@
param modulo 指定すると、計算途中に巨大な値を生成せずに (self**other) % modulo と同じ結果を返します。
@
return 計算結果
@
raise TypeError 2引数 pow で Integer 以外を指定した場...
...になりそうなとき、警告を出したうえで Float::INFINITY を返します。

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

判定の閾値は変わりえます。


@
see BigDecimal#power...

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

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

...乗)を計算します。

@
param other 二項演算の右側の引数(対象)
@
param modulo 指定すると、計算途中に巨大な値を生成せずに (self**other) % modulo と同じ結果を返します。
@
return 計算結果
@
raise TypeError 2引数 pow で Integer 以外を指定した場...
...になりそうなとき、警告を出したうえで Float::INFINITY を返します。

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

判定の閾値は変わりえます。


@
see BigDecimal#power...

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

除算の算術演算子。

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

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

other が Float、Rational、Complex の場合、普通の商を other と
...
...

@
param 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#d...
...iv, Integer#fdiv, Numeric#quo...

絞り込み条件を変える

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

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

...

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

例:

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

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

Integer#divmod(other) -> [Integer, Numeric] (121.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#remainder(other) -> Numeric (121.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...
...vmod, Integer#modulo, Numeric#modulo...

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

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

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

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

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

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

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

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

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

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

絞り込み条件を変える

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

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

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

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

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