Use arithmetic operators and functions, Use arithmetic operators and functions o – Rockwell Automation Logix5000 Controllers Structured Text Programming Manual User Manual

Page 15

Advertising
background image

Publication 1756-PM007D-EN-P - November 2012

15

Program Structured Text Chapter 1

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

Advertising