Previous Topic: ExampleNext Topic: Defining a Compute Expression


Compute

The *COMPUTE built-in function enables you to define a complex arithmetic expression using the following mathematical operators on a single compute expression line.

Operator

Operation

Definition

+

*

/

\

*ADD

*SUB

*MULT

*DIV

*MODULO

addition

subtraction

multiplication

division

modulo

For more information on these operations, see, Understanding Built-In Functions *ADD, *SUB, *MULT, *DIV, and *MODULO subtopics earlier in this chapter.

There is one output parameter, the *Result field of the object type FLD, associated with this function type. It contains the result of the computation expression.

Note: You can define several additional parameters as needed by the details of the compute statement.

By default, intermediate results for each operation are contained in *Synon (17,7) Work fields. You can override the work fields with any valid field in the action diagram to contain intermediate results.

Note: The precision of the intermediate result fields affects the overall precision of the *COMPUTE expression. For example, the default fields are defined with a length of 7 decimal digits. Any rounding you specified for a multiplication or division operation occurs only in the following cases:

To force rounding, ensure that intermediate and final result fields have the appropriate number of decimal digits.