📅  最后修改于: 2020-09-25 07:26:21             🧑  作者: Mango
[Mathematics] ∛x = cbrt(x) [In C Programming]
此函数在
double cbrt(double x);
float cbrt(float x);
long double cbrt(long double x);
double cbrt(T x); // For integral type
cbrt() 函数采用一个要计算其立方根的参数。
cbrt() 函数返回给定参数的立方根。
#include
#include
using namespace std;
int main()
{
double x = -1000.0, result;
result = cbrt(x);
cout << "Cube root of " << x << " is " << result << endl;
return 0;
}
运行该程序时,输出为:
Cube root of -1000 is -10
#include
#include
using namespace std;
int main()
{
long x = 964353422;
double result = cbrt(x);
cout << "Cube root of " << x << " is " << result << endl;
return 0;
}
运行该程序时,输出为:
Cube root of 964353422 is 987.974