# perldoc > atan2

---
type: CommandReference
command: atan2
mode: perldoc
section: 
source: perldoc
---

## Quick Reference

- `atan2(Y,X)` — returns arctangent of Y/X in range -PI to PI

## Name

atan2 - arctangent of Y/X

## Synopsis

`atan2 Y,X`

## Description

Returns the arctangent of Y/X in the range -PI to PI. The return value for `atan2(0,0)` is implementation-defined; consult your [atan2(3)](http://localhost/phpMan.php/man/atan2/3/markdown) manpage for more information. Portability issues: see `atan2` in perlport.

## Examples

For the tangent operation, you may use the `Math::Trig::tan` function, or use the familiar relation:

perl
sub tan { sin($_[0]) / cos($_[0])  }
## See Also

- [Math::Trig::tan](http://localhost/phpMan.php/perldoc/Math%3A%3ATrig%3A%3Atan/markdown) — tangent function
- [atan2(3)](http://localhost/phpMan.php/man/atan2/3/markdown) — implementation-defined behavior
- perlport — portability issues