DB2 Version 10.1 for Linux, UNIX, and Windows

decflt_rounding - Decimal floating point rounding configuration parameter

This parameter allows you to specify the rounding mode for decimal floating point (DECFLOAT). The rounding mode affects decimal floating-point operations in the server, and in LOAD.

Configuration type
Database
Parameter type
Configurable

See Effects of changing decflt_rounding.

Default [range]
ROUND_HALF_EVEN [ROUND_CEILING, ROUND_FLOOR, ROUND_HALF_UP, ROUND_DOWN]
DB2® database systems support five IEEE-compliant decimal floating point rounding modes. The rounding mode specifies how to round the result of a calculation when the result exceeds the precision. The definitions for all the rounding modes are as follows:
ROUND_CEILING
Round towards +infinity. If all of the discarded digits are zero or if the sign is negative the result is unchanged. Otherwise, the result coefficient should be incremented by 1 (rounded up).
ROUND_FLOOR
Round towards -infinity. If all of the discarded digits are zero or if the sign is positive the result is unchanged. Otherwise, the sign is negative and the result coefficient should be incremented by 1.
ROUND_HALF_UP
Round to nearest; if equidistant, round up 1. If the discarded digits represent greater than or equal to half (0.5) of the value of a 1 in the next left position then the result coefficient should be incremented by 1 (rounded up). Otherwise, the discarded digits (0.5 or less) are ignored.
ROUND_HALF_EVEN
Round to nearest; if equidistant, round so that the final digit is even. If the discarded digits represent greater than half (0.5) the value of a one in the next left position, then the result coefficient should be increment by 1 (rounded up). If they represent less than half, then the result coefficient is not adjusted, that is, the discarded digits are ignored. Otherwise, if they represent exactly half, the result coefficient is unaltered if its rightmost digit is even, or incremented by 1 (rounded up) if its rightmost digit is odd, to make an even digit. This rounding mode is the default rounding mode as per IEEE decimal floating point specification and is the default rounding mode in DB2 database products.
ROUND_DOWN
Round towards 0 (truncation). The discarded digits are ignored.
Table 1 shows the result of rounding of 12.341, 12.345, 12.349, 12.355, and -12.345, each to 4 digits, under different rounding modes:
Table 1. Decimal floating point rounding modes
Rounding mode 12.341 12.345 12.349 12.355 -12.345
ROUND_DOWN 12.34 12.34 12.34 12.35 -12.34
ROUND_HALF_UP 12.34 12.35 12.35 12.36 -12.35
ROUND_HALF_EVEN 12.34 12.34 12.35 12.36 -12.34
ROUND_FLOOR 12.34 12.34 12.34 12.35 -12.35
ROUND_CEILING 12.35 12.35 12.35 12.36 -12.34

Effects of changing decflt_rounding

Note: The value of this configuration parameter is not changed dynamically but will become effective only after all applications disconnect from the database. If the database is activated, it must be deactivated.