るりまサーチ

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

別のキーワード

  1. object yield_self
  2. _builtin yield_self
  3. _builtin self
  4. tracepoint self
  5. codeobject document_self

ライブラリ

キーワード

検索結果

Complex#to_c -> self (6218.0)

self を返します。

...
self
を返します。

//emlist[例][ruby]{
Complex
(2).to_c # => (2+0i)
Complex
(-8, 6).to_c # => (-8+6i)
//}...

Complex#magnitude -> Numeric (3113.0)

自身の絶対値を返します。

...す。

以下の計算の結果を Float オブジェクトで返します。

sqrt(self.real ** 2 + self.imag ** 2)

//emlist[例][ruby]{
Complex
(1, 2).abs # => 2.23606797749979
Complex
(3, 4).abs # => 5.0
Complex
('1/2', '1/2').abs # => 0.7071067811865476
//}

@see Complex#abs2...

Complex#<=>(other) -> -1 | 0 | 1 | nil (133.0)

self の虚部がゼロで other が実数の場合、 self の実部の <=> メソッドで other と比較した結果を返します。 other が Complex で虚部がゼロの場合も同様です。

...
self
の虚部がゼロで other が実数の場合、
self
の実部の <=> メソッドで other と比較した結果を返します。
other が Complex で虚部がゼロの場合も同様です。

その他の場合は nil を返します。

@param other 自身と比較する数値

//emlis...
...t[例][ruby]{
Complex
(2, 3) <=> Complex(2, 3) #=> nil
Complex
(2, 3) <=> 1 #=> nil
Complex
(2) <=> 1 #=> 1
Complex
(2) <=> 2 #=> 0
Complex
(2) <=> 3 #=> -1
//}...

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

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

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

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

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

Complex#fdiv(other) -> Complex (117.0)

self を other で割った商を返します。 実部と虚部が共に Float の値になります。

...
self
を other で割った商を返します。
実部と虚部が共に Float の値になります。

@param other 自身を割る数

//emlist[例][ruby]{
Complex
(11, 22).fdiv(3) # => (3.6666666666666665+7.333333333333333i)
Complex
(11, 22).quo(3) # => ((11/3)+(22/3)*i)
//}

@see Complex#quo...

絞り込み条件を変える