網站首頁 學習教育 IT科技 金融知識 旅遊規劃 生活小知識 家鄉美食 養生小知識 健身運動 美容百科 遊戲知識 綜合知識
當前位置:趣知科普吧 > 綜合知識 > 

怎麼用c語言表示ln|怎麼用c語言寫ln

欄目: 綜合知識 / 發佈於: / 人氣:2.01W
1.怎麼用c語言表示ln

VB中ln是用Log來表示

怎麼用c語言寫ln 怎麼用c語言表示ln

Log 函數

返回一個 Double,指定參數的自然對數值

Log 函數示例

本示例使用 Log 函數得到某數的自然對數值。

Dim MyAngle, MyLog

' 定義角度(以“弧度”爲單位)。

MyAngle = 1.3

' 計算反雙曲正弦函數值(inverse sinh())。

MyLog = Log(MyAngle + Sqr(MyAngle * MyAngle + 1))

2.c語言中的log,ln,lg怎麼編寫

c 裏直接提供的是 以 e 爲底的自然對數 log ,和 以 10 爲底的常用對數 log10 其他對數寫個函數就可以 #include #include double loga(double n, double base); int main (void) { double a, b, c; a = log(exp(1)); b = log10(10); c = loga(100, 5); printf("%lf %lf %lf", a, b, c); } double loga(double n, double base) { return log(n) / log(base); }。

Tags:ln 語言