ATAN2()
ATAN2(float $xCoordinate = null, float $yCoordinate = null) : float|string
ATAN2.
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 arctangent is the angle from the x-axis to a line containing the origin (0, 0) and a
point with coordinates (xCoordinate, yCoordinate). The angle is given in radians between
-pi and pi, excluding -pi.
Note that the Excel ATAN2() function accepts its arguments in the reverse order to the standard
PHP atan2() function, so we need to reverse them here before calling the PHP atan() function.
Excel Function:
ATAN2(xCoordinate,yCoordinate)
Parameters
float |
$xCoordinate |
the x-coordinate of the point
|
float |
$yCoordinate |
the y-coordinate of the point
|
Returns
float|string
— the inverse tangent of the specified x- and y-coordinates, or a string containing an error