Math Functions

math.atan2()

Find the angle of a vector with components x and y, using both signs to resolve the quadrant. The y argument comes first.

Formal Syntax & Structure

python syntaxpython
math.atan2(y, x, /)

Parameters & Attributes

NameTypeDescription
yreal numberVertical component of the vector.
xreal numberHorizontal component of the vector.

Return Value

float

Floating-point result; finite precision and domain restrictions apply.

Working Example

Example Snippetpython
import mathprint(round(math.atan2(1, -1), 6))
Python Reference