|
Standard Mathematical Operators
All the standard mathematical operators, such as + or -, are supported in GPP. The standard precedence order is kept (power is highest priority, multiply, divide and modulus come next, plus and minus are lowest).
The following standard operators and constructs are supported:
(<num-expr>) Parenthesis
- <num-expr> Single expression negation (like -X)
<num-expr> ** <num-expr> Exponent (X to the power of Y)
<num-expr> * <num-expr> Multiplication
<num-expr> / <num-expr> Division
<num-expr> _MOD_ <num-expr> Modulus
<num-expr> + <num-expr> Addition
<num-expr> - <num-expr> Subtraction
The modulus operator gives the remainder of the division of the first operand by the second. For instance, if X is equal 372.5, then X _MOD_ 360 gives 12.5.
The order of execution of operators is always left to right. Therefore, 16 / 4 / 2 will yield the value 2.
In division and modulus, if the second operand is equal to zero, a runtime error is generated (divide-by-zero).
|