PHP atan2() Function Example

PHP atan2() Function Example


Posted in : PHP Posted on : January 28, 2011 at 6:11 PM Comments : [ 0 ]

Using this method, calculates the tangent of two variables.

PHP atan2() Function Example:

Using this method, calculates the tangent of two variables. The atan2() takes two arguments and return tangent after calculating it.

Syntax:

atan2(a, b)

where a and b are  two numbers.

Example:

<?php
$return = atan2(1, 2);
echo "The value of atan2(1, 2) is : " . $return . "<br />";

$return_value1 = atan2(1.5, 2.5);
echo "The value of atan2(1.5, 2.5) is : " . $return_value1 . "<br />";

$return_value2 = atan2(-1.5, -2.5);
echo "The value of atan2(-1.5, -2.5) is : " . $return_value2 . "<br />";
?> 

After running this example the output is:

Output:

The value of atan2(1, 2) is : 0.46364760900081
The value of atan2(1.5, 2.5) is : 0.54041950027058
The value of atan2(-1.5, -2.5) is : -2.6011731533192

Download Example Code

Go to Topic «PreviousHomeNext»

Your Comment:


Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image
 
 

 
Tutorial Topics