C Programming Tutorial
C Programming allows us to perform mathematical operations through the functions defined in
C Math Functions
In the C Programming Language, the atan function returns the arc tangent of x.
Syntax
The syntax for the atan function in the C Language is:
double atan(double x);
Parameters or Arguments
The value used to calculate the arc tangent.
Returns
The atan function returns the arc tangent of a number represented by x. It will return a value between -π/2 and π/2.
Required Header
In the C Language, the required header for the atan function is:
#include <math.h>
Applies To
In the C Language, the atan function can be used in the following versions
- ANSI/ISO 9899-1990
atan Example
/* Example using atan by c programming */ #include <stdio.h> #include <math.h> int main(int argc, const char * argv[]) { /* Define temporary variables */ double value; double result; /* Assign the value we will find the atan of */ value = 0.5; /* Calculate the Arc Tangent of value */ result = atan(value); /* Display the result of the calculation */ printf("The Arc Tangent of %f is %f\n", value, result); return 0; }
When compiled and run, this application will output
The Arc Tangent of 0.500000 is 0.463648