C++ atan()
Anonymous contributor
Published Jun 18, 2021Updated May 15, 2024
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
nis zero, the result will be zero with the same sign. - If
nis positive 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:
All contributors
- Anonymous contributor
THE-Spellchecker
Christine_Yang- codewithdev
- garanews
christian.dinh
Contribute to Docs
- Learn more about how to get involved.
- Edit this page on GitHub to fix an error or make an improvement.
- Submit feedback to let us know how we can improve Docs.
Learn C++ on Codecademy
- Looking for an introduction to the theory behind programming? Master Python while learning data structures, algorithms, and more!
- Includes 6 Courses
- With Professional Certification
- Beginner Friendly.75 hours
- Learn C++ — a versatile programming language that’s important for developing software, games, databases, and more.
- Beginner Friendly.11 hours