Here is the definition in the lang package
/**
* Converts rectangular coordinates (a, b) to polar (r, theta). This method * computes the phase theta by computing an arc tangent of b/a in
* the range of -Pi to Pi.
* @param a an assigned value
* @param b an assigned value
* @return the polar coordinates (r, theta).
*/
public static native double atan2(double a, double b);
It talks about returning r,theta - that''s wrong. It returns only theta in radians.
Also, it says that it is going to find the arctan of b/a. This is wrong too. It
finds the arctan of a/b.
I would think this is based on atan2 offered by C. Here is the relevant part of
manpage for atan2 - Read 0 as theta.
double atan2(double y, double x);
atan2(y,x) and hypot(x,y) (see hypot(3M)) convert rectangu-
lar coordinates (x,y) to polar (r,0); atan2(y,x) computes 0,
the argument or phase, by computing an arc tangent of y/x in
the range -n to n.
Note that this talks about y/x where y is the first argument. In your case, it
is a/b since a is your first argument (if atan2(a,b) results in an atan2(a,b)
call to C).
/**
* Converts rectangular coordinates (a, b) to polar (r, theta). This method * computes the phase theta by computing an arc tangent of b/a in
* the range of -Pi to Pi.
* @param a an assigned value
* @param b an assigned value
* @return the polar coordinates (r, theta).
*/
public static native double atan2(double a, double b);
It talks about returning r,theta - that''s wrong. It returns only theta in radians.
Also, it says that it is going to find the arctan of b/a. This is wrong too. It
finds the arctan of a/b.
I would think this is based on atan2 offered by C. Here is the relevant part of
manpage for atan2 - Read 0 as theta.
double atan2(double y, double x);
atan2(y,x) and hypot(x,y) (see hypot(3M)) convert rectangu-
lar coordinates (x,y) to polar (r,0); atan2(y,x) computes 0,
the argument or phase, by computing an arc tangent of y/x in
the range -n to n.
Note that this talks about y/x where y is the first argument. In your case, it
is a/b since a is your first argument (if atan2(a,b) results in an atan2(a,b)
call to C).