Logarithmic operators – Rockwell Automation 1771-DB BASIC MODULE User Manual

Page 123

Advertising
background image

Chapter
Expressions, Variables and Operators

9

9 -13

The BASIC module contains a complete set of logarithmic operators.
These operators are one-operand operators.

LOG

Use the LOG operator to return the natural logarithm of the argument.
The argument must be greater than 0. This calculation is carried out to 7
significant digits.

>PRINT LOG(12)

Result:

2.484906

>PRINT LOG(EXP(1))

Result:

1

If you need base 10 log, use this expression:

log

10

(x)=log(x)/log(10)

EXP

Use the EXP operator to raise the number e (2.7182818) to the power of
the argument. This operator is the inverse of the LOG operator. The EXP
operator is similar to the ** operator in that it raises a number to a power.
However, it is different from the ** operator in that the only number that is
raised is 2.7182818. (See also ** page 9 -5.)

>PRINT EXP(1)

Result:

2.7182818

>PRINT EXP(2)

Result:

7.3890559

>PRINT EXP(3)

Result:

20.0855362

>PRINT EXP(LOG(2))

Result

: 2

Logarithmic Operators

Advertising