674 Rockwell Automation Publication 1756-RM003N-EN-P - October 2011
Appendix C Structured Text Programming
Use Arithmetic Operators and Functions
You can combine multiple operators and functions in arithmetic expressions.
Arithmetic operators calculate new values.
Arithmetic functions perform math operations. Specify a constant, a non-
boolean tag, or an expression for the function.
To Use this operator Optimal data type
Add + DINT, REAL
Subtract/negate - DINT, REAL
Multiply * DINT, REAL
Exponent (x to the power of y) ** DINT, REAL
Divide / DINT, REAL
Modulo-divide MOD DINT, REAL
For Use this function Optimal data type
Absolute value ABS (numeric_expression) DINT, REAL
Arc cosine ACOS (numeric_expression)REAL
Arc sine ASIN (numeric_expression)REAL
Arc tangent ATAN (numeric_expression)REAL
Cosine COS (numeric_expression)REAL
Radians to degrees DEG (numeric_expression) DINT, REAL
Natural log LN (numeric_expression)REAL
Log base 10 LOG (numeric_expression)REAL
Degrees to radians RAD (numeric_expression) DINT, REAL
Sine SIN (numeric_expression)REAL
Square root SQRT (numeric_expression) DINT, REAL
Tangent TAN (numeric_expression)REAL
Truncate TRUNC (numeric_expression) DINT, REAL