lang • log

Log

Value = Log ( Number AS Float )

Computes natural logarithm of a number i.e. logarithm to base e, where e is an irrational constant approximately equal to 2.71828. The number must be greater than zero. It cannot be negative or zero.

Gambas has built-in functions to calculate base-2 and base-10 logarithm.

To calculate base-n logarithms the following relation can be used: Logn(x) = Log(x) / Log(n)

Errors

Message

Description
Mathematical error (19) Number is negative or zero.

Examples

Print Log(2.71828)
0.999999327347
Dim i As Integer
For i = 1 To 50 Step 10
  Print i, Log(i)
Next
1    0
11   2.397895272798
21   3.044522437723
31   3.433987204485
41   3.713572066704

See also