BloombergLP::bdldfp::DecimalImpUtil::lround

Return the integral value nearest to the specified x. Round halfway cases away from zero, regardless of the current decimal floating point rounding mode.

Synopsis

Declared in <bdldfp_decimalimputil.h>

static
long
lround(ValueType32 x);

Description

Special value handling: * if x is NaN (either quiet or signaling), quiet NaN is returned and the value of the macro EDOM is stored into errno. * if x is +/-infinity, quite NaN is returned and the value of the macro EDOM is stored into errno. * If the result of the rounding is outside the range of the return type, the macro EDOM is stored into errno.

Examples: lround(0.5) ==> 1.0; lround(-0.5) ==> -1.0