📅  最后修改于: 2020-09-25 07:22:57             🧑  作者: Mango
此函数在
[Mathematics] tan-1x = atan(x) [In C++ Programming];
double atan(double x);
float atan(float x);
long double atan(long double x);
double atan (T x); // For integral type
atan() 函数采用单个强制性参数(可以为正,负或零)
atan() 函数返回[-π/ 2,π/ 2]范围内的值。
#include
#include
using namespace std;
int main()
{
double x = 57.74, result;
result = atan(x);
cout << "atan(x) = " << result << " radians" << endl;
// Output in degrees
cout << "atan(x) = " << result*180/3.1415 << " degrees" << endl;
return 0;
}
运行该程序时,输出为:
atan(x) = 1.55348 radians
atan(x) = 89.0104 degrees
#include
#include
#define PI 3.141592654
using namespace std;
int main()
{
int x = 14;
double result;
result = atan(x);
cout << "atan(x) = " << result << " radians" << endl;
// Output in degrees
cout << "atan(x) = " << result*180/3.1415 << " degrees" << endl;
return 0;
}
运行该程序时,输出为:
atan(x) = 1.49949 radians
atan(x) = 85.9169 degrees