C atan2() Function

Last Updated:

C atan2()

The atan2() function returns the angle in the plane between the positive x-axis and the ray from (0, 0) to the point (x, y), for atan2(y, x).

This function is defined in <math.h> header file.

Example

C Compiler
#include <stdio.h> #include <math.h> int main() { printf("%lf", atan2(8, 2)); return 0; }

Syntax

atan2(data_type y, data_type x)

Parameter Values

ValueTypeExplanation
y Required Specifies the y coordinate of the point.
x Required Specifies the x coordinate of the point.

Return Value

ValueExplanation
Number The arc-tangent of the quotient of its arguments.
The return value will be between -π and π.
The return value is represented in radians.

Share this Page

Meet the Author