Conditional statements – Rockwell Automation T3833 ICS Regent Math Package for Winterpret User Manual

Page 5

Advertising
background image

Math Package for W

INTERPRET

(T3833)


P D - 6 0 4 3 M a r c h , 0 6

5

ROOT1 = (-B + SQRT(B^2 - 4*A*C)) / (2*A)

The exponentiation operator (Y^X) can only raise Y to an
integer power X. If you need to calculate YX for non-integer

values of X you can use the LN(X) and EXP(X) functions as
shown below.

Y_2_THE_X = EXP(X*LN(Y))

Conditional Statements

The statements available in the floating point math let you
alter program flow based on testing of conditions.

IF, ELSE, and ENDIF

The IF statement is used to make a decision regarding
program flow based on the result returned by an expression.
The expression can include mathematical and logical
operators. The use of ELSE within the lines controlled by the
IF statement is optional.

Syntax:

IF expression

ELSE (optional)

ENDIF

IF, ELSE, and ENDIF statements must not be combined on
the same line.

WHILE and ENDW

The WHILE statement executes a series of statements in a
loop as long as the expression is true. The expression can
include mathematical and logical operators.

Syntax:

WHILE expression

loop statement

Note:

Advertising