atan2 in PHP

Syntax of atan2

float atan2(float y, float x)

Using the signs of both parameters to determine the quadrant the value is in, returns the arc tangent of x and y in radians.

Example of atan2

<?php
echo(atan2(0.50,0.50) . "<br>");
echo(atan2(-0.50,-0.50) . "<br>");
echo(atan2(5,5) . "<br>");
echo(atan2(10,20) . "<br>");
echo(atan2(-5,-5) . "<br>");
echo(atan2(-10,10));
?>

0.78539816339745
-2.3561944901923
0.78539816339745
0.46364760900081
-2.3561944901923
-0.78539816339745

Leave a Comment