BloombergLP::bdldfp::DecimalConvertUtil

This struct provides a namespace for utility functions that convert between the decimal floating-point types of bdldfp_decimal and various other formats.

Synopsis

Declared in <bdldfp_decimalconvertutil.h>

struct DecimalConvertUtil;

Static Member Functions

NameDescription
decimal128FromBID decimal128FromBID overloads
decimal128FromDPD decimal128FromDPD overloads
decimal128FromDouble Same as the related overload above for decimal128FromDouble.
decimal128FromFloat Return a decimal floating-point number converted from the specified binary.
decimal128FromNetwork Same as the overload taking Decimal64.
decimal128ToBID DEPRECATED: Use decimalToBID instead.
decimal128ToDPD DEPRECATED: Use decimalToDPD instead.
decimal128ToDouble DEPRECATED: Use deciamalToDouble instead.
decimal128ToFloat DEPRECATED: Use deciamalToFloat instead.
decimal128ToNetwork Same as the related overload above for decimal128ToNetwork.
decimal32FromBID Same as the related overload above for decimal32FromBID.
decimal32FromDPD Same as the related overload above for decimal32FromDPD.
decimal32FromDouble Same as the related overload above for decimal32FromDouble.
decimal32FromFloat DEPRECATED: Use decimalFromFloat instead.
decimal32FromNetwork Same as the related overload above for decimal32FromNetwork.
decimal32ToBID Same as the related overload above for decimal32ToBID.
decimal32ToDPD Convert the specified decimal to densely packed decimal format in the specified buffer.
decimal32ToDouble Same as the related overload above for decimal32ToDouble.
decimal32ToFloat Same as the related overload above for decimal32ToFloat.
decimal32ToNetwork Same as the related overload above for decimal32ToNetwork.
decimal64FromBID decimal64FromBID overloads
decimal64FromDPD decimal64FromDPD overloads
decimal64FromDouble Same as the related overload above for decimal64FromDouble.
decimal64FromFloat DEPRECATED: Use decimalFromFloat instead.
decimal64FromMultiWidthEncoding Decode a decimal value in the multi-width encoding format from the specified buffer having the specified size. Return the decoded value. The behavior is undefined unless buffer has at least size bytes, and size is a valid encoding size in the multi-width encoding format.
decimal64FromMultiWidthEncodingIfValid Decode a decimal value in the multi-width encoding format from the specified buffer having the specified size and store the result into the specified decimal parameter. Return 0 on success, and non-zero value otherwise. The behavior is undefined unless buffer has at least size bytes. Note that this function returns a non-zero value and leaves decimal unchanged if size is not a valid encoding size of the multi-width encoding format.
decimal64FromMultiWidthEncodingRaw Decode a decimal value in the multi-width encoding format from the specified buffer having the specified size. Return the decoded value. The behavior is undefined unless buffer has at least size bytes, size is a valid encoding size in the multi-width encoding format, and size <= 5. Note that this function does not support decoding values requiring a full IEEE network encoding, which is supported by the decimal64FromMultiWidthEncoding function.
decimal64FromNetwork Same as the related overload above for decimal64FromNetwork.
decimal64FromVariableWidthEncoding Store into the specified decimal, the value of Decimal64 value stored in the variable-width encoding format at the specified buffer address. Return the address one past the last byte read from buffer. The behavior is undefined unless buffer points to a memory area holding a Decimal64 value encoded in the variable-width encoding format.
decimal64ToBID DEPRECATED: Use decimalToBID instead.
decimal64ToDPD DEPRECATED: Use decimalToDPD instead.
decimal64ToDouble Same as the related overload above for decimal64ToDouble.
decimal64ToFloat DEPRECATED: Use decimalToFloat instead.
decimal64ToMultiWidthEncoding Store the specified decimal, in the multi-width encoding format, into the specified buffer and return the number of bytes used by the encoding. The behavior is undefined unless buffer points to a memory area with enough room to hold the encode value (which has a maximum size of 8 bytes).
decimal64ToMultiWidthEncodingRaw If the specified decimal can be encoded in 5 or fewer bytes of the multi-width encoding format, then store decimal into the specified buffer in that format, and return the number of bytes written to buffer. Otherwise, return 0. The behavior is undefined unless buffer points to a memory area having at least 5 bytes. Note that this function does not supporting encoding values requiring a full IEEE network encoding, which is supported by the decimal64ToMultiWidthEncoding function.
decimal64ToNetwork Same as the related overload above for decimal64ToNetwork.
decimal64ToVariableWidthEncoding Store the specified decimal, in the variable-width encoding format, into the specified buffer and return the address one past the last byte written into the buffer. The behavior is undefined unless buffer points to a memory area with enough room to hold the encoded value (which has a maximum size of 9 bytes).
decimalFromBID decimalFromBID overloads
decimalFromDPD decimalFromDPD overloads
decimalFromNetwork decimalFromNetwork overloads
decimalToBID decimalToBID overloads
decimalToDPD decimalToDPD overloads
decimalToDouble decimalToDouble overloads
decimalToFloat decimalToFloat overloads
decimalToNetwork decimalToNetwork overloads
isValidMultiWidthSize Return true if the specified size is a valid encoding size in the multi-width encoding format, and false otherwise. Note that valid encoding sizes are 1, 2, 3, 4, 5 and 8 bytes.