Rounds the provided number based on the provided precision and/or rounding behaviour.
%formatter_number_round_<number>%%formatter_number_round_[precision]:[rounding_mode]_<number>%
| Option | Description |
| How many digits after the decimal point should be kept. | |
|
Type: Number Required? No Conditions:
expansion.formatter.rounding.precision)
|
|
|
How the number should be rounded if any fractions are discarded. |
|
|
Type: String Required? No Default: Config value ( expansion.formatter.rounding.mode)
|
|
| The number to convert. | |
|
Type: Number Required? Yes |
up- Rounds away from zero. Always increases the digit prior to a non-zero discarded fraction.
- Examples:
-1.5 -> -2-1.1 -> -2-1.0 -> -11.0 -> 11.1 -> 21.5 -> 2
down- Rounds towards zero. Always decreases the digit prior to a non-zero discarded fraction.
- Examples:
-1.5 -> -1-1.1 -> -1-1.0 -> -11.0 -> 11.1 -> 11.5 -> 1
ceiling- Rounds towards positive infinity. Always rounds up if number is positive, otherwise rounds down.
- Examples:
-1.5 -> -1-1.1 -> -1-1.0 -> -11.0 -> 11.1 -> 21.5 -> 2
floor- Rounds towards negative infinity. Always rounds down if number is positive, otherwise rounds up.
- Examples:
-1.5 -> -2-1.1 -> -2-1.0 -> -11.0 -> 11.1 -> 11.5 -> 1
half-up- Rounds to nearest neighbour unless both neighbours are equidistant (5) in which case round up. This is what you are usually taught in school.
- Examples:
-1.5 -> -2-1.1 -> -1-1.0 -> -11.0 -> 11.1 -> 11.5 -> 2
half-down- Rounds to nearest neighbour unless both neighbours are equidistant (5) in which case round down.
- Examples:
-1.5 -> -1-1.1 -> -1-1.0 -> -11.0 -> 11.1 -> 11.5 -> 1
half-even- Rounds to nearest neighbour unless both neighbours are equidistant (5), in which case, round to nearest even neighbour (Up if digit to the left is odd, otherwise down)
- Examples:
-1.5 -> -2-1.1 -> -1-1.0 -> -11.0 -> 11.1 -> 11.5 -> 2
/papi parse me %formatter_number_round_1.5% -> 2 # Default is half-up
/papi parse me %formatter_number_round_3:_1.5% -> 2.000 # Default is half-up
/papi parse me %formatter_number_round_:half-down_1.5% -> 1
/papi parse me %formatter_number_round_3:half-down_1.5% -> 1.000