Arithmetic Expressions

Arithmetic expressions perform specified operations on designated arithmetic primaries to return numerical values.

<arithmetic expression>

──┬─<simple arithmetic expression>──────┬──────────────────────────────┤
  ├─<conditional arithmetic expression>─┤
  └─<try arithmetic expression>─────────┘

<simple arithmetic expression>

          ┌◄─ <arithmetic operator> ─┐
──┬─────┬─┴─<arithmetic primary>─────┴─────────────────────────────────┤
  ├─ + ─┤
  └─ - ─┘

The evaluation of a conditional arithmetic expression is described in Conditional Expressions.

<try arithmetic expression>

── TRY ─┬─<try limited form>───────────┬───────────────────────────────┤
        └─<try arithmetic normal form>─┘

<try arithmetic normal form>

                          ┌◄────────────────────────────────┐
──<arithmetic expression>─┴─ ELSE ──<arithmetic expression>─┴──────────┤

An explanation of <try arithmetic expression> is given in TRY Expression.

Precision of Arithmetic Expressions

The value of an arithmetic expression can be expressed in single or double-precision, depending on the precision of its constituents or, in the case of MUX, on the operator involved. The value of an arithmetic expression is double-precision if any variable, function, or number of which it is composed is of type DINTEGER or DOUBLE, or if two primaries are combined by the double-precision operator MUX. The MUX operator allows a double-precision result to be obtained from the multiplication of two single-precision arithmetic primaries.

The value of a case expression is double-precision if any expression in its arithmetic expression list is of type DINTEGER or DOUBLE. Likewise, the value of a conditional arithmetic expression is double-precision if either arithmetic expression is double-precision. In either case, single-precision arithmetic expressions are converted to double-precision, when necessary.