るりまサーチ

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

別のキーワード

  1. _builtin -
  2. open-uri open
  3. irb/input-method new
  4. irb/input-method gets
  5. matrix -

ライブラリ

クラス

モジュール

オブジェクト

検索結果

<< 1 2 3 ... > >>

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

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

...param other 二項演算の右側の引数(対象)
@param modulo 指定すると、計算途中に巨大な値を生成せずに (self**other) % modulo と同じ結果を返します。
@return 計算結果
@raise TypeError 2引数 pow で Integer 以外を指定した場合に発生します。
@ra...
...ise 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 big
# Infinity
//}

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

@see BigDecimal#power...

Rational#**(other) -> Rational | Float (21354.0)

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

...す。

@param other 自身を other 乗する数

other に Float を指定した場合は、計算結果を Float で返しま
す。other が有理数であっても、計算結果が無理数だった場合は Float
を返します。

//emlist[例][ruby]{
r
= Rational(3, 4)
r
** Rational(2, 1)...
...# => (9/16)
r
** 2 # => (9/16)
r
** 2.0 # => 0.5625
r
** Rational(1, 2) # => 0.866025403784439
//}...

Matrix#**(n) -> Matrix (21300.0)

self の n 乗を返します。

...self の n 乗を返します。

@param n べき数の指定
@raise ExceptionForMatrix::ErrNotRegular n が 0 以下で、行列が正則でない場合に発生します...

Rational#**(rhs) -> Numeric (21300.0)

@todo

...@todo

self のべき乗を返します。 Rational になるようであれば Rational で返します。...

Float#**(other) -> Float (18324.0)

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

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

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

//emlist[例][ruby]{
# 冪
1.2 ** 3.0 # => 1.7279999999999998
3.0 + 4.5 - 1.3 / 2.4 * 3 % 1.2 ** 3.0 # => 5.875
0.0 ** 0 # => 1.0
//}...

絞り込み条件を変える

Bignum#**(other) -> Fixnum | Bignum | Float (18318.0)

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

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

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

2 ** 3 # => 8
2 ** 0 # => 1
0 ** 0 # => 1...

Fixnum#**(other) -> Fixnum | Bignum | Float (18318.0)

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

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

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

2 ** 3 # => 8
2 ** 0 # => 1
0 ** 0 # => 1...

Complex#**(other) -> Complex (18306.0)

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

...冪(べき)乗を計算します。

@param other 自身を other 乗する数

//emlist[例][ruby]{
Complex('i') ** 2 # => (-1+0i)
//}...

OpenSSL::BN#**(other) -> OpenSSL::BN (18300.0)

自身の other 乗を返します。

...自身の other 乗を返します。

@param other 指数
@raise OpenSSL::BNError 計算時エラー
@see OpenSSL::BN#mod_exp...

Marshal.#restore(port, proc = nil) -> object (9306.0)

port からマーシャルデータを読み込んで、元のオブジェクトと同 じ状態をもつオブジェクトを生成します。

...port からマーシャルデータを読み込んで、元のオブジェクトと同
じ状態をもつオブジェクトを生成します。

proc として手続きオブジェクトが与えられた場合には読み込んだ
オブジェクトを引数にその手続きを呼び出します...
...

//emlist[例][ruby]{
str = Marshal.dump(["a", 1, 10 ** 10, 1.0, :foo])
p Marshal.load(str, proc {|obj| p obj})

# => "a"
# 1
# 10000000000
# 1.0
# :foo
# ["a", 1, 10000000000, 1.0, :foo]
# ["a", 1, 10000000000, 1.0, :foo]
//}

@param port String か IO (またはそのサブ...
...クラス)の
インスタンスを指定します。

@param proc 手続きオブジェクト。Proc

@raise TypeError メジャーバージョンが異なるか、バージョンの大きな
マーシャルデータを読み込んだ場合に発生します。...

絞り込み条件を変える

Prime#prime_division(value, generator= Prime::Generator23.new) -> [[Integer, Integer]] (9306.0)

与えられた整数を素因数分解します。

...与えられた整数を素因数分解します。

@param value 素因数分解する任意の整数を指定します。

@param generator 素数生成器のインスタンスを指定します。

@return 素因数とその指数から成るペアを要素とする配列です。つまり、戻...
...n**e が value を割り切る最大の自然数 e です。

@raise ZeroDivisionError 与えられた数値がゼロである場合に発生します。

//emlist[例][ruby]{
r
equire 'prime'
Prime.prime_division(12) #=> [[2,2], [3,1]]
Prime.prime_division(10) #=> [[2,1], [5,1]]
//}

@see Prime.pri...
...me_division, Prime::EratosthenesGenerator, Prime::TrialDivisionGenerator, Prime::Generator23...

Prime.prime_division(value, generator= Prime::Generator23.new) -> [[Integer, Integer]] (9306.0)

Prime.instance.prime_division と同じです。

...Prime.instance.prime_division と同じです。

@param value 素因数分解する任意の整数を指定します。

@param generator 素数生成器のインスタンスを指定します。

@return 素因数とその指数から成るペアを要素とする配列です。つまり、戻り...
...2要素の配列 [n,e] であり、それぞれの内部配列の第1要素 n は value の素因数、第2要素は n**e が value を割り切る最大の自然数 e です。

@raise ZeroDivisionError 与えられた数値がゼロである場合に発生します。

@see Prime#prime_division...
<< 1 2 3 ... > >>