Perl | atan2() Function
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:
#!/usr/bin/perl # Assigning values to X and y $Y = 45; $X = 70; # Calling atan2() function $return_val = atan2($Y, $X); # printing the value print "atan2 of 45/70 is : $return_val\n"; |
chevron_right
filter_none
Output:
atan2 of 45/70 is : 0.571337479833627
Example2:
#!/usr/bin/perl # Assigning values to X and y $Y = -30; $X = 40; # Calling atan2() function $return_val = atan2($Y, $X); # printing the value print "atan2 of -30/40 is : $return_val\n"; |
chevron_right
filter_none
Output:
atan2 of -30/40 is : -0.643501108793284
Recommended Posts:
- Perl | tell() Function
- Perl | chr() Function
- Perl | each() Function
- Perl | hex Function
- Perl | int() function
- Perl | ord() Function
- Perl | uc() Function
- Perl | oct() Function
- Perl | log() Function
- Perl | abs() function
- Perl | exp Function
- Perl | sin() Function
- Perl | cos() Function
- Perl | grep() Function
- Perl | length() Function
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.



