Placeholder¶
Evaluates the provided Expression to return a number.
Placeholder Patterns¶
%math_<expression>%%math_[decimals]:[rounding_mode]_<expression>%
Options¶
decimals¶
| Type | Required | Default |
|---|---|---|
| Number | No | Config option Decimals |
Sets the number of decimal places to display on the final number.
rounding_mode¶
| Type | Required | Default |
|---|---|---|
| String | No | Config option Rounding |
Sets the rounding mode to use.
Available modes
-
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 in which case it rounds up. This is what you're commonly teached 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 in which case it rounds 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 in which case it rounds to nearest even neighbour (Up if digit to the left is odd, else down).
Examples:-1.5 -> -2-1.1 -> -1-1.0 -> -11.0 -> 11.1 -> 11.5 -> 2
expression¶
| Type | Required | Default |
|---|---|---|
| String | Yes |
Examples¶
%math_1+2% -> 3
%math_6:_1/3% -> 0.333333 # Rounding is half-up
%math_:ceiling_1/3% -> 0.334 # Decimals is 3
%math_22[prc]4% -> 2 # Equal to '22 % 4'