Constants, Arithmetic operators, Constants -6 arithmetic operators -6 – Rockwell Automation FactoryTalk View Machine Edition Users Guide User Manual

Page 484

Advertising
background image

F

ACTORY

T

ALK

V

IEW

M

ACHINE

E

DITION

U

SER

S

G

UIDE

23-6

• •

To create a tag placeholder in an expression

Type the cross-hatch character followed by a number (no space in between). For
example, #1.

Constants

A constant can have any of the following formats:

Integer (123)

Floating-point (123.45)

String constant (“character string”)

Arithmetic operators

Arithmetic operators perform math on two or more numeric values and calculate the
result. The arithmetic operators are:

Symbol

Operator

Example
(For these examples, tag1 = 5 and tag2 = 7)

+

addition

tag1 + tag2
returns a value of 12

You can also use this operator with string
operands. See page 23-7.

-

subtraction

tag1 - tag2
returns a value of -2

*

multiplication

tag1 * tag2
returns a value of 35

/

division

tag1 / tag2
returns a value of 0.7142857

MOD,%

modulus (remainder)

tag2 MOD tag1
returns a value of 2

The modulus operator is the remainder of one
number divided by another. In the example, the
remainder of 7 divided by 5 is 2; so 7 % 5 = 2

Important: This operator is for integers only,
not floating-point numbers.

**

exponent

tag1 ** tag2
returns a value of 78125

Advertising