< Perl Programming < Keywords
![](../../../I/Crystal_Clear_action_apply.png.webp)
The code
prints the arc tangent in radians and degrees:
The atan2 keyword
atan2 is the trigonometric function tangent that returns the arctangent of Y/X in the range -π to π.
Syntax
atan2 Y, X
Examples
![](../../../I/Crystal_Clear_action_apply.png.webp)
*PI = \3.1415926535;
$a = 3;
$b = 5;
$arctan = atan2($a, $b);
print "arctan(" . $a . ", " . $b . ") = " . $arctan . " rad = " . $arctan*180/$PI . " deg\n";
This article is issued from Wikibooks. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.