C atan()

C atan() Prototype

double atan(double x);

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

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

For a Better Understanding of atan():

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

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


C atan() Range

The library function atan() can 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 tan(1.00) = 0.79 in radians
Inverse of tan(1.00) = 45.00 in degrees