atan2


php128 apg

RETURNS the arc tangent of an argument given in radians using two variables.

Compatible with LOCALE only, up to PHP 7.4.XX.





This function returns de arc tangent of the two variables $x and $y, similar to calculating the arc tangent of $y/$x except that the signs of both are used to determine the quadrant of the result.

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




<?php

float atan2 
float $yfloat $x )


where,

$y The dividend parameter

$x 
The divisor parameter

?>
 

$y


The dividend parameter.



$x


The divisor parameter.



  1 EXERCISE   

<?php

// setlocale(LC_ALL, 'es_ES', 'es-ES');

// FIRST QUADRANT
$sin001 0.70710678118655;
$cos001 0.70710678118655;
$ata001 atan2($sin001$cos001);
$gra001 rad2deg($ata001);

// SECOND QUADRANT
$sin002 0.70710678118655;
$cos002 = -0.70710678118655;
$ata002 atan2($sin002$cos002);
$gra002 rad2deg($ata002);

// THIRD QUADRANT
$sin003 = -0.70710678118655;
$cos003 = -0.70710678118655;
$ata003 atan2($sin003$cos003);
$gra003 rad2deg($ata003);

// FOURTH QUADRANT
$sin004 = -0.70710678118655;
$cos004 0.70710678118655;
$ata004 atan2($sin004$cos004);
$gra004 rad2deg($ata004);

?>

<table width="100%" border="1" cellspacing="5" cellpadding="5">
  <tr>
    <td colspan="4">FIRST QUADRANT </td>
  </tr>
  <tr>
   <td>sin</td>
   <td>cos</td>
   <td>radians</td>
   <td>degrees</td>
  </tr>
  <tr>
   <td><?php echo $sin001?></td>
   <td><?php echo $cos001?></td>
   <td><?php echo $ata001?></td>
   <td><?php echo $gra001?></td>
  </tr>
  <tr>
    <td colspan="4">SECOND QUADRANT </td>
  </tr>
  <tr>
   <td>sin</td>
   <td>cos</td>
   <td>radians</td>
   <td>degrees</td>
  </tr>
  <tr>
   <td><?php echo $sin002?></td>
   <td><?php echo $cos002?></td>
   <td><?php echo $ata002?></td>
   <td><?php echo $gra002?></td>
  </tr>
  <tr>
    <td colspan="4">THIRD QUADRANT </td>
  </tr>
  <tr>
   <td>sin</td>
   <td>cos</td>
   <td>radians</td>
   <td>degrees</td>
  </tr>
  <tr>
   <td><?php echo $sin003?></td>
   <td><?php echo $cos003?></td>
   <td><?php echo $ata003?></td>
   <td><?php echo $gra003?></td>
  </tr>

  <tr>
    <td colspan="4">FOURTH QUADRANT </td>
  </tr>
  <tr>
   <td>sin</td>
   <td>cos</td>
   <td>radians</td>
   <td>degrees</td>
  </tr>
  <tr>
   <td><?php echo $sin004?></td>
   <td><?php echo $cos004?></td>
   <td><?php echo $ata004?></td>
   <td><?php echo $gra004?></td>
  </tr>
  <tr>
    <td colspan="4">ed48</td>
  </tr>
</table>