當前位置:首頁 » 編程語言 » 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 03:48:20 瀏覽:770
拆二代訪問 發布:2025-03-20 03:47:34 瀏覽:62
隨機數排序c語言 發布:2025-03-20 03:35:31 瀏覽:497
當前頁面腳本發生錯誤類型不匹配 發布:2025-03-20 03:26:47 瀏覽:991
strutsajax上傳圖片 發布:2025-03-20 03:25:03 瀏覽:385
手機在線緩存 發布:2025-03-20 03:21:06 瀏覽:45
ftp路徑上傳時間 發布:2025-03-20 03:13:42 瀏覽:103
電腦連接通訊伺服器失敗怎麼回事 發布:2025-03-20 03:10:30 瀏覽:286
cmake靜態編譯庫 發布:2025-03-20 02:55:25 瀏覽:409
手機存儲修復 發布:2025-03-20 02:48:14 瀏覽:269