MAINSAIL Language Manual, Section 30.24

previous   next   top   contents   index   framed top   this page unframed


30.24. $atan2

Figure 30–23. $atan2 (GENERIC)
REAL
PROCEDURE   $atan2      (REAL y,x);

LONG REAL
PROCEDURE   $atan2      (LONG REAL y,x);

$atan2 returns the angle, in radians, with respect to the positive x-axis of a ray from the origin to a point with coordinates (x,y). Angles increase counterclockwise. The value returned is between minus pi and pi. If x and y are both positive, then $atan2(y,x) returns the same value as atan(y / x) (except that $atan2 may be more accurate for some values).

The effect is undefined if both x and y are zero, since such values do not define a ray with respect to the origin.

Figure 30–24. What the Return Value from $atan2 Represents
<diagram>


previous   next   top   contents   index   framed top   this page unframed

MAINSAIL Language Manual, Section 30.24