2件ヒット
[1-2件を表示]
(0.120秒)
検索結果
-
Complex
# to _ c -> self (54700.0) -
self を返します。
self を返します。
//emlist[例][ruby]{
Complex(2).to_c # => (2+0i)
Complex(-8, 6).to_c # => (-8+6i)
//} -
Numeric
# to _ c -> Complex (54433.0) -
自身を複素数 (Complex) に変換します。Complex(self, 0) を返します。
自身を複素数 (Complex) に変換します。Complex(self, 0) を返します。
//emlist[例][ruby]{
1.to_c # => (1+0i)
-1.to_c # => (-1+0i)
1.0.to_c # => (1.0+0i)
Rational(1, 2).to_c # => ((1/2)+0i)
//}
Numeric のサブクラスは、このメソッドを適切に再定義しなければなりません。