This function is used to calculate arctangent of Y/X in the range -PI to PI.
Syntax: atan2(Y, X)
Parameters:
Y and X which are axis values
Returns: Function returns arctangent of Y/X in the range -PI to PI.
Example1:
$Y = 45;
$X = 70;
$return_val = atan2 ( $Y , $X );
print "atan2 of 45/70 is : $return_val\n" ;
|
Output:
atan2 of 45/70 is : 0.571337479833627
Example2:
$Y = -30;
$X = 40;
$return_val = atan2 ( $Y , $X );
print "atan2 of -30/40 is : $return_val\n" ;
|
Output:
atan2 of -30/40 is : -0.643501108793284
Whether you're preparing for your first job interview or aiming to upskill in this ever-evolving tech landscape,
GeeksforGeeks Courses are your key to success. We provide top-quality content at affordable prices, all geared towards accelerating your growth in a time-bound manner. Join the millions we've already empowered, and we're here to do the same for you. Don't miss out -
check it out now!
Last Updated :
25 Jun, 2019
Like Article
Save Article