Program instructions
7.8 Math
S7-200 SMART
System Manual, V2.3, 07/2017, A5E03822230-AF
303
Natural logarithm (LN) and natural exponential (EXP) instructions
LAD / FBD
STL
Description
LN IN, OUT
The Natural Logarithm instruction (LN) performs the natural logarithm of the
value in IN and places the result in OUT.
The Natural Exponential instruction (EXP) performs the exponential operation of
e raised to the power of the value in IN and places the result in OUT.
•
LN (IN) = OUT
•
EXP (IN)= OUT
To obtain the base 10 logarithm from the natural logarithm: Divide the natural
logarithm by 2.302585 (approximately the natural logarithm of 10).
To raise any real number to the power of another real number, including frac-
tional exponents: Combine the Natural Exponential instruction with the Natural
Logarithm instruction. For example, to raise X to the Y power, use EXP (Y *
LN (X)).
EXP IN, OUT
Non-fatal errors with ENO = 0
SM bits affected
•
0006H Indirect address
•
SM1.1 Overflow
•
SM1.0 Result of operation = zero
•
SM1.1 Overflow, illegal value generated during the operation, or illegal input
•
SM1.2 Negative result
Input / outputs Data type
Operand
IN
REAL
1
ID, QD, VD, MD, SMD, SD, LD, AC, *VD, *LD, *AC, Constant
OUT
REAL
1
ID, QD, VD, MD, SMD, SD, LD, AC, *VD, *LD, *AC
1
Real (or floating-point) numbers are represented in the format described in the ANSI/IEEE 754-1985 standard (single-
precision). Refer to that standard for more information.