Log (source), Log10 (number) – Campbell Scientific CR5000 Measurement and Control Module User Manual

Page 187

Advertising
background image

Section 8. Processing and Math Instructions

8-15

Dim A, B, C, D

'Declare variables.

BeginProg
A = Int(-99.8)

'Returns -100

B = Fix(-99.8)

'Returns -99

C = Int(99.8)

'Returns 99

D = Fix(99.8)

'Returns 99

EndProg

Log (Source)

Returns the natural logarithm of a number.

Syntax
x = Log (
source)

Remarks
The source can be any valid numeric expression that results in a value greater
than 0. The natural logarithm is the logarithm to the base e. The constant e is
approximately 2.718282.

You can calculate base-n logarithms for any number x by dividing the natural
logarithm of x by the natural logarithm of n as follows:

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

The following example illustrates a procedure that calculates base-10
logarithms:

Log10 = Log(X) / Log(10)

Log Function Example

The example calculates the value of e, then uses the Log function to calculate
the natural logarithm of e to the first, second, and third powers.

Dim I, M

'Declare variables.

BeginProg
M = Exp(1)
For I = 1 To 3

'Do three times.

M =Log(Exp(1) ^ I)

Next I
EndProg

LOG10 (number)

The LOG10 function returns the base 10 logarithm of a number.

Syntax
LOG10( number )

Remarks
The LOG10 function returns the logarithm base 10 of a number.

The Number argument can be any valid numeric expression that has a value
greater than 0. You can calculate base-n logarithms for any number x by
dividing the logarithm base 10 of x by the logarithm base 10 of n as follows:

Advertising