__d64_reround, __d128_reround

Purpose

Reround

Complete rounding of a partially rounded value, avoiding double rounding which causes errors.

Prototype

_Decimal64 __d64_reround (_Decimal64, unsigned long number_of_digits, unsigned long rounding_mode);

_Decimal128 __d128_reround (_Decimal128, unsigned long number_of_digits, unsigned long rounding_mode);

Parameters

number_of_digits
The number of digits to round to, from 1 to 15 for __d64_reround and from 1 to 33 for __d128_reround.
rounding_mode
One of the compile-time constant values or macros defined in Table 1.

Usage

These functions temporarily override the rounding mode in effect for the current operation. The value to be rerounded should have been previously rounded using mode DFP_ROUND_TO_PREPARE_FOR_SHORTER_PRECISION or 7 to ensure correct rounding.