$$decimal
Converts number to BigDecimal type
Usage​
{
"$$decimal": /* Value to convert */,
"scale": -1 /* integer */,
"rounding": "HALF_UP" /* or UP / DOWN / CEILING / FLOOR / HALF_DOWN / HALF_EVEN */
}
"$$decimal([scale],[rounding]):{input}"
note
Concrete values in the usage example are default values.
Returns​
number (BigDecimal)
Arguments​
| Argument | Type | Values | Required / Default Value | Description |
|---|---|---|---|---|
| Input | any | Yes | Value to convert | |
scale | integer | -1 | Scale of BigDecimal to set (default is 10 max) | |
rounding | enum | UP/ DOWN/CEILING/FLOOR/HALF_UP/HALF_DOWN/ HALF_EVEN | HALF_UP | Java's RoundingMode |
Examples​
Input
Definition
Output
"123456789.87654321"
"$$decimal:$"
123456789.87654321
"123456789.87654321"
"$$decimal():$"
123456789.87654321
123456789.87654321
"$$decimal:$"
123456789.87654321
null
"$$decimal:$"
null
"123456789.87654321"
"$$decimal(2):$"
123456789.88
"123456789.87654321"
"$$decimal(2,FLOOR):$"
123456789.87
"1.01234567890123456789"
"$$decimal:$"
1.012345678901235
"123456789.87654321"
{
"$$decimal": "$",
"scale": 2
}
123456789.88
"123456789.87654321"
{
"$$decimal": "$",
"scale": 2,
"rounding": "FLOOR"
}
123456789.87
"1.01234567890123456789"
{
"$$decimal": "$"
}
1.012345678901235