Investment Studio > Expressions > Functions > Math & Trig > ATAN2

float atan2(float x, float y)

Returns the arctangent of the specified coordinates.

The arctangent is the angle from the x-axis to a line containing the origin (0, 0) and a point with coordinates (x, y):

The angle is expressed in radians. Range: [-PI, PI]. A positive result represents a counterclockwise angle from the x-axis. A negative result represents a clockwise angle.

atan2(x, y) equals atan(y / x), extended to include the limit x = 0.

To convert the result to degrees, multiply by 180 / PI or use the degrees conversion function.

Example

=atan2(1, 1)

returns 0.785398163397448 = PI / 4 radians. You can verify that

=tan(PI / 4)

is 1. To express the arctangent in degrees, you can use

=degrees(atan2(1, 1))

to get the answer 45 degrees.

See also acos, asin, atan, tan.