BloombergLP::bdldfp::DecimalImpUtil::uint64ToDecimal64

Return a Decimal64 object having the value closest to the specified value following the conversion rules as defined by IEEE-754:

Synopsis

Declared in <bdldfp_decimalimputil.h>

static
DecimalImpUtil::ValueType64
uint64ToDecimal64(unsigned long long value);

Description

* If value is zero then initialize this object to a zero with an unspecified sign and an unspecified exponent. * Otherwise if value has a value that is not exactly representable using std::numeric_limits<Decimal64>::max_digit decimal digits then return a decimal value initialized to the value of value rounded according to the rounding direction. * Otherwise initialize this object to the value of the value.

The exponent 0 (quantum 1e-15) is preferred during conversion unless it would cause unnecessary loss of precision.