End of Life Ruby 3.0 has reached end of life and gets no more fixes. Switch to Ruby 4.0 →
instance method
Complex#imaginary
cmp.imaginary → real
complex.c
View on GitHub ↗
VALUE
rb_complex_imag(VALUE self)
{
get_dat1(self);
return dat->imag;
}
Returns the imaginary part.
Example
Complex(7).imaginary #=> 0 Complex(9, -4).imaginary #=> -4