FEEL

decimal

FEEL built-in function · FEEL numeric functions

decimal(n, scale)

Rounds n to the given scale using banker's rounding (round half to even).

decimal rounds half to even, also called banker's rounding: 2.5 becomes 2 and 3.5 becomes 4. That avoids a systematic upward bias when many values are summed, but it surprises people checking an invoice by hand. Use round half up for school rounding.

Parameters

ParameterTypeDescription
nnumberthe number to round
scalenumberdecimal digits to keep

Examples

decimal(1/3, 2)
decimal(1.5, 0)
decimal(2.5, 0)

Edge cases and null handling

decimal(2.345, 2)
decimal(2.355, 2)
decimal(-2.5, 0)
decimal(123.456, -1)

Negative scale rounds left of the decimal point.

decimal(1.5, null)

The scale is required.

Related functions

round half up · floor · ceiling

Defined by the OMG DMN 1.6 specification, chapter 10.3.4 (built-in functions).