BloombergLP::bdldfp::DecimalUtil::round

Return the specified x value rounded to the specified precision decimal places. Round halfway cases away from zero, regardless of the current decimal floating point rounding mode. If x is integral, positive zero, negative zero, NaN, or infinity then return x itself.

Synopsis

Declared in <bdldfp_decimalutil.h>

static
Decimal32
round(
    Decimal32 x,
    unsigned int precision);

Description

Examples: round(3.14159, 3) ==> 3.142