Method: Complex#arg
- Defined in:
- complex.c
permalink #arg ⇒ Float
Returns the argument (angle) for self
in radians; see polar coordinates:
Complex.polar(3, Math::PI/2).arg # => 1.57079632679489660
If self
was created with rectangular coordinates, the returned value is computed, and may be inexact:
Complex.polar(1, 1.0/3).arg # => 0.33333333333333326
1390 1391 1392 1393 1394 1395 |
# File 'complex.c', line 1390
VALUE
rb_complex_arg(VALUE self)
{
get_dat1(self);
return rb_math_atan2(dat->imag, dat->real);
}
|