6.11.17 atan Function

Calculates the trigonometric arc tangent function of a double precision floating-point value.

Include

<math.h>

Prototype

double atan(double x);

Argument

x
value for which to return the arc tangent

Return Value

Returns the arc tangent in the range of -π/2 to +π/2 radians (inclusive).

Example

See the notes at the beginning of this chapter or section for information on using printf() or scanf() (and other functions reading and writing the stdin or stdout streams) in the example code.

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

int main(void)
{
  double x, y;

  x = 2.0;
  y = atan (x);
  printf("The arctangent of %f is %f\n", x, y);

  x = -1.0;
  y = atan (x);
  printf("The arctangent of %f is %f\n", x, y);
}

Example Output

The arctangent of 2.000000 is 1.107149
The arctangent of -1.000000 is -0.785398