The value of an expression is printed unless the main
operator is an assignment.
Precedence is the same as the order
of presentation here, with highest appearing first.
Left or right associativity, where applicable, is
discussed with each operator.
Named expressions are places where values are stored. Simply stated, named expressions are legal on the left side of an assignment. The value of a named expression is the value stored in the place named.
Simple identifiers are named expressions. They have an initial value of zero.
Array elements are named expressions. They have an initial value of zero.
The internal registers scale, ibase and obase are all named expressions. scale is the number of digits after the decimal point to be retained in arithmetic operations. scale has an initial value of zero. ibase and obase are the input and output number radix respectively. Both ibase and obase have initial values of 10.
A function call consists of a function name followed by parentheses containing a comma-separated list of expressions, which are the function arguments. A whole array passed as an argument is specified by the array name followed by empty square brackets. All function arguments are passed by value. As a result, changes made to the formal parameters have no effect on the actual arguments. If the function terminates by executing a return statement, the value of the function is the value of the expression in the parentheses of the return statement or is zero if no expression is provided or if there is no return statement.
The result is the square root of the expression. The result is truncated in the least significant decimal place. The scale of the result is the scale of the expression or the value of scale, whichever is larger.
The result is the total number of significant decimal digits in the expression. The scale of the result is zero.
The result is the scale of the expression. The scale of the result is zero.
Constants are primitive expressions.
An expression surrounded by parentheses is a primitive expression. The parentheses are used to alter the normal precedence.
The unary operators bind right to left.
The result is the negative of the expression.
The named expression is incremented by one. The result is the value of the named expression after incrementing.
The named expression is decremented by one. The result is the value of the named expression after decrementing.
The named expression is incremented by one. The result is the value of the named expression before incrementing.
The named expression is decremented by one. The result is the value of the named expression before decrementing.
The exponentiation operator binds right to left.
The result is the first expression raised to the power of the second expression. The second expression must be an integer. If a is the scale of the left expression and b is the absolute value of the right expression, then the scale of the result is:
min(a×b,max(scale,a))
The operators *, /, % bind left to right.
The result is the product of the two expressions. If a and b are the scales of the two expressions, then the scale of the result is:
min(a+b,max(scale,a,b))
The result is the quotient of the two expressions. The scale of the result is the value of scale.
The % operator produces the remainder of the division of the two expressions. More precisely, a%b is a-a/b*b.
The scale of the result is the sum of the scale of the divisor and the value of scale
The additive operators bind left to right.
The result is the sum of the two expressions. The scale of the result is the maximun of the scales of the expressions.
The result is the difference of the two expressions. The scale of the result is the maximum of the scales of the expressions.
The assignment operators bind right to left.
This expression results in assigning the value of the expression on the right to the named expression on the left.
The result of the above expressions is equivalent to ``named expression = named expression OP expression'', where OP is the operator after the = sign.