t2:atan2

atan2


atan2 — Arc tangent of two variables

Description


fix32 atan2(fix32 y, fix32 x);

This function calculates the arc tangent of the two variables x and y. It is similar to calculating the arc tangent of y / x, except that the signs of both arguments are used to determine the quadrant of the result.

The function returns the result in radians, which is between -PI and PI (inclusive).

Parameters


  • y: Dividend parameter.
  • x: Divisor parameter.

Return Value


The arc tangent of y / x in radians.

Examples


Example #1 atan2() example

init {
    printf("%.6f", atan2(1.0, 2.0)); // ~0.463647609001
}

See Also

t2/atan2.txt · Last modified: 2016/11/13 06:38 by J2Kbr