Return the integral value nearest to the specified x.

Synopsis

Declared in <bdldfp_decimalutil.h>

static
Decimal32
round(Decimal32 x);

Description

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

Special value handling: * if x is quiet NaN, quiet NaN is returned. * If x is signaling NaN, quiet NaN is returned and the value of the macro EDOM is stored into errno. * if x is +/‐infinity or +/‐0, it is returned unmodified.

Examples: round(0.5) ==> 1.0; round(‐0.5) ==> ‐1.0

Return Value

integral value nearest to x

Parameters

Name

Description

x

value to round to nearest integral decimal

Created with MrDocs