End of Life Ruby 3.0 has reached end of life and gets no more fixes. Switch to Ruby 4.0 →
instance method
Complex#phase
cmp.phase → float
complex.c
View on GitHub ↗
VALUE
rb_complex_arg(VALUE self)
{
get_dat1(self);
return rb_math_atan2(dat->imag, dat->real);
}
Alias of #arg
Returns the angle part of its polar form.
Example
Complex.polar(3, Math::PI/2).arg #=> 1.5707963267948966