[#BloombergLP-bdldfp-DecimalConvertUtil] = xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/bdldfp.adoc[bdldfp]::DecimalConvertUtil :relfileprefix: ../../ :mrdocs: 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>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- struct DecimalConvertUtil; ---- == Static Member Functions [cols="1,4"] |=== | Name| Description | xref:BloombergLP/bdldfp/DecimalConvertUtil/decimal128FromBID-04.adoc[`decimal128FromBID`] | `decimal128FromBID` overloads | xref:BloombergLP/bdldfp/DecimalConvertUtil/decimal128FromDPD-0f.adoc[`decimal128FromDPD`] | `decimal128FromDPD` overloads | xref:BloombergLP/bdldfp/DecimalConvertUtil/decimal128FromDouble.adoc[`decimal128FromDouble`] | Same as the related overload above for `decimal128FromDouble`. | xref:BloombergLP/bdldfp/DecimalConvertUtil/decimal128FromFloat.adoc[`decimal128FromFloat`] | Return a decimal floating‐point number converted from the specified `binary`. | xref:BloombergLP/bdldfp/DecimalConvertUtil/decimal128FromNetwork.adoc[`decimal128FromNetwork`] | Same as the overload taking `Decimal64`. | xref:BloombergLP/bdldfp/DecimalConvertUtil/decimal128ToBID.adoc[`decimal128ToBID`] | DEPRECATED: Use `decimalToBID` instead. | xref:BloombergLP/bdldfp/DecimalConvertUtil/decimal128ToDPD.adoc[`decimal128ToDPD`] | DEPRECATED: Use `decimalToDPD` instead. | xref:BloombergLP/bdldfp/DecimalConvertUtil/decimal128ToDouble.adoc[`decimal128ToDouble`] | DEPRECATED: Use `deciamalToDouble` instead. | xref:BloombergLP/bdldfp/DecimalConvertUtil/decimal128ToFloat.adoc[`decimal128ToFloat`] | DEPRECATED: Use `deciamalToFloat` instead. | xref:BloombergLP/bdldfp/DecimalConvertUtil/decimal128ToNetwork.adoc[`decimal128ToNetwork`] | Same as the related overload above for `decimal128ToNetwork`. | xref:BloombergLP/bdldfp/DecimalConvertUtil/decimal32FromBID-0f.adoc[`decimal32FromBID`] | Same as the related overload above for `decimal32FromBID`. | xref:BloombergLP/bdldfp/DecimalConvertUtil/decimal32FromDPD-03.adoc[`decimal32FromDPD`] | Same as the related overload above for `decimal32FromDPD`. | xref:BloombergLP/bdldfp/DecimalConvertUtil/decimal32FromDouble.adoc[`decimal32FromDouble`] | Same as the related overload above for `decimal32FromDouble`. | xref:BloombergLP/bdldfp/DecimalConvertUtil/decimal32FromFloat.adoc[`decimal32FromFloat`] | DEPRECATED: Use `decimalFromFloat` instead. | xref:BloombergLP/bdldfp/DecimalConvertUtil/decimal32FromNetwork.adoc[`decimal32FromNetwork`] | Same as the related overload above for `decimal32FromNetwork`. | xref:BloombergLP/bdldfp/DecimalConvertUtil/decimal32ToBID.adoc[`decimal32ToBID`] | Same as the related overload above for `decimal32ToBID`. | xref:BloombergLP/bdldfp/DecimalConvertUtil/decimal32ToDPD.adoc[`decimal32ToDPD`] | Convert the specified `decimal` to densely packed decimal format in the specified `buffer`. | xref:BloombergLP/bdldfp/DecimalConvertUtil/decimal32ToDouble.adoc[`decimal32ToDouble`] | Same as the related overload above for `decimal32ToDouble`. | xref:BloombergLP/bdldfp/DecimalConvertUtil/decimal32ToFloat.adoc[`decimal32ToFloat`] | Same as the related overload above for `decimal32ToFloat`. | xref:BloombergLP/bdldfp/DecimalConvertUtil/decimal32ToNetwork.adoc[`decimal32ToNetwork`] | Same as the related overload above for `decimal32ToNetwork`. | xref:BloombergLP/bdldfp/DecimalConvertUtil/decimal64FromBID-03.adoc[`decimal64FromBID`] | `decimal64FromBID` overloads | xref:BloombergLP/bdldfp/DecimalConvertUtil/decimal64FromDPD-0e.adoc[`decimal64FromDPD`] | `decimal64FromDPD` overloads | xref:BloombergLP/bdldfp/DecimalConvertUtil/decimal64FromDouble.adoc[`decimal64FromDouble`] | Same as the related overload above for `decimal64FromDouble`. | xref:BloombergLP/bdldfp/DecimalConvertUtil/decimal64FromFloat.adoc[`decimal64FromFloat`] | DEPRECATED: Use `decimalFromFloat` instead. | xref:BloombergLP/bdldfp/DecimalConvertUtil/decimal64FromMultiWidthEncoding.adoc[`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. | xref:BloombergLP/bdldfp/DecimalConvertUtil/decimal64FromMultiWidthEncodingIfValid.adoc[`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. | xref:BloombergLP/bdldfp/DecimalConvertUtil/decimal64FromMultiWidthEncodingRaw.adoc[`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. | xref:BloombergLP/bdldfp/DecimalConvertUtil/decimal64FromNetwork.adoc[`decimal64FromNetwork`] | Same as the related overload above for `decimal64FromNetwork`. | xref:BloombergLP/bdldfp/DecimalConvertUtil/decimal64FromVariableWidthEncoding.adoc[`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. | xref:BloombergLP/bdldfp/DecimalConvertUtil/decimal64ToBID.adoc[`decimal64ToBID`] | DEPRECATED: Use `decimalToBID` instead. | xref:BloombergLP/bdldfp/DecimalConvertUtil/decimal64ToDPD.adoc[`decimal64ToDPD`] | DEPRECATED: Use `decimalToDPD` instead. | xref:BloombergLP/bdldfp/DecimalConvertUtil/decimal64ToDouble.adoc[`decimal64ToDouble`] | Same as the related overload above for `decimal64ToDouble`. | xref:BloombergLP/bdldfp/DecimalConvertUtil/decimal64ToFloat.adoc[`decimal64ToFloat`] | DEPRECATED: Use `decimalToFloat` instead. | xref:BloombergLP/bdldfp/DecimalConvertUtil/decimal64ToMultiWidthEncoding.adoc[`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). | xref:BloombergLP/bdldfp/DecimalConvertUtil/decimal64ToMultiWidthEncodingRaw.adoc[`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. | xref:BloombergLP/bdldfp/DecimalConvertUtil/decimal64ToNetwork.adoc[`decimal64ToNetwork`] | Same as the related overload above for `decimal64ToNetwork`. | xref:BloombergLP/bdldfp/DecimalConvertUtil/decimal64ToVariableWidthEncoding.adoc[`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). | xref:BloombergLP/bdldfp/DecimalConvertUtil/decimalFromBID-0c5.adoc[`decimalFromBID`] | `decimalFromBID` overloads | xref:BloombergLP/bdldfp/DecimalConvertUtil/decimalFromDPD-088.adoc[`decimalFromDPD`] | `decimalFromDPD` overloads | xref:BloombergLP/bdldfp/DecimalConvertUtil/decimalFromNetwork-0e.adoc[`decimalFromNetwork`] | `decimalFromNetwork` overloads | xref:BloombergLP/bdldfp/DecimalConvertUtil/decimalToBID-00.adoc[`decimalToBID`] | `decimalToBID` overloads | xref:BloombergLP/bdldfp/DecimalConvertUtil/decimalToDPD-04.adoc[`decimalToDPD`] | `decimalToDPD` overloads | xref:BloombergLP/bdldfp/DecimalConvertUtil/decimalToDouble-0f.adoc[`decimalToDouble`] | `decimalToDouble` overloads | xref:BloombergLP/bdldfp/DecimalConvertUtil/decimalToFloat-029.adoc[`decimalToFloat`] | `decimalToFloat` overloads | xref:BloombergLP/bdldfp/DecimalConvertUtil/decimalToNetwork-0d.adoc[`decimalToNetwork`] | `decimalToNetwork` overloads | xref:BloombergLP/bdldfp/DecimalConvertUtil/isValidMultiWidthSize.adoc[`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. |=== [.small]#Created with https://www.mrdocs.com[MrDocs]#