Go to the first, previous, next, last section, table of contents.
In the following descriptions of legal expressions, "expr" refers to a
complete expression and "var" refers to a simple or an array variable.
A simple variable is just a
name
and an array variable is specified as
name[expr]
Unless specifically mentioned the scale of the result is the maximum
scale of the expressions involved.
 expr

The result is the negation of the expression.
++ var

The variable is incremented by one and the new value is the result of
the expression.
 var

The variable
is decremented by one and the new value is the result of the
expression.
var ++

The result of the expression is the value of
the variable and then the variable is incremented by one.
var 

The result of the expression is the value of the variable and then
the variable is decremented by one.
expr + expr

The result of the expression is the sum of the two expressions.
expr  expr

The result of the expression is the difference of the two expressions.
expr * expr

The result of the expression is the product of the two expressions.
expr / expr

The result of the expression is the quotient of the two expressions.
The scale of the result is the value of the variable
scale
expr % expr

The result of the expression is the "remainder" and it is computed in the
following way. To compute a%b, first a/b is computed to scale
digits. That result is used to compute a(a/b)*b to the scale of the
maximum of scale+scale(b) and scale(a). If scale is set
to zero and both expressions are integers this expression is the
integer remainder function.
expr ^ expr

The result of the expression is the value of the first raised to the
second. The second expression must be an integer. (If the second
expression is not an integer, a warning is generated and the
expression is truncated to get an integer value.) The scale of the
result is scale if the exponent is negative. If the exponent
is positive the scale of the result is the minimum of the scale of the
first expression times the value of the exponent and the maximum of
scale and the scale of the first expression. (e.g. scale(a^b)
= min(scale(a)*b, max(scale, scale(a))).) It should be noted
that expr^0 will always return the value of 1.
( expr )

This alters the standard precedence to force the evaluation of the
expression.
var = expr

The variable is assigned the value of the expression.
var <op>= expr

This is equivalent to "var = var <op> expr" with the
exception that the "var" part is evaluated only once. This can
make a difference if "var" is an array.
Go to the first, previous, next, last section, table of contents.