[#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&hyphen;point types of `bdldfp&lowbar;decimal` and various other formats&period;

== Synopsis

Declared in `&lt;bdldfp&lowbar;decimalconvertutil&period;h&gt;`

[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`&period;
| xref:BloombergLP/bdldfp/DecimalConvertUtil/decimal128FromFloat.adoc[`decimal128FromFloat`] 
| Return a decimal floating&hyphen;point number converted from the specified `binary`&period;
| xref:BloombergLP/bdldfp/DecimalConvertUtil/decimal128FromNetwork.adoc[`decimal128FromNetwork`] 
| Same as the overload taking `Decimal64`&period;
| xref:BloombergLP/bdldfp/DecimalConvertUtil/decimal128ToBID.adoc[`decimal128ToBID`] 
| DEPRECATED&colon; Use `decimalToBID` instead&period;
| xref:BloombergLP/bdldfp/DecimalConvertUtil/decimal128ToDPD.adoc[`decimal128ToDPD`] 
| DEPRECATED&colon; Use `decimalToDPD` instead&period;
| xref:BloombergLP/bdldfp/DecimalConvertUtil/decimal128ToDouble.adoc[`decimal128ToDouble`] 
| DEPRECATED&colon; Use `deciamalToDouble` instead&period;
| xref:BloombergLP/bdldfp/DecimalConvertUtil/decimal128ToFloat.adoc[`decimal128ToFloat`] 
| DEPRECATED&colon; Use `deciamalToFloat` instead&period;
| xref:BloombergLP/bdldfp/DecimalConvertUtil/decimal128ToNetwork.adoc[`decimal128ToNetwork`] 
| Same as the related overload above for `decimal128ToNetwork`&period;
| xref:BloombergLP/bdldfp/DecimalConvertUtil/decimal32FromBID-0f.adoc[`decimal32FromBID`] 
| Same as the related overload above for `decimal32FromBID`&period;
| xref:BloombergLP/bdldfp/DecimalConvertUtil/decimal32FromDPD-03.adoc[`decimal32FromDPD`] 
| Same as the related overload above for `decimal32FromDPD`&period;
| xref:BloombergLP/bdldfp/DecimalConvertUtil/decimal32FromDouble.adoc[`decimal32FromDouble`] 
| Same as the related overload above for `decimal32FromDouble`&period;
| xref:BloombergLP/bdldfp/DecimalConvertUtil/decimal32FromFloat.adoc[`decimal32FromFloat`] 
| DEPRECATED&colon; Use `decimalFromFloat` instead&period;
| xref:BloombergLP/bdldfp/DecimalConvertUtil/decimal32FromNetwork.adoc[`decimal32FromNetwork`] 
| Same as the related overload above for `decimal32FromNetwork`&period;
| xref:BloombergLP/bdldfp/DecimalConvertUtil/decimal32ToBID.adoc[`decimal32ToBID`] 
| Same as the related overload above for `decimal32ToBID`&period;
| xref:BloombergLP/bdldfp/DecimalConvertUtil/decimal32ToDPD.adoc[`decimal32ToDPD`] 
| Convert the specified `decimal` to densely packed decimal format in the specified `buffer`&period;
| xref:BloombergLP/bdldfp/DecimalConvertUtil/decimal32ToDouble.adoc[`decimal32ToDouble`] 
| Same as the related overload above for `decimal32ToDouble`&period;
| xref:BloombergLP/bdldfp/DecimalConvertUtil/decimal32ToFloat.adoc[`decimal32ToFloat`] 
| Same as the related overload above for `decimal32ToFloat`&period;
| xref:BloombergLP/bdldfp/DecimalConvertUtil/decimal32ToNetwork.adoc[`decimal32ToNetwork`] 
| Same as the related overload above for `decimal32ToNetwork`&period;
| 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`&period;
| xref:BloombergLP/bdldfp/DecimalConvertUtil/decimal64FromFloat.adoc[`decimal64FromFloat`] 
| DEPRECATED&colon; Use `decimalFromFloat` instead&period;
| xref:BloombergLP/bdldfp/DecimalConvertUtil/decimal64FromMultiWidthEncoding.adoc[`decimal64FromMultiWidthEncoding`] 
| Decode a decimal value in the _multi&hyphen;width encoding_ format from the specified `buffer` having the specified `size`&period; Return the decoded value&period; The behavior is undefined unless `buffer` has at least `size` bytes, and `size` is a valid encoding size in the `multi&hyphen;width encoding` format&period;
| xref:BloombergLP/bdldfp/DecimalConvertUtil/decimal64FromMultiWidthEncodingIfValid.adoc[`decimal64FromMultiWidthEncodingIfValid`] 
| Decode a decimal value in the _multi&hyphen;width encoding_ format from the specified `buffer` having the specified `size` and store the result into the specified `decimal` parameter&period; Return 0 on success, and non&hyphen;zero value otherwise&period; The behavior is undefined unless `buffer` has at least `size` bytes&period; Note that this function returns a non&hyphen;zero value and leaves `decimal` unchanged if `size` is not a valid encoding size of the _multi&hyphen;width encoding_ format&period;
| xref:BloombergLP/bdldfp/DecimalConvertUtil/decimal64FromMultiWidthEncodingRaw.adoc[`decimal64FromMultiWidthEncodingRaw`] 
| Decode a decimal value in the _multi&hyphen;width encoding_ format from the specified `buffer` having the specified `size`&period; Return the decoded value&period; The behavior is undefined unless `buffer` has at least `size` bytes, `size` is a valid encoding size in the `multi&hyphen;width encoding` format, and `size &lt;&equals; 5`&period; Note that this function does not support decoding values requiring a full IEEE network encoding, which is supported by the `decimal64FromMultiWidthEncoding` function&period;
| xref:BloombergLP/bdldfp/DecimalConvertUtil/decimal64FromNetwork.adoc[`decimal64FromNetwork`] 
| Same as the related overload above for `decimal64FromNetwork`&period;
| xref:BloombergLP/bdldfp/DecimalConvertUtil/decimal64FromVariableWidthEncoding.adoc[`decimal64FromVariableWidthEncoding`] 
| Store into the specified `decimal`, the value of `Decimal64` value stored in the _variable&hyphen;width encoding_ format at the specified `buffer` address&period; Return the address one past the last byte read from `buffer`&period; The behavior is undefined unless `buffer` points to a memory area holding a `Decimal64` value encoded in the _variable&hyphen;width encoding_ format&period;
| xref:BloombergLP/bdldfp/DecimalConvertUtil/decimal64ToBID.adoc[`decimal64ToBID`] 
| DEPRECATED&colon; Use `decimalToBID` instead&period;
| xref:BloombergLP/bdldfp/DecimalConvertUtil/decimal64ToDPD.adoc[`decimal64ToDPD`] 
| DEPRECATED&colon; Use `decimalToDPD` instead&period;
| xref:BloombergLP/bdldfp/DecimalConvertUtil/decimal64ToDouble.adoc[`decimal64ToDouble`] 
| Same as the related overload above for `decimal64ToDouble`&period;
| xref:BloombergLP/bdldfp/DecimalConvertUtil/decimal64ToFloat.adoc[`decimal64ToFloat`] 
| DEPRECATED&colon; Use `decimalToFloat` instead&period;
| xref:BloombergLP/bdldfp/DecimalConvertUtil/decimal64ToMultiWidthEncoding.adoc[`decimal64ToMultiWidthEncoding`] 
| Store the specified `decimal`, in the _multi&hyphen;width encoding_ format, into the specified `buffer` and return the number of bytes used by the encoding&period; 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)&period;
| xref:BloombergLP/bdldfp/DecimalConvertUtil/decimal64ToMultiWidthEncodingRaw.adoc[`decimal64ToMultiWidthEncodingRaw`] 
| If the specified `decimal` can be encoded in 5 or fewer bytes of the _multi&hyphen;width encoding_ format, then store `decimal` into the specified `buffer` in that format, and return the number of bytes written to `buffer`&period; Otherwise, return 0&period; The behavior is undefined unless `buffer` points to a memory area having at least 5 bytes&period; Note that this function does not supporting encoding values requiring a full IEEE network encoding, which is supported by the `decimal64ToMultiWidthEncoding` function&period;
| xref:BloombergLP/bdldfp/DecimalConvertUtil/decimal64ToNetwork.adoc[`decimal64ToNetwork`] 
| Same as the related overload above for `decimal64ToNetwork`&period;
| xref:BloombergLP/bdldfp/DecimalConvertUtil/decimal64ToVariableWidthEncoding.adoc[`decimal64ToVariableWidthEncoding`] 
| Store the specified `decimal`, in the _variable&hyphen;width encoding_ format, into the specified `buffer` and return the address one past the last byte written into the `buffer`&period; 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)&period;
| 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&hyphen;width encoding_ format, and `false` otherwise&period; Note that valid encoding sizes are 1, 2, 3, 4, 5 and 8 bytes&period;
|===



[.small]#Created with https://www.mrdocs.com[MrDocs]#
