Ruby 2.3.0 リファレンスマニュアル > ライブラリ一覧 > 組み込みライブラリ > Numericクラス > real

instance method Numeric#real

real -> Numeric[permalink][rdoc]

自身を返します。

Numeric のサブクラスは、このメソッドを適切に再定義しなければなりません。



10.real               # => 10
-10.real              # => -10
0.1.real              # => 0.1
Rational(2, 3).real   # => (2/3)

[SEE_ALSO] Numeric#imagComplex#real