Round

C Definition

Not Applicable

Pascal Definition

Not Applicable

Description

The Round Operator block takes a floating point number parameter and returns the nearest whole number. Block program are generally working with floating point numbers. In many block operations such as looping or indexing into an array the round operator is internally provided and does not need to be explicit.

Escapes

The Round Operator block does not produce any escapes.

Examples

This illustrates the rounding principle

It might appear that this is necessary:

However the round is not necessary. The Loop Block does the rounding internally since it is clear a whole number is required. This is sufficient:

Note that it would be better to read the Count Editor's value just once and keep the value in a controller resident variable for deterministic performance. Otherwise communication delays relating to accessing Windows controls are included in every loop:

Similarly this might appear necessary when dealing with arrays:

However that round is already performed internally. It is sufficient to do this:

Related Topics

Trunc