atan()

Anonymous contributor's avatar
Anonymous contributor
Anonymous contributor's avatar
Anonymous contributor
Published Jun 18, 2021Updated Dec 21, 2022
Contribute to Docs

The atan() function returns the inverse tangent of an argument in radians.

Syntax

atan(n)

The n parameter can be any real number (positive, negative, or zero).

  • If n is zero, the result will be zero with the same sign.
  • If n is postive or negative infinity, the result will be 1.5708 radians with the same sign.

Example

The following example uses the atan() function that returns the inverse tangent of value 0.0:

#include <iostream>
#include <cmath>
int main() {
double x = 0.0;
double result;
result = std::atan(x);
std::cout << result << " radians" << "\n";
}

This produces the following output:

0.0 radians

Codebyte Example

The following example returns the inverse tangent of the value with the atan() function:

Code
Output
Loading...

All contributors

Looking to contribute?

Learn C++ on Codecademy