c语言函数log10()应用返回以10为底的对数值。头文件:#include <math.h>
定义函数:double log10(double x);
log10()函数使用介绍:log10()用来计算以10 为底的x 对数值,然后将结果返回。
返回值:返回参数x 以10 为底的对数值。
错误代码:
EDOM 参数x 为负数;
RANGE 参数x 为零值,零的对数值无定义。
注意,使用 GCC 编译时请加入-lm。
log10()函数实例
#include <math.h> main(){ double answer; answer = log10(100); printf("log10(100) = %f\n", answer); }
执行
log10(100) = 2.000000