atan2() function in PHP


The atan2() function returns the arc tangent of two variables.

Syntax

atan2(val1, val2)

Parameters

  • val1 − The dividend

  • val2 − The divisor

Return

The atan2() function returns the arc tangent of val2/ val1 in radians. The returned value is between -Pi and Pi.

Example

 Live Demo

<?php
   echo(atan2(30,30) . "<br>");
   echo(atan2(2,2) . "<br>");
?>

Output

0.78539816339745<br>0.78539816339745<br>

Example

Let us see another example −

 Live Demo

<?php
   echo(atan2(-15,-15) . "<br>");
   echo(atan2(-0.90,-0.70) . "<br>");
?>

Output

-2.3561944901923<br>-2.2318394956456<br>

Updated on: 26-Dec-2019

86 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements