atan in c
atan in c programming

What is atan in c programming?

atan in c is a mathematical function which is used to find arc tangent value of a given number in radians.

This function is defined in math.h header file.

Prototype

#include<math.h>
double atan(double y);

Parameter

atan function takes floating point value as angle in radians.

Return value

This function returns arc tangent of a given number.


Example program for atan in c

#include <stdio.h>
#include <math.h>
#define PI 3.14
int main() 
{
   double x, res, val1;
   x=15.0;
   val1=PI/180;
   res=atan(x*val1);
   printf("The arc tan of %lf is %lf degrees", x, res);
   return 0;
}
Example program for atan in c programming
Output of Example program for atan function in c programming

While using gcc use below command to add math header.

gcc file_name.c -lm

Code explanation

The variable val1 is converted in terms of degrees and passed along with input value to atan function. The arc tangent value is being printed onto the console.

atan() Man page


Difference between atan and tan in c

atan in c is a mathematical function that is used to find the arc tangent value of a given number in radians. tan in c is a mathematical function that is used to find the tangent of a given number.

Prototypes are as follows

double atan(double y);

double tan(double y);
atan( )tan( )
Used to find arc tangent of a given number.Used to find tangent of a given number.
double atan(double y);double tan(double y);

Difference between atan and tanh in c

atan in c is a mathematical function that is used to find the arc tangent value of a given number in radians. tanh in c is used to find the hyperbolic tangent of a given number.

Prototypes are as follows

double atan(double y);

double tanh(double y);
atan in ctanh in c
Used to find arc tangent of given numberUsed to find hyperbolic tangent of given number.
double atan(double y);double tanh(double y);

People also ask for

What is atan in c?

atan in c is a mathematical function that is used to find the arc tangent value of a given number in radians. It is defined in math.h header file.