atan - C math.h

C examples for math.h:atan

Type

function

From

<cmath>
<ctgmath>
<math.h>

Description

Compute arc tangent

Prototype

long double atanl (long double x);
long double atan (long double x);
     double atan(double x);
      float atanf (float x);
      float atan (float x);
     double atan (T x);           

Parameters

Parameter Description
xValue whose arc tangent is computed.

Return Value

Principal arc tangent of x, in the interval [-pi/2,+pi/2] radians.

Example

Demo Code

#include <stdio.h>
#include <math.h> /* atan */

#define PI 3.14159265/*from  w  ww. ja v a2  s.  c om*/

int main ()
{
  double param = 1.0;
  double result = atan (param) * 180 / PI;
  printf ("The arc tangent of %f is %f degrees\n", param, result );
  return 0;
}

Related Tutorials