Skip to main content

Example: Log function

Example 1

Dim natLog As Double
natLog# = Log(18) ' Assigns 2.89037175789617

Example 2

' Compute the base 10 logarithm of a number.
Function Log10 (inVal As Single) As Single
Log10 = Log(inVal!) / Log(10)
End Function
Print Log10(10) ' Output: 1
Print Log10(100) ' Output: 2
Print Log10(1 / 100) ' Output: -2
Print Log10(1) ' Output: 0