るりまサーチ

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

別のキーワード

  1. _builtin new
  2. _builtin inspect
  3. _builtin []
  4. _builtin to_s
  5. _builtin each

ライブラリ

検索結果

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

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

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

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

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

//emlist[例][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
//}...