beautypg.com

Round function, Sel function, Round( a ) round( a, n ) – Delta RMC151 User Manual

Page 378: Sel( cond, a, b )

background image

RMC70/150 and RMCTools User Manual

Return Value

Returns the same data type as a.

Remarks

The result of an invalid n is undefined.

Examples

ROR(16#0000000F, 2) returns 16#C0000003

5.14.2.35. ROUND Function

ROUND(a)
ROUND(a
, n)
Rounds a to n decimal places.

Parameters

a (REAL)
The input value.
n (DINT)
The number of decimal places to round a to. If n is omitted, it is assumed to be 0, and a

will be rounded to the nearest integer. n can be between -6 and 6. Negative values

specify decimal places to the left of the decimal. Positive values specify decimal places to

the right of the decimal.

Return Value

Returns a REAL.

Remarks

0.5 rounds up to 1.0.
Rounding -0.5 differs between the RMCs:

The RMC75E and RMC150E will round -0.5 to -1.0.

The RMC75S and RMC75P will round -0.5 to 0.0.

If n is outside of the range -6 to 6, the task will fault. An error will be logged in the Event

Log and the user program running on the task will stop.

Examples

ROUND(0.5) returns 1.0
ROUND(123456,-3) returns 123000
ROUND(0.9876,2) returns 0.99

5.14.2.36. SEL Function

SEL(cond, a, b)
Evaluates the boolean condition cond. If cond is true, the function returns a. If cond is false,

the function returns b. Also known as an in-line IF statement.

358

Delta Computer Systems, Inc.

This manual is related to the following products: