The CURRENT DECFLOAT ROUNDING MODE special register specifies
the rounding mode that is used for DECFLOAT values.
The data type is VARCHAR(128). The following rounding
modes are supported:
- ROUND_CEILING rounds the value towards positive infinity. If all
of the discarded digits are zero or if the sign is negative, the result
is unchanged (except for the removal of the discarded digits). Otherwise,
the result coefficient is incremented by 1.
- ROUND_DOWN rounds the value towards 0 (truncation). The discarded
digits are ignored.
- ROUND_FLOOR rounds the value towards negative infinity. If all
of the discarded digits are zero or if the sign is positive, the result
is unchanged (except for the removal of the discarded digits). Otherwise,
the sign is negative and the result coefficient is incremented by
1.
- ROUND_HALF_EVEN rounds the value to the nearest value. If the
values are equidistant, rounds the value so that the final digit is
even. If the discarded digits represent more than half of the value
of a number in the next left position, the result coefficient is incremented
by 1. If they represent less than half, the result coefficient is
not adjusted (that is, the discarded digits are ignored). Otherwise,
the result coefficient is unaltered if its rightmost digit is even,
or incremented by 1 if its rightmost digit is odd (to make an even
digit).
- ROUND_HALF_UP rounds the value to the nearest value. If the values
are equidistant, rounds the value up. If the discarded digits represent
half or more than half of the value of a number in the next left position,
the result coefficient is incremented by 1. Otherwise, the discarded
digits are ignored.
The value of the DECFLOAT rounding mode on a client can
be confirmed to match that of the server by invoking the SET CURRENT
DECFLOAT ROUNDING MODE statement. However, this statement cannot be
used to change the rounding mode of the server. The initial value
of CURRENT DECFLOAT ROUNDING MODE is determined by the
decflt_rounding database
configuration parameter
and can only be changed by
changing the value of this database configuration parameter.