1.2.2 Using Arithmetic Operators and Functions
Six standard arithmetic operators are available for use in $repeat and $macro commands. The following table lists these operators and their order of precedence, from highest to lowest.
| Operator | Examples | Description | Precedence |
|---|---|---|---|
| ** | 2**3 | Exponentiation | 1 |
| * | 2*I | Multiplication | 2 |
| / | 4/2 | Division | 2 |
| % | 9%8 | Modulus | 2 |
| + | 2+4 | Addition | 3 |
| - | 4-I | Subtraction | 3 |
One arithmetic function is available for use in arithmetic expressions used in $repeat and $macro commands. The following table shows the arithmetic function and its bases.
| Function | Base |
|---|---|
| LOG2 | Binary |
| LOG8 | Octal |
| LOG16 | Hexadecimal |
| LOG | Decimal |
The LOG function returns an integer value. For example:
LOG2(32)= 5 <==> 2**5 =
32
|
Ceil(x) returns the smallest integer that is not less than x.
