Skip to content
instance method

Complex#real

() -> ::Numeric
real → numeric

Returns the real value for self:

Example
Complex.rect(7).real     # => 7
Complex.rect(9, -4).real # => 9

If self was created with polar coordinates, the returned value is computed, and may be inexact:

Example
Complex.polar(1, Math::PI/4).real # => 0.7071067811865476 # Square root of 2.
See also #real? #rationalize #quo #rect also in 4.1 · 3.4 · 3.3 · 3.2 · 3.1 · 3.0