cbrt函数用法详解
cbrt函数简介
- 头文件包含
#include <math.h>
- 函数定义
double cbrt(double x );
float cbrtf(float x );
long double cbrtl(long double x );
- 编译链接选项
-lm
cbrt函数常见使用错误
- 链接错误
undefined reference to `cbrt'
解决办法:添加链接选项
-lm
- 编译错误
warning: implicit declaration of function ‘cbrt’ [-Wimplicit-function-declaration]
解决办法:包含头文件
#include <math.h>
cbrt函数详细描述
这些函数返回x 的(实)立方根,此函数不能失败;每个可表示的实值都有一个可表示的实立方根。
cbrt函数返回值
这些函数返回x 的多维数据集根
如果x是+0、-0、正无穷大、负无穷大或NaN,则返回x。
cbrt函数错误码
不会发生错误。
评论区