[#BloombergLP-bdldfp-DecimalImpUtil-binaryToDecimal64-0e]
= xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/bdldfp.adoc[bdldfp]::xref:BloombergLP/bdldfp/DecimalImpUtil.adoc[DecimalImpUtil]::binaryToDecimal64
:relfileprefix: ../../../
:mrdocs:

Create a `Decimal64` closest to binary floating&hyphen;point `value`&period;

== Synopsis

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

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
static
xref:BloombergLP/bdldfp/DecimalImpUtil/ValueType64.adoc[DecimalImpUtil::ValueType64]
binaryToDecimal64(float value);
----

== Description

Create a `Decimal64` object having the value closest to the specified `value` following the conversion rules as defined by IEEE&hyphen;754&colon;

&ast; If `value` is signaling NaN, store the value of the macro `EDOM` into `errno` and return signaling NaN value&period; &ast; Otherwise if `value` is NaN, return a NaN&period; &ast; Otherwise if `value` is infinity (positive or negative), then return an object equal to infinity with the same sign&period; &ast; Otherwise if `value` is a zero value, then return an object equal to zero with the same sign&period; &ast; Otherwise if `value` needs more than `std&colon;&colon;numeric&lowbar;limits&lt;Decimal64&gt;&colon;&colon;max&lowbar;digit` significant decimal digits to represent then return the `value` rounded according to the rounding direction&period; &ast; Otherwise return a `Decimal64` object representing `value`&period;

== Return Value

a `Decimal64` closest to binary floating&hyphen;point `value`

== Parameters

[cols="1,4"]
|===
| Name| Description
| *value*
| binary floating&hyphen;point value to convert
|===


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