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

來源:趣味經驗館 2.04W
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); }。

熱門標籤