Natural logarithm (LN) and natural exponential (EXP) instructions
LAD / FBD
STL
LN IN, OUT
EXP IN, OUT
Non-fatal errors with ENO = 0
0006H Indirect address
•
SM1.1 Overflow
•
Input / outputs
Data type
IN
REAL
1
OUT
REAL
1
Real (or floating-point) numbers are represented in the format described in the ANSI/IEEE 754-1985 standard (single-
1
precision). Refer to that standard for more information.
S7-200 SMART
System Manual, V2.3, 07/2017, A5E03822230-AF
Description
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)).
SM bits affected
SM1.0 Result of operation = zero
•
SM1.1 Overflow, illegal value generated during the operation, or illegal input
•
SM1.2 Negative result
•
Operand
ID, QD, VD, MD, SMD, SD, LD, AC, *VD, *LD, *AC, Constant
ID, QD, VD, MD, SMD, SD, LD, AC, *VD, *LD, *AC
Program instructions
7.8 Math
303