Operators in rate routine steps
The operator in a rate routine step can be an assignment, arithmetic, or rounding operator or blank.
Blank operator
The operator can be blank if it is unspecified or if the Instruction field contains a conditional.
Assignment operator
There is one assignment operator:
- ← – Assign the operand to the instruction.
Arithmetic operators
| Operator | Description |
|---|---|
| x | Multiply the previous expression with the operand. |
| ÷ | Divide the previous expression by the operand. |
| + | Add operand to the previous expression. |
| - | Subtract the operand from the previous expression. |
Rounding operators
A rounding operator rounds the results of the previous expression to the specified scale. A step with a rounding operator must be last step of an expression. In the base configuration, the rounding operators are:
| Operator | Description |
|---|---|
| R | Round half up. Round towards the nearest number according to scale. If both numbers are equidistant, round up. Always round away from 0. |
| RD | Round down. Round down to the nearest number according to scale. Always round towards 0. |
| RU | Round up. Round up to the nearest number according to scale. Always round away from 0. |
| RE | Round half-even. Round towards the nearest number according to scale. If both numbers are equidistant, round towards the even number. |
The following table contains some examples of rounding.
Operator |
Scale |
Value |
Rounded value |
Description |
|---|---|---|---|---|
R |
1 |
10.3 |
10 |
Round 10.3 half up with a scale of ones. The number 10.3 is closer to 10 than 11, therefore round to 10. |
R |
1 |
10.5 |
11 |
The number 10.5 halfway between 10 and 11, therefore round to 11. |
R |
1 |
-10.3 |
-10 |
The number -10.3 is closer to -10 than -11. |
R |
1 |
-10.5 |
-11 |
The number -10.5 is halfway between -10 and -11, therefore round away from 0 to -11. |
RD |
1 |
10.9 |
10 |
Round down 10.9 towards 0. Therefore, round down 10.9 to 10. |
RD |
1 |
-10.9 |
-10 |
Round down negative numbers towards 0. Therefore, round down -10.9 to -10. |
RU |
.01 |
5.551 |
5.56 |
Round up away from 0. Therefore, round up 5.551 to 5.56. |
RU |
.01 |
-5.551 |
-5.56 |
Round up away from 0. Therefore, round up -5.551 to -5.56. |
RE |
.01 |
5.551 |
5.55 |
Round half-even towards the nearest number. |
RE |
.01 |
5.545 |
5.54 |
Round half-even towards the even number since 5.545 is halfway between 5.54 and 5.55. |
RE |
.01 |
-5.555 |
-5.56 |
Round half-even towards the even number since -5.555 is halfway between -5.55 and -5.56. |
Through configuration, you can also add rounding types for ceiling, floor, half down, and unnecessary.
See also
