當前位置:首頁 » 編程語言 » log10函數C語言

log10函數C語言

發布時間: 2023-08-11 17:48:18

① C語言中log函數怎麼使用

先引用
#include <math.h>

假設要計算log3(9)的值,因為C語言的logx是以e為底的相當於lnx,如果以其他數作為對數的底,必須寫成
float i
i=log(9)/log(3);

② C語言中log函數怎麼使用呢

1、C語言中,有兩個log函數,分別為log10和log函數,具體用法如下:
2、函數名: log10
功 能: 對數函數log,以10為底
用 法: double log10(double x);
程序示例:
#include <math.h>
#include <stdio.h>int 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、函數名: log
功 能: 對數函數log,以e(2.71828)為底
用 法: double log(double x);
程序示例:
#include <math.h>
#include <stdio.h>int main(void)
{
double result;
double x = 800.6872;
result = log(x);
printf("The common log of %lf is %lf\n", x, result);
return 0;
}

熱點內容
製作自解壓安裝 發布:2025-03-20 05:41:49 瀏覽:302
華為連接電視密碼是多少 發布:2025-03-20 05:31:11 瀏覽:492
演算法第五版 發布:2025-03-20 05:17:57 瀏覽:730
湖南台訪問 發布:2025-03-20 05:10:32 瀏覽:38
腳本和秒搶 發布:2025-03-20 05:06:29 瀏覽:591
b35鎖如何設置密碼 發布:2025-03-20 05:06:27 瀏覽:905
淘寶如何租雲伺服器 發布:2025-03-20 05:05:12 瀏覽:213
編程忌諱 發布:2025-03-20 04:58:35 瀏覽:427
國家知識產權專利資料庫 發布:2025-03-20 04:54:29 瀏覽:416
win7怎麼給文件夾設密碼 發布:2025-03-20 04:52:38 瀏覽:725