Skip to main content

$$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​

ArgumentTypeValuesRequired / Default ValueDescription
PrimaryanyYesValue to convert
scaleinteger-1Scale of BigDecimal to set (default is 10 max)
roundingenumUP/ DOWN/CEILING/FLOOR/HALF_UP/HALF_DOWN/ HALF_EVENHALF_UPJava'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