About Arithmetic Expressions
Arithmetic expressions use arithmetic operators to combine operands (typically value expressions). When evaluated, these arithmetic expression yield a numeric result, if possible.
Operator | Meaning |
+ | Positive sign (unary +); addition |
– | Negative sign (unary -); subtraction |
^ | Exponentiation |
* | Multiplication |
/ | Division |
Note: If the ^ character is unavailable, you can substitute **.
The standard rules of precedence for arithmetic evaluation are used.
Examples of arithmetic expressions follow:
Salary * 1.1
Salary + (Salary*0.1)
(! + InterestRate)^Years
The data types (CHAR, NUMERIC, INT, and so on) of the operands used in an arithmetic expression can be mixed. Operands that are character strings are translated (if possible) into an equivalent number, as shown below:
‘/’ evaluates to 0
‘-2’ + 5 evaluates to 3
‘2’ * ‘-4’ evaluates to -8
If a character string cannot be translated into a number (e.g., abcd), then an error message is returned, or the operand is treated as if it were zero.