DB2 10.5 for Linux, UNIX, and Windows

decflt_rounding - Decimal floating point rounding configuration parameter

This parameter specifies the rounding mode for decimal floating point (DECFLOAT) values. The rounding mode affects decimal floating-point operations in the server, and in LOAD command operations.

Configuration type
Database
Parameter type
Configurable

See Effects of changing the value of 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 is 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 digit or, if equidistant, round up by 1. If the discarded digits represent a value that is greater than or equal to 0.5 in the next left position, then the result coefficient is incremented by 1 (rounded up). Otherwise, the discarded digits that have a value that is less than 0.5 are ignored.
ROUND_HALF_EVEN
Round to nearest digit or, if equidistant, round so that the final digit is an even number. If the discarded digits represent a value greater than 0.5 in the next left position, then the resulting coefficient is 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 stated in the 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 the value of decflt_rounding

Changing the value of the parameter has the following consequences:

The value of this configuration parameter is not changed dynamically. The changes become effective only after all applications disconnect from the database and the database is restarted.