Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

atan2

Returns the arctangent of Y/X in the range -pi to pi.

Returns the arctangent of Y/X in radians, using the signs of both arguments to determine the quadrant. Both arguments are coerced to Nv (f64). Stack order: Y is below X (Y pushed first).

Synopsis

my $angle = atan2(1, 1);       # pi/4
my $pi    = atan2(0, -1);      # pi
my $angle = atan2($y, $x);

See Also

sin, cos