Maintenance Ruby 3.4 gets fixes, but no new features. Switch to Ruby 4.0 →
instance method
Complex#rectangular
() -> [ ::Numeric, ::Numeric ]
rect -> array
complex.c
View on GitHub ↗
static VALUE
nucomp_rect(VALUE self)
{
get_dat1(self);
return rb_assoc_new(dat->real, dat->imag);
}
Returns the array [self.real, self.imag]:
Example
Complex.rect(1, 2).rect # => [1, 2]
If self was created with polar coordinates, the returned value is computed, and may be inexact:
Example
Complex.polar(1.0, 1.0).rect # => [0.5403023058681398, 0.8414709848078965]
Complex#rectangular is an alias for Complex#rect.