最佳答案:原型:double log (double x);头文件:math.h功能:计算以e 为底的对数值程序例:#include <math.h>#include <stdio.h>
原型:double log (double x);
头文件:math.h
功能:计算以e 为底的对数值
程序例:
#include <math.h>
#include <stdio.h>
int main(void)
{
double result;
double x = 321.123;
result = log(x);
printf("The common log of %lf is %lf\n", x, result);
return 0;
}
C语言里面有该函数,所以输入一个双精度浮点数,对其进行函数变换即可生成其对数。
还有如果你的意思是输入对数进行幂运算的话有下面这个函数
原型:extern float pow(float x, float y);
用法:#include <math.h>
功能:计算x的y次幂。
说明:x应大于零,返回幂指数的结果。
举例:
// pow.c
#include <stdlib.h>
#include <math.h>
#include <conio.h>
void main()
{
printf("4^5=%f",pow(4.,5.));
getchar();
}