Main index | Section 3 | 日本語 | Options |
#include <math.h>
#include <complex.h>
The carg(), cargf(), and cargl() functions compute the complex argument (or phase angle) of z. The complex argument is the number theta such that z = r * e^(I * theta), where r = cabs(z). The call carg(z) is equivalent to atan2(cimag(z), creal(z)), and similarly for cargf() and cargl().
atan2(y, x) := | atan(y/x) | if x > 0, |
sign(y)*(π -atan(|y/x|) | if x < 0, | |
0 | if x = y = 0, or | |
sign( y)*π/2 | if x = 0 != y. |
(r=0,θ=0). In general, conversions to polar coordinates should be computed thus:
r := hypot(x,y); ... := sqrt(x*x+y*y) theta := atan2(y,x). r := hypot(x,y); ... := √(x2+y2) θ := atan2(y,x).
r := sqrt(x*x+y*y); if r = 0 then x := copysign(1,x);r := √(x*x+y*y); if r = 0 then x := copysign(1,x);
ATAN2 (3) | July 31, 2008 |
Main index | Section 3 | 日本語 | Options |
Please direct any comments about this manual page service to Ben Bullock. Privacy policy.