BloombergLP::bdldfp::DecimalImpUtil::lround

Return x rounded to the nearest long int.

Synopsis

Declared in <bdldfp_decimalimputil.h>

static
long
lround(ValueType32 x);

Description

Round halfway cases away from zero, regardless of the current decimal floating point rounding mode.

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

Return Value

x rounded to the nearest long int

Parameters

NameDescription
xvalue to round