1、C語(yǔ)言中,有兩個(gè)log函數(shù),分別為log10和log函數(shù),具體用法如下:
成都創(chuàng)新互聯(lián)制作網(wǎng)站網(wǎng)頁(yè)找三站合一網(wǎng)站制作公司,專(zhuān)注于網(wǎng)頁(yè)設(shè)計(jì),成都做網(wǎng)站、網(wǎng)站建設(shè),網(wǎng)站設(shè)計(jì),企業(yè)網(wǎng)站搭建,網(wǎng)站開(kāi)發(fā),建網(wǎng)站業(yè)務(wù),680元做網(wǎng)站,已為上千余家服務(wù),成都創(chuàng)新互聯(lián)網(wǎng)站建設(shè)將一如既往的為我們的客戶(hù)提供最優(yōu)質(zhì)的網(wǎng)站建設(shè)、網(wǎng)絡(luò)營(yíng)銷(xiāo)推廣服務(wù)!
2、函數(shù)名: log10
功 能: 對(duì)數(shù)函數(shù)log,以10為底
用 法: double log10(double x);
程序示例:
#include math.h
#include stdio.hint main(void)
{
double result;
double x = 800.6872;
result = log10(x);
printf("The common log of %lf is %lf\n", x, result);
return 0;
}
3、函數(shù)名: log
功 能: 對(duì)數(shù)函數(shù)log,以e(2.71828)為底
用 法: double log(double x);
程序示例:
#include math.h
#include stdio.hint main(void)
{
double result;
double x = 800.6872;
result = log(x);
printf("The common log of %lf is %lf\n", x, result);
return 0;
}
1、C語(yǔ)言中,有兩個(gè)log函數(shù),分別為log10和log函數(shù),具體用法如下:
2、函數(shù)名: log10
功 能: 對(duì)數(shù)函數(shù)log,以10為底
用 法: double log10(double x);
程序示例:
#include math.h
#include stdio.hint main(void)
{
double result;
double x = 800.6872;
result = log10(x);
printf("The common log of %lf is %lf\n", x, result);
return 0;
}
3、函數(shù)名: log
功 能: 對(duì)數(shù)函數(shù)log,以e(2.71828)為底
用 法: double log(double x);
程序示例:
#include math.h
#include stdio.hint main(void)
{
double result;
double x = 800.6872;
result = log(x);
printf("The common log of %lf is %lf\n", x, result);
return 0;
}
#include stdio.h#include math.h
void main()
{
double i = 2, j =4;
printf("log2,4 = %f\n",log(j)/log(i));
}
//log函數(shù)是以e為底的,還有一個(gè)log10以10為底,可以利用logi,j=loge,j/loge,i來(lái)算。
x的自然對(duì)數(shù)用log(x)表示
常用對(duì)數(shù)用log10(x)表示
#includestdio.h
#includemath.h
int main()
{int i;
for(i=1;i=10;i++)
printf("log10(%d)=%lf\n",i,log10(i));
return 0;
}