BloombergLP::bdldfp::DecimalImpUtil::convertToDecimal128

Convert the specified input to the closest value of the indicated result type following the conversion rules as defined by IEEE-754:

Synopsis

Declared in <bdldfp_decimalimputil.h>

static
DecimalImpUtil::ValueType128
convertToDecimal128(ValueType32 const& input);

Description

* If input is signaling NaN, store the value of the macro EDOM into errno and return signaling NaN value. * If input is NaN, return NaN value. * Otherwise if input is infinity (positive or negative), then return infinity with the same sign. * Otherwise if input is zero (positive or negative), then return zero with the same sign. * Otherwise if input has an absolute value that is larger than maximum or is smaller than minimum value supported by the result type, store the value of the macro ERANGE into errno and return infinity or zero with the same sign respectively. * Otherwise if input has a value that is not exactly representable using maximum digit number supported by the indicated result type then return the input rounded according to the rounding direction. * Otherwise return input value of the result type. Convert the specified 32-bit decimal input to 128-bit decimal.