Log Function (BASIC)

傳回一個數字的自然對數。

Syntax:


Log (Number)

Return value:

Double

Parameters:

Number:要計算自然對數的任意數值型表示式。

自然對數是以 e 為底數的對數。底數 e 是一個常數,近似值為 2.718282…。

計算任意數 x 以 n 為底數的對數的方法是:用 x 的自然對數除以 n 的自然對數,如下所示:

Logn(x) = Log(x) / Log(n)

錯誤代碼:

5 無效的程序呼叫

Example:


Sub ExampleLogExp
Dim a As Double
Dim Const b1=12.345e12
Dim Const b2=1.345e34
    a=Exp( Log(b1)+Log(b2) )
    MsgBox "" & a & chr(13) & (b1*b2) ,0,"Multiplication by logarithm function"
End Sub

Please support us!