C atan()

The atan() function computes the arc tangent of an argument.

C atan() Prototype

double atan(double x);

Function atan() takes a single argument as a double and returns the value in radians.

The returned value of atan() is of type double.

For better understanding of atan():

[Mathematics] tan-1x = atan(x) [In C programming] 

It is defined in <math.h> header file.


C atan() range

Library function atan() take any value from negative to positive.


Example: C atan() function

#include <stdio.h>
#include <math.h>
#define PI 3.141592654

int main()
{
    double num = 1.0;
    double result;

    result = atan(num);

    printf("Inverse of tan(%.2f) = %.2f in radians", num, result);

    // Converting radians to degrees
    result = (result * 180) / PI;
    printf("\nInverse of tan(%.2f) = %.2f in degrees", num, result);

    return 0;
}

Output

Inverse of cos(1.00) = 0.79 in radians
Inverse of cos(1.00) = 45 in degrees