English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
C ++the atan() function.
This function returns the arctangent value of a number (parameter) in radians form in<cmath>header file definition.
[Math] tan-1x = atan(x) [C++];
double atan(double x); float atan(float x); long double atan(long double x); double atan(T x); //are of integer type
The atan() function takes a mandatory parameter (can be positive, negative, or zero)
The atan() function returns[-π/ 2, π/ 2]values within the range.
#include <iostream> #include <cmath> using namespace std; int main() { double x = 57.74, result; result = atan(x); cout << "atan(x) = " << result << " radians " << endl; //Output Degrees cout << "atan(x) = " << result*180/3.1415 << " degrees " << endl; return 0; }
When running the program, the output is:
atan(x) = 1.55348 radians atan(x) = 89.0104 degrees
#include <iostream> #include <cmath> #define PI 3.141592654 using namespace std; int main() { int x = 14; double result; result = atan(x); cout << "atan(x) = " << result << " radians " << endl; //Output Degrees cout << "atan(x) = " << result*180/3.1415 << " degrees " << endl; return 0; }
When running the program, the output is:
atan(x) = 1.49949 radians atan(x) = 85.9169 degrees