Latest web development tutorials

C library functions - atan ()

C standard library - <math.h> C standard library - <math.h>

description

C library functionsdouble atan (double x) Returns in radians the arctangent of x.

statement

Here is () statement atan function.

double atan(double x)

parameter

  • x - floating-point value.

return value

This function returns expressed in radians the arctangent of x, in radians interval [-pi / 2, + pi / 2].

Examples

The following example demonstrates the atan () function is used.

#include <stdio.h>
#include <math.h>

#define PI 3.14159265

int main ()
{
   double x, ret, val;
   x = 1.0;
   val = 180.0 / PI;

   ret = atan (x) * val;
   printf("%lf 的反正切是 %lf 度", x, ret);
   
   return(0);
}

Let's compile and run the above program, which will result in the following:

1.000000 的反正切是 45.000000 度

C standard library - <math.h> C standard library - <math.h>