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
| Parameter | Type | Description |
|---|---|---|
| n | number | the number to round |
| scale | number | decimal digits to keep |
Examples
decimal(1/3, 2)
0.33
Try it ↑
decimal(1.5, 0)
2
Try it ↑
decimal(2.5, 0)
2
Try it ↑
Edge cases and null handling
decimal(2.345, 2)
2.34
Try it ↑
decimal(2.355, 2)
2.36
Try it ↑
decimal(-2.5, 0)
-2
Try it ↑
Part of FEEL numeric functions: a side-by-side rounding table, how FEEL number equality works, and every numeric function with its edge cases.
Related functions
round half up · floor · ceiling
Defined by the OMG DMN 1.6 specification, chapter 10.3.4 (built-in functions).