るりまサーチ

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

関連するキーワード

  1. matrix
  2. _builtin
  3. bigdecimal

ライブラリ

検索結果

Complex#coerce(other) -> Array (18114)

自分自身とotherのペアの配列を生成し、生成した配列を返します。

...erが Complex のオブジェクトではないときは Complex オブジェクト化したものが配列の要素となります。

@param other 配列の要素となるオブジェクト

例:

z1 = Complex.new(1, 2)
z2 = Complex.new(3, 4)

p z1.coerce(5) #=> [Complex(5, 0), Complex(1,...
...2)]
p z1.coerce(z2) #=> [Complex(3, 4), Complex(1, 2)]...

Complex#coerce(other) -> [Complex, Complex] (18108)

other を Complex に変換して [self, 変換後の other] の配列を返します。

...other を Complex に変換して [self, 変換後の other] の配列を返します。

@raise TypeError 変換できないオブジェクトを指定した場合に発生します。

例:

Complex
(1).coerce(2) # => [(2+0i), (1+0i)]...