End of Life Ruby 3.1 has reached end of life and gets no more fixes. Switch to Ruby 4.0 →
instance method
Complex#rectangular
cmp.rectangular → array
complex.c
View on GitHub ↗
static VALUE
nucomp_rect(VALUE self)
{
get_dat1(self);
return rb_assoc_new(dat->real, dat->imag);
}
Returns an array; [cmp.real, cmp.imag].
Example
Complex(1, 2).rectangular #=> [1, 2]