1、C語言中,有兩個log函式,分別為log10和log函式,具體用法如下:
2、函式名: log10
功 能: 對數函式log,以10為底
用 法: double log10(double x);
程式示例:
#include
{
double result;
double x = 800.6872;
result = log10(x);
printf("The common log of %lf is %lf\n", x, result);
return 0;
}
3、函式名: log
功 能: 對數函式log,以e(2.71828)為底
用 法: double log(double x);
result = log(x);
1、C語言中,有兩個log函式,分別為log10和log函式,具體用法如下:
2、函式名: log10
功 能: 對數函式log,以10為底
用 法: double log10(double x);
程式示例:
#include
#include
{
double result;
double x = 800.6872;
result = log10(x);
printf("The common log of %lf is %lf\n", x, result);
return 0;
}
3、函式名: log
功 能: 對數函式log,以e(2.71828)為底
用 法: double log(double x);
程式示例:
#include
#include
{
double result;
double x = 800.6872;
result = log(x);
printf("The common log of %lf is %lf\n", x, result);
return 0;
}